Right sintax to call a service that receives a string as param

Hi everyone,
I would like to know what would be the right sintax to call service that receives a string as param, for example “Turn right”
I’ve tried with ros2 service call /my_srv custom_interfaces/srv/MyServiceMessage "{data: Turn right}" and with ros2 service call /my_custom_interfaces/srv/MyServiceMessage data:\ "Turn right" with no luck. I0ve always receive the meesage The passed service type is invalid

Thanks in advance.


I’ve struggled with this issue, too. Double quotes on the outside and single quotes inside worked for me.

Try the following syntax:
ros2 service call /my_srv custom_interfaces/srv/MyServiceMessage “data: ‘Turn right’”

Good luck!


Hi Iffernandez try this ```
ros2 service call /service_name package_name/ServiceName “{string_parameter: ‘string_value’}”


Thanks @zach-nobles and @alaurao!!
Both options worked for me!
Thanks again!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.