-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve script for decoding packets into a new rosbag #236
base: main
Are you sure you want to change the base?
feat: improve script for decoding packets into a new rosbag #236
Conversation
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #236 +/- ##
==========================================
- Coverage 26.11% 0.00% -26.12%
==========================================
Files 101 88 -13
Lines 9212 7646 -1566
Branches 2211 938 -1273
==========================================
- Hits 2406 0 -2406
- Misses 6417 7646 +1229
+ Partials 389 0 -389
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
nebula_examples/CMakeLists.txt
Outdated
@@ -45,7 +45,7 @@ target_link_libraries(hesai_ros_offline_extract_pcd PUBLIC | |||
nebula_decoders::nebula_decoders_hesai | |||
) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? We were avoiding ament_auto
on purpose for reduce building time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, when I first build this package without ament_auto, there is no output in the built output directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(please remind me to delete these two images when this is somehow resolved)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I built again with my current PR and I can see the contents correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution is to take the steps that ament auto does manually. That requires some cmake knowledge, but there should be examples in nebula for you to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knzo25
I added list(APPEND ${PROJECT_NAME}_EXECUTABLES "${target}")
and the build works, but the build time is similar to what we got with ament_auto_add_executable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I instead add the install command in CMakeList to make it work.
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
GitHub's review endpoint seems to be down, so I'll post a comment instead: Hi @Owen-Liuyuxuan, thanks for the PR! I notice that you created the fix in a separate copy of the already existing For context: |
@mojomex |
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Should we tackle the codecov CI here..? |
Nope, not needed 🙌 |
@mojomex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks almost ready-to-go!
I found a few things here and there, if you could take a look! thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the list()
commands again, since they were only for debugging purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I remove them, there is no executable output...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, now this one looks good. The install command works
<arg name="is_write_to_pcd" default="false"/> | ||
<arg name="is_write_to_rosbag" default="true"/> | ||
<arg name="is_write_packets_to_rosbag" default="false"/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think renaming these to output_pcd
, output_rosbag
would be more readable.
For packets, none of the options is particularly concise, but forward_packets_to_rosbag
or copy_packets_to_rosbag
would work I think.
<arg name="sensor_model" default="Pandar128E4X" description="Pandar64|Pandar40P|PandarXT32|PandarXT32M|PandarAT128|PandarQT64"/> | ||
<arg name="lidar_parameter_file" default="$(find-pkg-share nebula_ros)/config/lidar/hesai/Pandar128E4X.params.yaml"/> | ||
<arg name="bag_path" default="rosbags/default_2024-10-24-10-50-48_p0900"/> | ||
<arg name="target_topic" default="/sensing/lidar/top/pandar_packets"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this input_topic
would be clearer
|
||
<!-- sensor related configuration --> | ||
<arg name="sensor_model" default="Pandar128E4X" description="Pandar64|Pandar40P|PandarXT32|PandarXT32M|PandarAT128|PandarQT64"/> | ||
<arg name="lidar_parameter_file" default="$(find-pkg-share nebula_ros)/config/lidar/hesai/Pandar128E4X.params.yaml"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use $(var sensor_model)
here instead of hard-coding LiDAR name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<arg name="lidar_parameter_file" default="$(find-pkg-share nebula_ros)/config/lidar/hesai/Pandar128E4X.params.yaml"/> | |
<arg name="lidar_parameter_file" default="$(find-pkg-share nebula_ros)/config/lidar/hesai/$(var sensor_model).param.yaml"/> |
<arg name="is_write_packets_to_rosbag" default="false"/> | ||
|
||
<!-- sensor related configuration --> | ||
<arg name="sensor_model" default="Pandar128E4X" description="Pandar64|Pandar40P|PandarXT32|PandarXT32M|PandarAT128|PandarQT64"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that sensor_model is also inside the parameter file, I will also remove sensor_model in the launch file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh no... The default parameter file requires the sensor model arguments to be pre-defined as a ROS parameter.. which is rather weird..
So I keep this sensor_model parameters in the end.
<param name="return_mode" value="$(var return_mode)"/> | ||
<param name="frame_id" value="$(var frame_id)"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the LiDAR params here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I cleaned up the default parameters.
@@ -31,8 +47,8 @@ | |||
<param name="out_path" value="$(var out_path)"/> | |||
<param name="format" value="$(var format)"/> | |||
<param name="target_topic" value="$(var target_topic)"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to input_topic
here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
I believe this one has also been resolved in the latest PR.
@@ -197,6 +220,7 @@ Status HesaiRosOfflineExtractBag::read_bag() | |||
reader.open(storage_options, converter_options); | |||
int cnt = 0; | |||
int out_cnt = 0; | |||
bool pointcloud_enough = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to output_limit_reached
or some other more self-explaining name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
I believe this one has been resolved in the latest PR.
if (write_rosbag_packets_flag_) { | ||
bag_writer->write(bag_message); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no hard guarantee that one packets message == one pointcloud output (in usual cases the correspondence is 1-to-1 but in the past, when we made updates to scan cutting, this approach broke).
It would be best to move everything from L260-L281 (if (!bag_writer)
... bag_writer->write(...); }
) up into the outer loop, so it runs even if there are no pointclouds output for a given packets message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
I believe this one has been resolved in the latest PR.
<arg name="only_xyz" default="true"/> | ||
|
||
|
||
<node pkg="nebula_examples" exec="hesai_ros_offline_extract_bag_pcd_node" | ||
name="hesai_cloud" output="screen"> | ||
<param from="$(var lidar_parameter_file)"/> | ||
<param name="is_write_to_pcd" value="$(var is_write_to_pcd)"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow substitutions so that variables in the param file get resolved (e.g. calibration_file)
<param name="is_write_to_pcd" value="$(var is_write_to_pcd)"/> | |
<param from="$(var lidar_parameter_file)" allow_substs="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this one have been resolved.
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
@mojomex I push three commits to conduct changes separately. The First Commit
The Second Commit
The Third Commit
|
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
…/nebula into feat/rosbag_decode_script
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
Signed-off-by: YuxuanLiuTier4Desktop <[email protected]>
If you have suggestion on parameter handling please inform here. |
PR Type
Related Links
Description
Improve the decoding script to add a function of transferring a packet topic from ROSBag, decode that, and write the output point clouds into a new rosbag.
Review Procedure
I tested that with ROSBags containing OT128 LiDAR points obtained from internal projects.
Modification from
extract_bag_pcd
out_num_
. The original script does not correctlybreak
from the loop, it only breaks from inner loop.driver_ptr_->parse_cloud_packet
, we transform the PCL data into point cloud messages and write to a new ROSBag.Remarks
Pre-Review Checklist for the PR Author
PR Author should check the checkboxes below when creating the PR.
Checklist for the PR Reviewer
Reviewers should check the checkboxes below before approval.
Post-Review Checklist for the PR Author
PR Author should check the checkboxes below before merging.
CI Checks