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

Revision history [back]

Hi, thanks for interest in ros2_control.

Let me first clarify how ros2_control's update loop is working:

  1. read() method of hardware is called to read current states from a hardware
  2. update() of all active controllers is called where based on states new commands are written
  3. write() method of hardware is called to write new commands to a hardware

The states and commands members are shared between hardware and controllers so that both have access to the same memory locations for reading/writing data.

Following that, yes, you will get each time when write is called a new command. (if controller received command, otherwise the same value will be written over and over again.

Return of return_type::ERROR is used for error management during read and write methods. This should ne be usually used, but only when "a real" error happens, like communication is broken or similar. The framework calls automatically on_error method when this return status happens.

Therefore, I would not suggest using your proposed solution.

You should add internal buffers into your hardware_interface, or even another thread to sync communication with your hardware.

I hope this helps you!