Skip to content

Commit

Permalink
Add the RAW option
Browse files Browse the repository at this point in the history
  • Loading branch information
Samahu committed Sep 16, 2024
1 parent 71fbced commit 485fef3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion launch/driver.launch
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<arg if="$(arg no_bond)" name="_no_bond" value="--no-bond"/>
<arg unless="$(arg no_bond)" name="_no_bond" value=" "/>

<arg name="proc_mask" default="IMG|PCL|IMU|SCAN" doc="
<arg name="proc_mask" default="IMU|PCL|SCAN|IMG|RAW" doc="
use any combination of the 4 flags to enable or disable specific processors"/>

<arg name="scan_ring" default="0" doc="
Expand Down
14 changes: 11 additions & 3 deletions src/os_driver_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OusterDriver : public OusterSensor {
protected:
virtual void onInit() override {
auto& pnh = getPrivateNodeHandle();
auto proc_mask = pnh.param("proc_mask", std::string{"IMU|PCL|SCAN"});
auto proc_mask = pnh.param("proc_mask", std::string{"IMU|PCL|SCAN|IMG|RAW"});
auto tokens = impl::parse_tokens(proc_mask, '|');
if (impl::check_token(tokens, "IMU"))
create_imu_pub();
Expand All @@ -52,6 +52,7 @@ class OusterDriver : public OusterSensor {
create_laser_scan_pubs();
if (impl::check_token(tokens, "IMG"))
create_image_pubs();
publish_raw = impl::check_token(tokens, "RAW");
OusterSensor::onInit();
}

Expand Down Expand Up @@ -190,15 +191,19 @@ class OusterDriver : public OusterSensor {
if (lidar_packet_handler) {
lidar_packet_handler(lidar_packet);
}
OusterSensor::on_lidar_packet_msg(lidar_packet);

if (publish_raw)
OusterSensor::on_lidar_packet_msg(lidar_packet);
}

virtual void on_imu_packet_msg(const ImuPacket& imu_packet) override {
if (imu_packet_handler) {
auto imu_msg = imu_packet_handler(imu_packet);
imu_pub.publish(imu_msg);
}
OusterSensor::on_imu_packet_msg(imu_packet);

if (publish_raw)
OusterSensor::on_imu_packet_msg(imu_packet);
}

private:
Expand All @@ -211,6 +216,9 @@ class OusterDriver : public OusterSensor {

ImuPacketHandler::HandlerType imu_packet_handler;
LidarPacketHandler::HandlerType lidar_packet_handler;

bool publish_raw = false;

};

} // namespace ouster_ros
Expand Down

0 comments on commit 485fef3

Please sign in to comment.