0
$\begingroup$

Rosanswers logo

Is there an equivalent to rosservice from ROS1 in ROS2? Much appreciated.


Originally posted by ROS_Engineer on ROS Answers with karma: 16 on 2023-02-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by ROS_Engineer with karma: 16 on 2023-02-20

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.