Skip to content

Commit a08f210

Browse files
ci(pre-commit): autofix
1 parent 8b4a55c commit a08f210

4 files changed

Lines changed: 30 additions & 38 deletions

File tree

src/nebula_ouster/nebula_ouster/src/ouster_ros_wrapper.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ namespace
4646
{
4747
constexpr double k_ns_to_ms = 1e-6;
4848

49-
/// Fetch Ouster `SensorInfo` JSON from a sensor or replay HTTP API. Respects `http_proxy` / `https_proxy`.
49+
/// Fetch Ouster `SensorInfo` JSON from a sensor or replay HTTP API. Respects `http_proxy` /
50+
/// `https_proxy`.
5051
std::string fetch_ouster_metadata_via_http(const std::string & sensor_url)
5152
{
5253
auto sensor_http = ouster::sdk::sensor::SensorHttp::create(sensor_url);
@@ -425,8 +426,8 @@ void OusterRosWrapper::process_packet(
425426

426427
if (!decode_result.metadata_or_error.has_value()) {
427428
RCLCPP_DEBUG_THROTTLE(
428-
get_logger(), *get_clock(), 1000, "Packet decode failed: %s.",
429-
drivers::to_cstr(decode_result.metadata_or_error.error()));
429+
get_logger(), *get_clock(), 1000, "Packet decode failed: %s.",
430+
drivers::to_cstr(decode_result.metadata_or_error.error()));
430431
return;
431432
}
432433

src/nebula_ouster/nebula_ouster_decoders/include/nebula_ouster_decoders/ouster_decoder.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
#include <nebula_core_common/util/expected.hpp>
2020
#include <nebula_core_decoders/angles.hpp>
2121

22+
#include <ouster/types.h>
23+
2224
#include <cstdint>
2325
#include <functional>
2426
#include <memory>
2527
#include <vector>
2628

27-
#include <ouster/types.h>
28-
2929
namespace nebula::drivers
3030
{
3131

@@ -62,10 +62,7 @@ struct PacketDecodeResult
6262
/// Successful metadata or a decode error.
6363
util::expected<PacketMetadata, DecodeError> metadata_or_error;
6464

65-
PacketDecodeResult()
66-
: performance_counters{}, metadata_or_error(DecodeError::CALLBACK_NOT_SET)
67-
{
68-
}
65+
PacketDecodeResult() : performance_counters{}, metadata_or_error(DecodeError::CALLBACK_NOT_SET) {}
6966
};
7067

7168
/// @brief Decoder that batches Ouster UDP packets via ouster-sdk (@c ScanBatcher) and publishes

src/nebula_ouster/nebula_ouster_decoders/src/ouster_decoder.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "nebula_ouster_decoders/ouster_decoder.hpp"
16+
1617
#include "nebula_ouster_decoders/ouster_lidar_scan_conversions.hpp"
1718

1819
#include <ouster/lidar_scan.h>
@@ -71,9 +72,7 @@ const char * to_cstr(const DecodeError error)
7172
OusterDecoder::OusterDecoder(
7273
FieldOfView<float, Degrees> fov, std::shared_ptr<ouster::sdk::core::SensorInfo> & sensor_info,
7374
bool apply_sensor_extrinsics, pointcloud_callback_t pointcloud_cb)
74-
: impl_(std::make_unique<Impl>(
75-
fov, sensor_info, apply_sensor_extrinsics,
76-
std::move(pointcloud_cb)))
75+
: impl_(std::make_unique<Impl>(fov, sensor_info, apply_sensor_extrinsics, std::move(pointcloud_cb)))
7776
{
7877
}
7978

@@ -91,17 +90,17 @@ PacketDecodeResult OusterDecoder::unpack(const std::vector<uint8_t> & packet)
9190
result.metadata_or_error = DecodeError::CALLBACK_NOT_SET;
9291
result.performance_counters.decode_time_ns =
9392
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
94-
std::chrono::steady_clock::now() - decode_begin)
95-
.count());
93+
std::chrono::steady_clock::now() - decode_begin)
94+
.count());
9695
return result;
9796
}
9897

9998
if (packet.empty()) {
10099
result.metadata_or_error = DecodeError::EMPTY_PACKET;
101100
result.performance_counters.decode_time_ns =
102101
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
103-
std::chrono::steady_clock::now() - decode_begin)
104-
.count());
102+
std::chrono::steady_clock::now() - decode_begin)
103+
.count());
105104
return result;
106105
}
107106

@@ -112,8 +111,8 @@ PacketDecodeResult OusterDecoder::unpack(const std::vector<uint8_t> & packet)
112111
result.metadata_or_error = DecodeError::PACKET_FORMAT_INVALID;
113112
result.performance_counters.decode_time_ns =
114113
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
115-
std::chrono::steady_clock::now() - decode_begin)
116-
.count());
114+
std::chrono::steady_clock::now() - decode_begin)
115+
.count());
117116
return result;
118117
}
119118

