-
Notifications
You must be signed in to change notification settings - Fork 321
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
ros::Time() in ROS-control update() call causes timing inconsistencies. #54
Comments
That is a very good question. It is not immediately obvious to me how the "time" parameter is supposed to be set up. The ros_control docu only says "The current time", which we understood as "ROS system time", i.e. |
In my experience,
In other cases (such as the one described by @markusgft) it would be best to use The third situation is actually an interesting one, as if publications of ROS messages are stamped with the time "coming from the hardware" and the clocks are not in-sync, temporal correlation of messages coming from the What is often done in If
please note: there are multiple clock sources available when using |
@gavanderhoorn Thanks for your post! I hadn't considered use-cases such as message publishing. I suppose you could always call But, to summarize, would you recommend to keep the current behavior, i.e.: keep
Are you referring to things like |
Hi all, thanks a lot for your instant replies. Thanks @gavanderhoorn for highlighting some of the related issues. After all, the problems seem at least due to the fact that we have an unfortunate combination of multiple factors here. In a general ros- control context, I do see the point that a naive user should be able to use the ros::Time argument of the update loop for message time-stamping, etc. If I understand correctly, ros::Time is currently not at all linked to the panda robots system clock (since a non-deterministic UDP protocol is used for communicating with the robot). So you are, with good arguments, suggesting to stick to "ros::Duration period" instead. There is still one thing I would like to clarify:
|
In such a case, the |
@markusgft wrote:
That is a lot of packet loss tbh. The robots I work with -- and that have this type of motion interface -- wouldn't tolerate that. A single missed packet would mean a lost control cycle and the robot goes into an error mode (they do tolerate more missed packets if configured that way, but I generally don't use that). Franka Emika might have gone for a slightly less "picky/strict" policy of course. Is the ethernet segment between the PC and the controller used for other traffic? Is there a switch? With a real-time kernel (ie: RT PREEMPT or Xenomai) a 1kHz update loop should be trivial to run on a modern-ish PC.
I'm guessing this question was directed at @fwalch, but to something I've observed (and implemented myself): typical real-time external motion interfaces send time-stamped state data (in some form or other) and expect control signals to be returned in the same (or next) cycle. The timestamps are set by the controller using its internal clock. As long as I guess this is what @fwalch means when he writes:
If the
I've highlighted the two important assumptions here. Controllers that cannot reach 1 kHz update rates should not be used (and I would consider still using it a user error) and packet loss should either be absent or indeed very, very minimal. Note: I did not want to argue against the need for a solution to the potential problem you described in your OP. I merely wanted to add some observations and my experience with |
The biggest problem I'd have with calling And it's not just publications: synchronisation between different controllers could also be affected.
Thing is: I don't know what would be the best solution in your case. Perhaps some of the
Yes. |
I think this is the way to go: PickNikRobotics/ros_control_boilerplate#4 (comment) |
Yes, that is indeed an inconveniently high package loss rate that we experience on the Panda. I am used to working with RT-systems like Xenomai -- in prior work, I worked with an EtherCAT-empowered robot running at 1 kHz hard real-time, where only a few package losses occurred per hour. It is side-tracking the discussion about the original topic, but in any case it would certainly help a lot if @fwalch could give a short comment about the "average expected" package loss rate on the panda (operated with an preempt_rt-patch as described by the franka installation tutorial). |
I'm a little late to the party but my preferred solution is just that. We only have a few occasions where As a general rule of thumb: your closed loop In my experience with upstream controllers and also some closed-source, one has to be mindful about how time is passed to the update loop in the RobotHW implementation and how that relates to the rest of the system. Distributed setups make this a little harder, for those cases I'd rely less on timestamps. |
Thanks for all the comments. So, to sum up - the result is to leave everything as is. As far as I understand it, this is still a compromise - in an ideal case ros::Time would be synchronized with some kind of master-system clock, however this is not feasible for current Panda robot system design. @bmagyar I wonder if it would make sense to include a little comment somewhere in ROS-control to document your above reasoning? I could imagine that I'm not the only one who potentially gets the intended use of the ros::Time in the update call wrong? |
The franka panda hardware interface for ROS-control implements a method called FrankaHW::control() which triggers the user-defined ROS-control
update(ros::Time time, ros::Duration period)
call which must be implemented by valid ROS-controller.As can be seen here, the argument "period" is assigned the time-step, which is constantly 1 ms and therefore is perfectly valid.
However, the argument "time" gets assigned
ros::Time::now()
. The issue is, that Time::now() is not perfectly in sync with the franka hardware system time, as a user who calls a real-time control loop would expect. (One reason why this Time::now() is not in sync is for instance that the UDP-communication with the robot may experience delays, in which case ros::Time::now() may deviate significantly from the current panda system time).Would it make sense to assign a different value to "time", i.e. the system time value from the currently read robot state?
=====================================================
Side-track : one motivating example why this is of practical concern:
The text was updated successfully, but these errors were encountered: