-
Notifications
You must be signed in to change notification settings - Fork 29
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
Issue with timestamp handling in kinematic_icp for 2D LiDAR #31
Comments
I’m sharing a ROS2 bag file to make it easier to reproduce. Steps to Run the Bag:
After a few seconds, the robot will begin moving. Shortly after, the program crashes. |
I just looked into this, and it turns out to be a bug in our Can you checkout at the branch |
@benemer Thanks for your time and effort in maintaining this project! Looking forward to your feedback. |
Description:
When using simulated data with Kinematic_ICP, the 2D lidar messages include a "stamps" field that is populated, but the timestamp values are different from those of a physical LiDAR. For instance, real data shows:
while simulation data shows:
when extracting timestamps using a sensor_msgs::PointCloud2ConstIterator on the "stamps" field, the iterator does not seem to advance properly—it always returns zero for every point.
Steps to Reproduce:
Run the ClearPath simulation that publishes 2D laser scanner messages and you can move the robot around by sending commands to /cmd_vel.
In Kinematic_ICP:
[namespace] is your namespace while simulation.
base_frame
to "base_link"Launch the Kinematic_ICP node (e.g., using
ros2 launch kinematic_icp online_node.launch.py lidar_topic:=/[namespace]/sensors/lidar2d_0/scan use_2d_lidar:=true use_sim_time:=True
).Make sure Kinematic_ICP starts without error. It should print outputs like
If you set the arg
visualize:=true
you should see the odom frame tf on RVIZ.Observed Behavior:
When you start moving the robot, Kinematic_ICP crashes with error code -6
I tried to debug with GDB,
gdb --args /home/user/kinematicicp_ws/install/kinematic_icp/lib/kinematic_icp/kinematic_icp_online_node --ros-args -r __node:=online_node -r __ns:=/kinematic_icp --params-file /home/user/kinematicicp_ws/install/kinematic_icp/share/kinematic_icp/config/kinematic_icp_ros.yaml --params-file /tmp/launch_params_[] -r lidar_odometry:=lidar_odometry -r /tf:=/[namespace]/tf -r /tf_static:=/[namespace]/tf_static
Then type 'run' and move the robot to crash the program.
use backtrace and list to find out the problem. I got this:
I traced back the error to get that in here in the TimeStampHandler.cpp file the iterator
it
does not advance. Although, the simulation does populate the "stamps" field (its name, offset, datatype, and count are correctly defined). However, when iterating over the "stamps" field with a sensor_msgs::PointCloud2ConstIterator, the iterator always returns zero. This behavior prevents the timestamps from being normalized and used further in the de-skewing process, ultimately causing downstream errors.The program works fine with 3D Lidar which is weird. Could the be about laser_geometry projection?!! I don't know!
In the TimeStampHandler.cpp file, observe that the debug output for the "stamps" field (extracted using a PointCloud2ConstIterator) shows zero values for all points.
Note that while the simulation appears to populate the "stamps" field (as seen in the message fields printout), the iterator used in ExtractTimestampsFromMsg always yields 0.
Expected Behavior:
The "stamps" field should be read correctly by the iterator, yielding nonzero values that reflect the simulation’s timestamp (even if these values differ in magnitude from real LiDAR data).
The iterator should advance correctly through all points in the PointCloud2 message.
Environment:
Additional Context:
I have verified the available fields in the PointCloud2 message, which are:
The text was updated successfully, but these errors were encountered: