Skip to content

Synchronize Control Loop to Robot #2529

@AndreasKuhner

Description

@AndreasKuhner

Hello all,
I am from the Franka Robotics Team and we offer with libfranka a way to have a very low level control. Of course, this comes with some major limitations: E.g. the user needs to send a response before the robot starts its next computation cycle. Typically, the robot does compute - sleep - compute. While the robot is sleeping, the libfranka user has time to receive the current robot state and send back the next control command. Overall within a 1khz fashion.

With Humble (compared to ROS 1), a 'standalone' control loop was introduced which was running independent from our internal robot loop. In ROS 1, the control was still timing-wise aligned with our internal loop, with Humble not anymore. Yet, it still worked most of the time good enough.
With Jazzy, a new timing behavior was introduced: Instead of having (like Humble)
take current time -> next_iteration_time = current + period -> process -> sleep until next_iteration_time
it is now
take current time -> process -> check for delay -> next_iteration_time = current + period + delay -> sleep until next_iteration_time
What does it mean? The loop can start e.g. at 1 then 2 then 3.1 then 4.1 then 5.3 then ... aka it can drift. With humble it was just 1, 2, 3, 4, 5, ....
The new behavior now causes that the loop of ROS 2 and our robot control loop drift apart - leading eventually to a 'communication_constraint_violation' because the new commands of the user don't arrive in time anymore (aka they arrive not anymore during the sleep but compute time).

Describe the solution you'd like
The perfect solution would be if all of the 'sleep until' behavior is neglected and is just part of the read of the hardware. E.g. our read blocks until a new robot state arrives - naturally aligning the user control loop with our internal one. Of course, the read already blocks but with ROS 2 it is block + sleep until instead of just block.

Describe alternatives you've considered
An alternative is to make the new loop/sleep until logic configurable (aka allowing to choose between old and new humble behavior).

Another option I shortly looked into was to use the use_sim_time... But it would just be a workaround and not nicely integratable with other hardware.

A lot of people ask us to finally offer a Jazzy integration of our FR3 robot. But this behavior proofs now to be some major blocker.

Btw. I also tried to use the is_async for hardware_interfaces. It decouples the control loop from the hardware_interface. However, it also decouples the 'fixed' control cycle between robot and user causing quickly some discontinuities because some commands are send double/not at all/too late and out of sync (I mean.. it is async 😅 )

Cheers to all,
Andreas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions