static_transform_publisher in ROS2 launch file
I just can't get a static transform publisher to launch from a launch.py
file... This is the code:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
ld = LaunchDescription()
node = Node(package = "tf2_ros",
executable = "static_transform_publisher",
arguments = ["0 0 0 0 0 0 odom laser"])
ld.add_action(node)
return ld
This should be pretty straightforward, but the launch fails with:
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [static_transform_publisher-1]: process started with pid [43278]
[static_transform_publisher-1] [ERROR] [1614263713.282074840] []: static_transform_publisher exited due to not having the right number of arguments
[ERROR] [static_transform_publisher-1]: process has died [pid 43278, exit code 2, cmd '/opt/ros/foxy/lib/tf2_ros/static_transform_publisher 0 0 0 0 0 0 odom laser --ros-args'].
I've tried everything that I could think of, but just can't get it to work.
Things that I've tried:
- passing arguments as
arguments = ["0 0 0 0 0 0 odom laser".split(' ')])
- passing arguments as
arguments = [("0 0 0 0 0 0 odom laser")])
- passing arguments as
parameters= ...
- running the command from error output (
/opt/ros/foxy/lib/tf2_ros/static_transform_publisher 0 0 0 0 0 0 odom laser --ros-args
) from the terminal -> that works just fine .
update - solved
arguments = ["0", "0", "0", "0", "0", "0", "odom", "laser"]
or
arguments = "0 0 0 0 0 0 odom laser".split(' ')
works just fine
Have you tried with:
there is a difference between a single large arg in
"
, and a nr of them.Yes, i did, among many, many other things. When the arguments are passed as a list the launch system seems to lump them all together is as a single argument:
...cmd '/opt/ros/foxy/lib/tf2_ros/static_transform_publisher 000000odomlaser --ros-args'].
It doesn't seem like you mentioned that in your question.
Please update your question with what you've tried.
Otherwise we'll just keep suggesting things you've already done ..