Ask Your Question
0

[ROS2 Foxy] loading static transform broadcaster arguments from config file

asked 2021-09-24 03:01:08 -0500

morten gravatar image

In one of my launch files I have a number of tf2 static transform publisher calls like

base_link_2_radar = Node(
        package="tf2_ros",
        executable="static_transform_publisher",
        name="base_link_2_radar",
        arguments=["0.89", "0", "0.97", "0", "0", "0", "base_link", "radar"],
        # output="screen",
    )

which serve to setup the sensor frame transform tree. Personally, I think it is a bit sloppy to have so much hard coding in the launch file itself. I know one can use config.YAML files for storing parameter values, can something similar be done here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-24 03:13:27 -0500

tfoote gravatar image

Putting this into a yaml file vs embedding it in the launch file doesn't make much difference. They can both be parameterized etc. But i think that your instinct is right, it's not really the right place to be.

The cleanest solution I can suggest is to put the links into your URDF such that it will be published through the same process as all the other links/joints. You can use a xacro macro to parameterize the links there if you want or just to turn the radar mount on and off. But really the mount point is part of the robot description and if added there will be published by the robot_state_publisher automatically not requiring a standalone invocation like this.

edit flag offensive delete link more

Comments

At the moment we don't have/use a URDF. As I am only working with perception relevant things its not something I've gotten around to.

Regardless, if I have to parametrize these things I'd at least like it to be roughly centralized, e.g. in a yaml with other parameters. Is this possible for these arguments?

Or would you recommend I just make the URDF?

Edit: there;'s 6 of these in total for each of the different sensors, I just listed the one here as they are all of the same general form.

morten gravatar image morten  ( 2021-09-24 03:18:47 -0500 )edit

That sounds like the perfect case for a URDF, you'll be describing the 6 links and their relationship to the base link. Nicely centralized in the robot description which also has several tools setup to provide many of the arrangements around it. If you want to parameterize the URDF you should also look at xacro.

tfoote gravatar image tfoote  ( 2021-09-24 03:24:24 -0500 )edit

Sorry if this is a dumb questions, I'm not so experienced with URDF.

Can I make a URDF file that only describes the relationships between the various frames, like without considering the physical appearance or the physics of different segments? Like purely as a replacement for the static_transform_publisher lines and nothing more.

morten gravatar image morten  ( 2021-09-24 04:05:18 -0500 )edit
1

Update: went ahead and did it with fixed links, works great, cheers.

morten gravatar image morten  ( 2021-09-24 05:01:16 -0500 )edit

Yeah, you don't have to add meshes or body descriptions for each link.

tfoote gravatar image tfoote  ( 2021-09-27 17:17:57 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-09-24 03:01:08 -0500

Seen: 94 times

Last updated: Sep 24 '21