What is the correct RTOS for a humanoid robot?

We students are developing a medium-sized humanoid robot (~ 4.5 feet) as a sponsored college research project. The main tasks that the robot must perform include: moving (forward, backward, sideways), launching, collecting objects. We are considering using a robust real-time operating system to control the robot. However, since we are not familiar with this field, which has virtually no basic data in embedded systems or operating systems, and there is a wide range of options available, we are not sure which one would be the appropriate choice. We came across the following (in parentheses is our current impression of them):

  • RTLinux (now dead, kernel 2.4.x, gcc 2.95 (so hard to build), with little documentation)
  • FreeRTOS (good community and documentation, popular, ported to many architectures)
  • uc-OS II (small, clean core, lightweight)
  • RTAI (Linux based)

I have a number of questions:

  • Which option is best for this project? I know this sounds a bit subjective, but any advice would be greatly appreciated. If you feel that some important information is missing, please indicate this.
  • I came across something called the CONFIG_PREEMPT_RT patch for the Linux kernel, which provides hard real-time capabilities for the kernel. There are also precompiled kernels with this patch available for Debian based distributions. Is this enough for our requirements?
  • We have very little knowledge about operating systems in general. Do we need to know about them first? If so, what good, short primer for the topic?

UPDATE: Thank you for your incredibly detailed answers. It is clear that we are doing it wrong; diving without knowledge and calibration requirements would certainly be bad. We will have to sit down and do what we need. When and when we will be forward enough, we will try to find a suitable OS. Let's see how it works out. I will also read Chapter 2 of MicroC OS II: The Real-Time Kernel .

+8
robotics real-time rtos freertos
source share
3 answers

Your choice of OS is not very suitable for determining the limitations of a "humanoid robot", there is no specific "humanoid robot", and, of course, no OS will be determined by how high such a robot is! ;-)! Critical factors:

  • real-time restrictions (for controlling the movement of the PID update, response time of the sensor / actuator, etc.)
  • processor architecture
  • system architecture (e.g. distributed processing , multisymmetric processing )

Other factors may be important, for example:

  • Communication and I / O requirements (e.g. Ethernet, TCP / IP, USB, WiFi).
  • File system support.

although in all cases they are not necessarily an integral part of the OS, since in many cases platform-independent libraries are available, but where you need them, integration with the OS can be useful, since it allows you to avoid thread safety and blocking resources.

None of the proposed options are likely to be on my list.

Any Linux server will require an MMU (unless you use uCLinux or its derivatives, but MMU support is one of the few good reasons for using Linux in an embedded system). Linux is not designed to work in real time, and any real-time support it has is largely conceived and rarely will be as deterministic as real RTOS. Any Linux will also require significant memory resources just to boot, expect at least 4 MB of RAM for something useful, while RTOS kernels such as FreeRTOS and uC / OS-II only require about 4 KB - here you compare the chalk and cheese. However, they do not have the utility of a Linux-based OS such as file systems or network support (although they can be added as stand-alone libraries).

If you intend to perform motion control and sensor / actuator control functions on the same processor as your cognitive functions, then you definitely need deterministic RTOS. If, however, the platform is a distributed system with separate processors that use motion control and other input / output sensors / actuators in real time, then you can leave with a simple RTOS kernel or not have an OS in the input / output processors (which can also be smaller, less powerful processors) and GPOS in cognitive (decision making and planning).

I recently rated FreeRTOS, it is minimalistic, simple and small, providing only the basic mechanisms of flows, time and IPC and a little more. It works, but there are so many other more attractive options, both commercial and non-commercial. I compared it with the Keil RTX kernel ( included in the MDK-ARM toolkit) and the commercial Segger embOS . It has a significantly slower context switching time than the other two candidates (although they are still in microseconds at 72 MHz Cortex-M3 and faster than anything you are likely to achieve with Linux).

uC / OS-II is well designed and documented (in a book by Jean Labros), and is great if you are aiming to see how RTOS works. His biggest failure is a very strict priority planning scheme that is effective for very small goals, but maybe not as flexible as you like. Each thread must be assigned a separate priority level, so it does not support cyclic scheduling, which is useful for background tasks that are not related to real time. uC / OS-III corrects this shortcoming, but again makes many other options.

If your target processor has an MMU, I highly recommend using an OS that supports it so that every thread or process is protected from any other, the system will be much more reliable and easier to debug, especially when designed as a team. In such an OS, an erroneous task that would otherwise stomp on some other thread resources with non-deterministic and it is usually difficult to debug the results will instead throw an exception and stop right where the error occurred, and not, perhaps, sometime later, when corrupted data b.

You probably do not need to limit yourself to a free or open source OS; many vendors allow free use for training and evaluation. I highly recommend you consider QNX Neutrino , it's free for non-commercial and academic use , and has the most reliable internal MMU support available in any real-time OS and all the development tools you need, including the Eclipse-based Momentics, included. This is more than just a planning core, including support for all the services you expect from a full OS. It works on ARM, x86, SH-4 PowerPC, and MIPS architectures. Working on x86 is especially useful, as it means that you can test and evaluate it and even develop most of your code in a VM running on your desktop .

