Control Techniques for Robot Manipulators

Robot Operating System (ROS) - Command Line Tools

Sampling-based Motion Planners

Motion Planning in Robotics

Visual SLAM - An Introduction

Coverage Problem in Mobile Robotics


Robotics is an interdisciplinary domain and seamless hardware-software interaction within the different components is important for good performance. While electronics, sensing, actuation and other low-level embedded systems are computationally very efficient to satisfy timing requirements; the high-level algorithms and decision making is computationally expensive. The high-level software manages communication, data aggregation, iterative solutions, matrix operations and a lot of mathematical computations. Thus, execution of commands at desired speed becomes critical towards following desired performance and control on the robot.

Real-time operating systems execute commands at determined timestamps and computation is completed at the desired timings. RTOSs ensure maintaining synchronization between the high-level software and the low-level software and the hardware thereafter. Hence, such systems are used in robotics to serve as standard high-performance and reliable data processing platform.

Robots generally run on time critical constraints and thus need deterministic and timely execution of software. Failure to do so results in inconsistent and unpredictable robot behavior. Numerous robots across the globe use linux and while it is not inherently realtime, real-time patches over the native linux kernel allow operating systems to execute smooth hardware interaction with umpteen drivers and realtime behavior of the software.


There are several misconceptions about realtime operating system, an OS which is fast or has high performance traits. However, real-time operating systems are those systems that can process and execute data in defined time and be deterministic in nature. It is not fast execution but execution at defined execution speed, consistently.. RTOS may or may not be able to consistently complete the task within given time due to the varying amount of computation to be done. Ocassionally, it may fail to obey time limits and result in variability called jitter. While hard real-time systems have more stringent tolerance on the jitter, soft real-time systems can act deterministically but have larger jitter.

RTOS guarantee execution as per the specified time and failure to do so may lead to failure of the system. Safety critical systems like aerospace, rocket science, online payment portals are all required to perform deterministically and use RTOS for the same.

There are several practices deployed to ensure realtime performance of kernels and OSs.


Linux is an open-source monolithic kernel that supports running a family of UNIX-like operating-systems. The most commonly used operating systems are Ubuntu, Fedora and Mint among others. The linux family of operating systems are largely deployed on servers and several cross-platform hardware architectures.

Linux is the most sought after robotics platform due to features like cross-platform support, open source, software-hardware configurability, interoperability with other OSs, huge driver support for hardware interaction and most of all, the most conducive programming development environment. Linux is deployed across different architectures from x86 to ARM and from microprocessors to SoCs.

As mentioned, the linux kernel is not real-time and has an average maximum latency of 104 microseconds. There are two main approaches to development of realtime behavior on linux. The dual kernel approach uses a microkernel, a secondary kernel sitting between the linux kernel and the hardware and manages the software-hardware interaction trying to maintain realtime performance. RTLinux, Xenomai and RTAI are such realtime microkernel patches which were used extensively and are still around in several legacy systems. Dual kernel approaches are sophisticated and the complexities around special tools, libraries, APIs, poor scalability and hardware layer customization for different versions make it not so user/development friendly.

Dual Kernel Real Time Linux Implementations

The other category is the in-kernel approach that modifies various aspects of interrupts, priority inheritance, preemption and determinism to enforce realtime behavior on the kernel. PREEMPT_RT is an in-kernel patch that makes the linux kernel behave like a realtime system. PREEMPT_RT has several patches actively maintained, supported by a huge community and deployed very effectively. PREEMPT_RT runs interrupt handlers in kernel thread while supporting priorities for them as well. It also replaces spinlocks with realtime mutexes to handle data better. Both of these features make it fully preemptible and thus effectively realtime.

RTOSs follow the priority stack such that tasks demanding CPU usage are provided with the resources within a predetermined delay time (obeyed consistently) depending upon the ranking in the stack. At this step, only tasks with similar priorities are competing to acquire the resources and all other non-realtime tasks are dynamically de-prioritized. The PREEMPT_RT patch makes the native linux kernel completely preemptible (preemption means allocating resources to a particular task for a finite amount of time to enforce deterministic behavior and then, switch context/resources to the next queued/priority-based task) and thus memory management, mutex locking, interrupt handling, task-scheduling and all other non-deterministic behavior invoking components are managed deterministically thereby obtaining realtime behavior. Better usability, integration with prime feature integration with mainline linux and comparable/slightly slower performance against sophisticated dual-kernel systems makes PREEMPT_RT the best realtime tool for linux.

C or C++ are the most common languages for realtime applications due to their highly efficient nearest to machine language implementation. The kernel manages the interaction of the software with the multiple hardware drivers and protocols. Thus, the programming rules remain the same regardless of a realtime/non-realtime environment but the latter obviously has better, predictable and reliable performance.


Robotics applications generally involve a plethora of software packages and programs running, either synchronously or asynchronously. Navigation, perception and planning are few of the most most computationally expensive algorithms. There are several instances of hardware triggered instant responses from the software, the interrupts. Also, there are numerous multi-threading and parallel computing techniques as well.

The significance of real-time operating systems in robotics to ensure that interrupt servicing and thread switching operations are seamless and instantaneous. Low latency and consistent low/no jitter computations help maintain efficient closed-loop control systems, obey event-based response and ensures reliability. Deterministic behavior of realtime operating systems enforce stable robot motion, perception and planning.

Mobile and manipulators robots involve intensive mathematics, arithmetic calculations, algebra, matrix operations and calculus as well. All such operations involve exhaustive computations and only realtime OSs can guarantee reliable behavior of the robot. Advaned operations like jacobians, inverse kinematics and PID control are detrimental to closed-loop operation. Fault systems, event-based operations and safety critical tasks all need realtime OS to avoid failure.

All domains of robotics are generally computationally expensive

Several versions of the PREEMPT_RT kernel are deployed to obtain realtime OS behavior ideal for robotics platform. The robot operating system(ROS) is one of the most widely used robotics middleware platform. However, for non-deterministic non-realtime behavior; ROS has not been the best suitable for industrial and critical applications. The usage of TCP/IP protocol, subscriber-publisher methodology add to the non-deterministic nature of ROS. This lead to the development of ROS 2.0 using the DDS technology for real-time systems thereby making ROS suitable for reliable robotics applications.

Comparison between ROS 1 and ROS 2 architectures

Eventually, realtime OS behavior is incumbent to obtain desired behavior on any robotics platform. Almost all high-level robotics software run realtime linux and work as the best deployment as well as development environment.


Copyright @Akshay Kumar | Last Updated on 05/25/2019