jrl-umi3218 / mc_rtc

mc_rtc is an interface for simulated and real robotic systems suitable for real-time control
BSD 2-Clause "Simplified" License
122 stars 36 forks source link

Inquiry about Variable Timestep #427

Closed Saeed-Mansouri closed 10 months ago

Saeed-Mansouri commented 10 months ago

Hello mc_rtc team,

I'm currently working with the mc_rtc_ros and have a question regarding the controller's timestep. In my application, the sensor data exhibits significant jitter, and I'm considering running the controller synchronously with the sensor data reception. This requires the timestep of the controller to be variable to accommodate the irregular intervals of sensor data arrival.

Could you please advise if it's possible to implement a variable timestep for the controller within mc_rtc_ros? This feature would be crucial for handling the high jitter in the sensor data effectively.

Looking forward to your guidance and suggestions.

Thank you!

gergondet commented 10 months ago

Hello @Saeed-Mansouri

It's currently not possible to use a variable timestep within mc_rtc.

Note that I'm not sure it's an actual solution to the problem you are facing. You can measure how much time has passed since the last time you received sensor data but you cannot predict how much time will pass before you receive new sensor data which is the timestep you would want to use.

We faced a somewhat similar issue in https://github.com/jrl-umi3218/mc_franka when controlling multiple Panda robots from the same controller. This poses two problems:

The solution we employ here is to have multiple threads:

Note that this is not ideal, e.g. if you rely on numerical differentiation of these signals they are likely to be quite noisy, but it works well enough for many applications in practice.