Another alternative that is truly tough in real time, supported by OS services, in addition to simple scheduling and IPC, is eCos . It has its own, POSIX and uITRON API, standard drivers for CAN, ADC, SPI, I2C, FLASH, PCI, Serial, Filesystems, USB and PCI, etc. And includes support for TCP / IP networks. In this sense, it is a complete OS, but unlike Linux it is not monolithic; it is scalable and statically linked to your application code, so features that you don’t use are simply not included in the runtime binary. It works on ARM, CalmRISC, Cortex-M, FR-V, FR30, H8, IA32, 68K / ColdFire, Matsushita AM3x, MIPS, NEC V8xx, PowerPC, SPARC and SuperH. Again, theoretically, you can run the IA32 (x86) port on a PC virtual machine for testing and developing high-level code, although you will have to make it work, not like QNX, out of the box.

Added:

We know very little about operating systems in general. Do we need to know about them first? If so, what good, short primer for the topic?

This may not be the time to start exploring Linux (although it has the benefits of a wide acquaintance and community support, it will not need much, and many available support resources will not be familiar with real-time applications.

Chapter 2 of the Labrosse uC / OS-II book provides an overview of RTOS concepts such as scheduling, synchronization, and IPC that apply to most RTOS, not just uC / OS-II. Similar material is presented in a recent RTOS Fundamentals course at EETimes (it looks like it is sponsored by Mircium and uses uC / OS-II as an example, but for the most part it is common).

My decision to quickly start on any issue is Google with the topic “101” after it (general introductory course in academia). "RTOS 101" will provide you with several starting points, admittedly of varying quality - check the source’s reputation, if this is a company, they can be selling a specific product, if it is an amateur, they may have some understanding, but perhaps a narrow idea (often related to a particular favorite equipment) and may not have the rigor of a scientific article.

Added in relation to CONFIG_PREMPT_RT:

It does not provide Linux with a hard real-time OS. It may be suitable for some applications. If you are controlling the movement of the PID controller (instead of using a dedicated controller or a separate processor) or any closed loop feedback control, this patch will not enable it, at least not reliably. I found this: Comparing Linux approaches in real time . It discusses a number of approaches to using Linux in real-time applications, including CONFIG_PREMPT_RT. He discusses them in detail in part C.

+21
source share

This does not answer a specific question, but:
Before you seek advice on a specific OS, you need much more information about the architecture and limitations.

I would start with I / O:

  • How do you interact with the outside world? How many sensors?
  • What engines control the robot? How many? How are they managed?
  • What sensors are needed for feedback on engine management?
  • What about body feedback?
  • Have you analyzed any system analysis?
    • What update level is needed to maintain stability?
  • What other tasks need to be completed?
    • Vision?
    • Audio recognition
    • Sound generation?

Now that you know what you need to control and how fast, how do you control it?

  • Do you use a microcontroller with built-in A / D functions?
  • Or a PC with a paid A / D card?
  • Is one processor fast enough or do you need multiples
    • If several, how will they be synchronized?

At this point, you can start looking at specific processors and architectures. Only after you have narrowed it down to one or two good options, you should begin to consider the OS.

I expect you will need a tough real-time OS for the motion control aspects of a working robot.

+6
source share

It may not be necessary to run Linux in real time. Given that a 4.5-foot humanoid with CM, say 3 feet, your control loop can operate at 20 Hz, and you can still digest IMU signals and prevent them from falling. Regular embedded Linux, which does not control the Counterstrike game server in parallel with the control of robot engines, will give you reliable event processing at least 50 Hz even without a “pleasant” robot control process. (assuming you run your Linux on RoBoard or FitPC). In any case, it may be easier to recover from a missing frame than starting RT linux. Getting the kernel to work so that it reliably calls your handlers when it is interrupted for X microseconds (i.e., in real time) includes what some would consider non-trivial and with some side effects.

You might be better off having another microprocessor board that does some low-level conversations with motors / servos and transfers overloaded information to Linux.

In our project ActuatedCharacter.com, we were able to get a control cycle between RoBoard.com Linux and 20 (dynamixel) servers (with custom firmware) at a frequency of more than 200 Hz with FTDI interface for servomotors and without a kernel in real time modifications. If you are considering using dynamixel servomotors as actuators, please see the robosavvy.com forums for general information on creating humanoid robots (for robocup or for general research), alternative firmware to improve closed loop control speed, delay problems FTDI, Servo-Driven Servo Drives, Also consider the software structure you want to develop, which in turn will help you with your requirements. Obviously, talking to established Robocup League humanoid groups, but inriaflowers, NAO / Aldebaran and, of course, ROS are also interesting.

+6
source share

All Articles