Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Documentation on simulation time behavior of ros2_control #1985

Open
FranekStark opened this issue Jan 7, 2025 · 1 comment
Open

No Documentation on simulation time behavior of ros2_control #1985

FranekStark opened this issue Jan 7, 2025 · 1 comment

Comments

@FranekStark
Copy link

I am trying to figure out the behavior of ROS 2 Control running with a simulation, which does not run on real-time.
We want to use ROS 2 Control for a very complex system where (our custom) simulation might not be able to run in real-time.

I guess my question splits up into two directions, depending on how the simulation is 'connected' to ros2-control:

  1. The simulation is running within a HW component:
    I assume one way of integrating a simulation into ROS 2 Control is to run it within a HardwareComponent. Is that the case for example for the gz_ros2_control.
    My question would now be, where at best I run the "actual" simulation/integration (which blocks and might take longer than the controller period), in the read() or in the write() callback? I would say I would best run the simulation in the write() with the controller's period as the time to simulate. How would ROS 2 Control react to the blocking call and the difference in simulation and system time.

  2. The simulation is connected via topics like in [topic_based_ros2_control]:(https://github.com/PickNikRobotics/topic_based_ros2_control/tree/main)
    As in our case the simulation is computationally very heavy it makes sens to use this approach, as it allows the simulation to run on a different machine.
    Here, as in topic_based_ros2_control, during read() I would use the latest states received via subscriber and in write() I would asynchronously publish the commands.
    The simulation itself publishes the simulated time on the /clock topic. How it the behavior of ROS 2 Control, when it is launched with --use-sim-time. Is it following the /clock no matter what, or are there any things I have to note?

Unfortunately, I could not find any documentation on this important behaviors, and there are quite some issues/PR's on that matter (https://github.com/ros-controls/ros2_control/issues?q=simulation+clock).

Thanks for any help or advise. - After I have figured all of that out, I would be very happy to provide a best-practice or section for the documentation.

@christophfroehlich
Copy link
Contributor

Hi!
about gz_ros2_control: The read/udpate call is done here triggered by the physics engine update. There is no clock involved in the controller_manager then, it just depends on the arguments of the CM calls. (no ros2_control_node involved)

For the second point, the ros2_control_node should handle this now
#859
#1810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants