Service for robot description?

I was discussing this topic with a colleague and am interested in some other opinions. He was proposing using the GetParameter service to get the robot description from the robot_state_publisher node. I was suggesting we subscribe to /robot_description. We are working in a single-robot environment.

What do you prefer and why?

The way I see it, writing the service call makes the code using the robot description clearer, as you see it’s only received once, and waiting for the response is clear. In contrast, the topic subscribing code looks like you might be receiving it periodically.

On the other hand, you how have to specify the node and parameter name, so if for some reason RSP isn’t there or doesn’t have the robot_description param, and instead some other node is publishing it, it won’t work. But to be honest I’ve never had this be the case in any ros2 systems I’ve worked with.

Maybe it would be the best of both worlds if the robot_state_publisher had a /get_robot_description service? Or maybe rclpy needs some built-in helpers for making getting the robot description, or in general latched topics, cleaner? Or maybe these things already exist and I am unaware :eyes:

Looking forward to hearing from others on this topic!

The whole thing with /robot_description becoming a topic was to solve cases when the robot model can actually change during runtime (e.g. a gripper attaching to an object, or an interactive calibration workflow where you actually change fixed frames or disable/enable parts of the robot).

If you robot has only a static description, then this is a bit overkill, but in general, I think it’s worth it.

Subscribing to the topic is the thing that most tools do (rviz etc) so I’d suggest you to do the same. You just could unsubscribe after receiving the first message to be sure you don’t receive more (or you could stay subscribed and print an error message that you don’t support live updates of the model; or you could restart your node in reaction to this event).

5 Likes