ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Why control at 1 kHz? [closed]

asked 2012-02-21 02:45:32 -0600

SL Remy gravatar image

updated 2012-02-23 07:34:35 -0600


Is there a reason for the 1 kHz control frequency discussed here in ROS-Users and again in the TRO paper Human-Inspired Robotic Grasp Control with Tactile Sensing

Is this a bound related to the selected (computer) architectures?

More specifically, if control was needed at 2, 3, or even 5 kHz, could this be done without a change in infrastructure?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by SL Remy
close date 2013-01-30 11:18:53

3 Answers

Sort by » oldest newest most voted

answered 2012-02-21 12:49:55 -0600

Kevin gravatar image

updated 2012-02-23 13:31:36 -0600

It has been a while, but this is basic controls. Your sampling rate dependent on the dynamics of the system you are controlling. The first reference you point to is ATRIS. It appears to walk, run, jump, etc over un-even terrain. You need to understand the required Nyquist sampling rate of whatever you are going to control and then it is a good idea to do better than that. So at a minimum the 1 kHz will allow you to control a system that has dynamics in the 500 Hz range. Now in some systems you have to also pay attention to 2nd and 3rd order dynamics to maintain stability. Since your reference is running, jumping, etc it wouldn't surprise me if you have to pay attention to that. There are also other factors (filtering noisy feedback) that can also drive up your sampling rate.

[Edit] To be honest I don't have need for such high rate real-time control, so I am really unfamiliar with what the limits are in those specific circumstances. If your application requires not only high control rates, but a guarantee you send a control signal you need to investigate a real-time operating system. I have not read your references in detail, but only skimmed them so they may have architecture limits. I assume the high rates are all with-in the node and not external to it. Once you leave a node you have to worry about TCP latency and me just pinging a rosout (e.g., rosnode ping /rosout) appears to take ~1 ms on my macbook. I suggest you test out ROS on the hardware you are interested in using.

Sorry if I am still not answering your question, but for what I do, I think this is the best I can answer. Good luck!

edit flag offensive delete link more


I like your answer, but because my question wasn't clear enough originally, it was not answered. I have not seen any mention of "reliable real-time control" at rates faster than 1 kHz, is this because we can't do so even if we wanted to?

SL Remy gravatar image SL Remy  ( 2012-02-23 07:42:48 -0600 )edit

answered 2012-02-26 09:03:07 -0600

mmwise gravatar image

In general this is a very open ended question. When you think about selecting how fast a control loop should run you must first consider how fast you are required to run for the desired behavior. Take the case of say a heating system for a single room, running at 1kHz doesn't make sense because the thermal response of a room only happens so quickly and a programmer would probably design the control loop to run at something between 1-50Hz. Now let's consider the PR2, the "real-time" loop on the PC of the PR2 aims to provide a current control to the motor controller boards at 1kHz however some controllers overrun the 1ms computation time, making the PR2 high level control semi real time. However in hardware, on the motor controller board, the current loop of the PR2 is controlled at strictly 1kHz.

In general you could always choose to run a control loop faster, especially in hardware like an embedded system. However the question is still does the system require/need to receive control updates or measurements that quickly and can you write efficient enough code that will not overrun the control loop cycle. There are many applications that require controllers to run at 5-10kHz these are typically implemented at the embedded level.

All of the above statements also reflect systems that are running soft-real time or hard-real time where the system time step is very close to or exactly the same every loop update. Running over wifi would not be even close to real time and would introduce all sorts of latency problems making the system near to uncontrollable. In general ROS is not designed for doing real time control, it is based on a TCP or UDP model and both do not care about transmitting data in a timely fashion and tend to introduce latency into the system. That is why it is prefer to use other protocols like EtherCAT to ensure low latency communication between nodes in a system.

Finally many people choose a rate of 1kHz because it's "fast enough" for the system they are trying to control, not because there was any specific calculation that lead them to that decision.

edit flag offensive delete link more

answered 2012-02-25 03:53:49 -0600

mkillpack gravatar image

I'm not sure if the Nyquist comment in the first answer applies to the kind of control you're talking about. Nyquist just says that you can reconstruct a signal if you are sampling at a rate that is twice the max frequency of interest. However, it says nothing about control bandwidth. From digital control theory, we know that the sampling rate will definitely affect your controller stability. However, actuator bandwidth as well as the dynamics in question will define what rate you'd have to control at and I don't think the answer can be clearly defined as a minimum of twice the frequency of interest. One thing that is similar is that as in reconstructing signals, the faster you can update your control the less instability will be introduced due to discrete sampling.

You also asked if you could run faster than 1 kHz and the answer is most definitely. Lots of low-level controllers run at up to 5 kHz or faster. If you are asking if that can be done reliably (hard real time) with ROS the answer is probably not unless you are using 3rd party libraries like orocos.

edit flag offensive delete link more

Question Tools



Asked: 2012-02-21 02:45:32 -0600

Seen: 1,972 times

Last updated: Feb 26 '12