@@ -139,29 +138,28 @@ PacketDecodeResult OusterDecoder::unpack(const std::vector<uint8_t> & packet)
139138
PacketMetadata metadata{};
140139
metadata.packet_timestamp_ns =
141140
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
142-
std::chrono::system_clock::now().time_since_epoch())
143-
.count());
141+
std::chrono::system_clock::now().time_since_epoch())
142+
.count());
144143
metadata.did_scan_complete = complete;
145144

146145
if (complete) {
147146
const auto callback_begin = std::chrono::steady_clock::now();
148147
NebulaPointCloudPtr cloud =
149148
nebula_point_cloud_from_lidar_scan(impl_->lidar_scan, impl_->xyz_lut, impl_->fov);
150149
const uint64_t scan_ts = impl_->lidar_scan.get_first_valid_column_timestamp();
151-
const double timestamp_s =
152-
scan_ts != 0U ? static_cast<double>(scan_ts) * 1e-9 : 0.0;
150+
const double timestamp_s = scan_ts != 0U ? static_cast<double>(scan_ts) * 1e-9 : 0.0;
153151
impl_->pointcloud_callback(cloud, timestamp_s);
154152
result.performance_counters.callback_time_ns =
155153
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
156-
std::chrono::steady_clock::now() - callback_begin)
157-
.count());
154+
std::chrono::steady_clock::now() - callback_begin)
155+
.count());
158156
}
159157

160158
result.metadata_or_error = metadata;
161159
result.performance_counters.decode_time_ns =
162160
static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(
163-
std::chrono::steady_clock::now() - decode_begin)
164-
.count());
161+
std::chrono::steady_clock::now() - decode_begin)
162+
.count());
165163
return result;
166164
}
167165

src/nebula_ouster/nebula_ouster_decoders/src/ouster_lidar_scan_conversions.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,20 @@ float normalize_azimuth_deg(float az_deg)
4141
} // namespace
4242

4343
using ouster::sdk::core::LidarScan;
44-
using ouster::sdk::core::XYZLut;
45-
using ouster::sdk::core::SensorInfo;
4644
using ouster::sdk::core::RANGE_UNIT;
45+
using ouster::sdk::core::SensorInfo;
46+
using ouster::sdk::core::XYZLut;
4747
namespace ChanField = ouster::sdk::core::ChanField;
4848

4949
NebulaPointCloudPtr nebula_point_cloud_from_lidar_scan(
50-
const LidarScan & scan, const XYZLut & lut,
51-
const FieldOfView<float, Degrees> & fov)
50+
const LidarScan & scan, const XYZLut & lut, const FieldOfView<float, Degrees> & fov)
5251
{
5352
if (!scan.has_field(ChanField::RANGE) || scan.w == 0 || scan.h == 0) {
5453
return std::make_shared<NebulaPointCloud>();
5554
}
5655

57-
5856
const auto range_img = scan.field<uint32_t>(ChanField::RANGE);
59-
const ouster::sdk::core::PointCloudXYZd xyz =
60-
ouster::sdk::core::cartesian(range_img, lut);
61-
57+
const ouster::sdk::core::PointCloudXYZd xyz = ouster::sdk::core::cartesian(range_img, lut);
6258

6359
const bool dual = scan.sensor_info->num_returns() > 1;
6460
const Eigen::Index h = static_cast<Eigen::Index>(scan.h);
@@ -87,8 +83,8 @@ NebulaPointCloudPtr nebula_point_cloud_from_lidar_scan(
8783
continue;
8884
}
8985

90-
const size_t i = static_cast<size_t>(row) * static_cast<size_t>(scan.w) +
91-
static_cast<size_t>(col);
86+
const size_t i =
87+
static_cast<size_t>(row) * static_cast<size_t>(scan.w) + static_cast<size_t>(col);
9288

9389
Eigen::Vector3d pt = xyz.row(i);
9490

@@ -115,8 +111,8 @@ NebulaPointCloudPtr nebula_point_cloud_from_lidar_scan(
115111
tgt_pt.intensity = static_cast<std::uint8_t>(std::min<uint16_t>(255U, v >> 4));
116112
}
117113
// TODO[unaal]: retrieve return type from the sensor_info config
118-
tgt_pt.return_type = static_cast<std::uint8_t>(
119-
dual ? ReturnType::LAST : ReturnType::STRONGEST);
114+
tgt_pt.return_type =
115+
static_cast<std::uint8_t>(dual ? ReturnType::LAST : ReturnType::STRONGEST);
120116
tgt_pt.channel = static_cast<std::uint16_t>(row);
121117
tgt_pt.azimuth = deg2rad(azimuth_deg);
122118
tgt_pt.elevation = deg2rad(altitude_deg);

0 commit comments

Comments
 (0)