How to call a service from XML launch file?
Is there an equivalent to rosservice from ROS1 in ROS2? Much appreciated.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Is there an equivalent to rosservice from ROS1 in ROS2? Much appreciated.
For posterity, I found a solution using the executable tag. Let's say you wanted to spawn a second turtle in turtlesim, the below will accomplish this:
<executable
cmd="/spawn turtlesim/srv/Spawn '{x: 1.0, y: 1.0, theta: 0, name: 'custom_turtle'}'"
cwd="/home"
launch-prefix="ros2 service call"
output="screen"
>
</executable>
I don't know what 'cwd' is used for but it should remain as "/home" or else this particular command won't work. You can also combine the launch-prefix and cmd if so desired.
Asked: 2023-02-19 15:04:36 -0500
Seen: 142 times
Last updated: Feb 19 '23
ros2 custom world launch not launching
No message from ComposableNode when set use_sim_time
Callback not being called using Message Filters
Unable to install ROS2 Galactic after building OpenCV from source
ros2 subscriber to allow a single publisher
Cannot communicate 3 jetsons to Pub/Subs data
Colcon error with template typename T = real static T WGS84_a()