rsasaki0109 / lidarslam_ros2

ROS 2 package of 3D lidar slam using ndt/gicp registration and pose-optimization
BSD 2-Clause "Simplified" License
511 stars 121 forks source link

Use with Carla Bag #82

Closed guzgonav closed 8 months ago

guzgonav commented 9 months ago

Hi, I've been trying to make it work with Carla but I've not been able to.

The sample bag (hdl_400) works just fine, I have a ros2 bag created with Carla that contains imu, lidar and tf amongst others. I changed the topic that receives the PointCloud2 from /velodyne_points to my carla topic, having this: lidarslam.launch.py

mapping = launch_ros.actions.Node(
        package='scanmatcher',
        executable='scanmatcher_node',
        parameters=[main_param_dir],
        remappings=[('/input_cloud','/carla/ego_vehicle/lidar')],
        output='screen'
        )

I tried to change the tf to:

tf = launch_ros.actions.Node(
        package='tf2_ros',
        executable='static_transform_publisher',
        arguments=['0','0','0','0','0','0','1','ego_vehicle','ego_vehicle/lidar']
                )

As my tf_tree is: frames_2023-12-20_23.13.49.pdf

But it keeps saying: _[scanmatcher_node-1] [ERROR] [1703118618.801740320] [scan_matcher]: "base_link" passed to lookupTransform argument target_frame does not exist.

Any idea what is the error? (Im using ros2 humble) Thank u in advance.

rsasaki0109 commented 8 months ago

It seems necessary to also change the parameters related to tf on the lidarslam_ros2 side.

robot_frame_id: "base_link"

https://github.com/rsasaki0109/lidarslam_ros2/blob/develop/lidarslam/param/lidarslam.yaml#L4

guzgonav commented 8 months ago

Thanks, I found out what was causing the error, the correct paramers are:

mapping = launch_ros.actions.Node(
        package='scanmatcher',
        executable='scanmatcher_node',
        parameters=[main_param_dir],
        remappings=[('/input_cloud','/carla/ego_vehicle/lidar')],
        output='screen'
        )

    tf = launch_ros.actions.Node(
        package='tf2_ros',
        executable='static_transform_publisher',
        arguments=['0','0','0','0','0','0','1','base_link','/ego_vehicle']

After that change it works, I also modified the parameter you pointed out, from: robot_frame_id: "base_link" To: robot_frame_id: "ego_vehicle" And it keep working fine.

rsasaki0109 commented 8 months ago

It seems this Issue has been resolved, so I'm closing it. Thank you for your report.

wxyLuna2024 commented 2 months ago

Hi, Can you share the .yaml parameters? I am trying to run the kitti bag but is encountering ndt failing issues