ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sorry if I'm necro-ing an old post, but I stumbled-upon this same error when getting started with ROS2 (as a complete newbie) and this and the OP's link to the SLAM Toolbox github issues page are literally the only places online mentioning this error message.

This post didn't solve my problems completely, but it did lead me to the proper solution so I figure I'll leave my 2-cents for the next person seeking a solution.

Rather than a full robot I was strictly working with a SLAMTech RPLidar A1M8 LIDAR sensor. I was simply trying to feed data from that sensor to slam_toolbox, and to view it in RViz. I was also trying to get this to work with ROS2 as opposed to ROS1.

The simple answer to my problem (hinted-at by the OP, @pfedom), was that I needed to read the instructions and add several instances of the tf2_ros package to my Python launch file. I created static transform publishers as per Link [1] below.

To understand why I needed to do this I went through Link [2] which led to Link [3].

The only real obstacle was understanding the similarities between ROS1 and ROS2, both of which I'm still very new to at time of writing. Once I understood how ROS2 launch files work I was able to follow Link [4] to get SLAM Toolbox working with RViz and to develop a simple launch file for a custom "launch everything" package.

[1] https://docs.ros.org/en/foxy/Tutorials/tf2.html

[2] https://wiki.ros.org/navigation/Tutorials/RobotSetup

[3] https://wiki.ros.org/navigation/Tutorials/RobotSetup/TF

[4] https://www.robotandchisel.com/2020/08/19/slam-in-ros2/

...

It's crude, but I simply added these three static transform publishers to my launch file (which is a combination of one provided by an existing RPLidar ROS2 fork and Link [4]) and ceased having errors completely:

## Somewhere higher-up...
ld = LaunchDescription()

#### tf2 static transforms

## tf2 - base_footprint to laser
node_tf2_fp2laser = Node(
    name='tf2_ros_fp_laser',
    package='tf2_ros',
    executable='static_transform_publisher',
    output='screen',
    arguments=['0', '0', '0', '0.0', '0.0', '0.0', 'base_footprint', 'laser'],   
)
ld.add_action(node_tf2_fp2laser)

## tf2 - base_footprint to map
node_tf2_fp2map = Node(
    name='tf2_ros_fp_map',
    package='tf2_ros',
    executable='static_transform_publisher',
    output='screen',
    arguments=['0', '0', '0', '0.0', '0.0', '0.0', 'base_footprint', 'map'], 
)
ld.add_action(node_tf2_fp2map)

## tf2 - base_footprint to odom
node_tf2_fp2odom = Node(
    name='tf2_ros_fp_odom',
    package='tf2_ros',
    executable='static_transform_publisher',
    output='screen',
    arguments=['0', '0', '0', '0.0', '0.0', '0.0', 'base_footprint', 'odom'],
)
ld.add_action(node_tf2_fp2odom)


## Later, at the end...
return ld