ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Request-response service best practice?

asked 2018-12-07 19:55:58 -0500

updated 2018-12-10 11:42:33 -0500

Background

  • New to ROS 1/2. Working with ROS2. Playing with Python.
  • ROS2 is installed on PC and also cross-compiled and installed on embedded system.

    • PC: Kubuntu 16.04, just followed ROS2 instructions - got Ardent, also installed colcon
    • The embedded system is Elphel 393 camera system Xilinx Zynq (32bit ARM) based with GigE network. Yocto + meta-ros got ros2 recipes built fine.
  • Demos AddTwoInts and Talker-Listener work fine in pc-camera, camera-pc

  • There's a lighttpd webserver that is running on the camera and the parameters are normally changed with http requests like:

    wget http://ip/somescript.php?p1=v1&p2=v2
    

    The response is an xml status string with updated pars values:

    <pars>
      <p1>v1</p1>
      <p2>v2</p2>
    </pars>
    
  • More Info (unrelated)

Question

Now I would like to implement a similar behavior (i.e. use a single service to send commands and get status replies as bools or preferably strings) in ROS2 - with a service. But after having a brief look into several repos (ros2_intel_realsense, axis_camera and inertial_sense_ros) - they don’t seem to use services and *.srv files a lot.

What did I miss? Is it implemented via parameters? What's the best practice?

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-12-10 13:26:49 -0500

tfoote gravatar image

To set parameters on a ROS2 node I would recommend using the parameter API. In ROS2 you have the ability to validate parameters before they are set and give responses about whether they were successfully set. There's also a topic which streams any changes in parameters if you want to monitor for changes.

If you're familiar with the ROS1 concepts the core parameters API now haves most of the features of dynamic_reconfigure built in.

The overall design can be read about here

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-12-07 19:55:58 -0500

Seen: 197 times

Last updated: Dec 10 '18