Software for Robotics

Avatar photo

There are multiple levels of software control that need to take place within all but the simplest robots. The microcontroller units (MCUs) and system-on-chip (SoC) solutions responsible for managing sensors and actuators will generally take advantage of a real-time operating system (RTOS) or kernel.

Maximising System Resources with RTOS Multitasking

The advantage of using an RTOS is support for multi-tasking. It provides a relatively simple way to schedule numerous activities on a single microprocessor in a way that maximises resources and the ability of the system to react to external events. For example, opening the safety cage needs to trigger a suspension of activities in a way that minimises risk to robots and personnel. Simply removing power is potentially unsafe. An RTOS can trigger all the actions needed to place the robot in a non-moving state but ensure that it does not drop heavy objects or cause damage to anything else. This can be achieved, for example, by moving to a software thread that orders the power electronics circuits to hold motors in predefined positions.

In combination with appropriately designed applications software, an RTOS can provide hard guarantees of the amount of time it takes to react to critical events, which are normally signalled by an external interrupt to the microprocessor. This is normally handled through an interrupt handler which may initiate a software thread that can take action. Through priority-based pre-emptive scheduling, the RTOS guarantees the shortest possible latency for this type of response to the most important issues.

ROS: The Robot Operating System

In a robot with multiple microprocessors and hardware accelerators, which is increasingly the case, each of the actuator nodes needs to be controlled by a supervisory system that takes care of task planning and high-level behaviour. This is a role that is typically undertaken by middleware such as the Robot Operating System (ROS) running on a high-performance microprocessor.

Today, an ROS is designed to run on an operating system such as Linux rather than being an operating system in its own right. ROS also does not demand RTOS behaviour from the underlying operating system as it is performing longer-term tasks than those that need microsecond response times. However, work is underway to build ROS 2.0 implementations that will run on RTOS platforms so that they can offer higher degrees of responsiveness.
The middleware that makes up ROS provides a variety of services. They include hardware abstraction of low-level devices, and support for messages passing between processes to enable multi-processor architectures and the management of software packages. Typically, processes are represented using graphs that link nodes to denote where processing takes place and how the processes communicate with each other. ROS implementations are often open-source packages and make use of Linux platforms to ease the job of managing dependencies between open-source projects. This has the benefit of making ROS software easy to access.

In ROS, nodes are processes or software modules that handle one or more related tasks. For example, a camera and image processing node may process visual data from one or more image sensors. To enable the use of networking infrastructure to interconnect nodes – an architecture now common in automotive systems – ROS supports TCP/IP and UDP for message passing. The various nodes and connections can be described using the Universal Robot Description Format (URDF), which is an XML file format.

To enable efficient sharing of sensor data and commands, ROS employs a publish-subscribe mechanism in which nodes register to be informed of specific topics. Any updates on each topic are sent to all of the subscribed nodes. The ROS Master keeps track of all services and topics. It handles node registration and operates a parameter server to allow nodes to store and retrieve common configuration data.

A major advantage of middleware such as ROS is code reuse and sharing. Code sharing allows all users to have a common base of software, which helps with testing and overall software reliability. ROS is not restricted to physical robots.
It also supports simulated robots.

The Role of Simulation in Robotics Development

A key requirement of robot design is the ability to simulate its behaviour in the virtual environment before implementation in hardware. The simulator allows for robotics programs to be written and debugged offline. It allows the development of software in a risk-free environment and avoids the problem of damaging the robot or the robot’s surrounding environment if the proposed program contains serious errors. The final version of the program can then be tested on an actual robot.

There are further advantages of simulation. Designers can develop in phases, starting with simple high-level models, which is beneficial for complex projects. Such simulations can be used at an early state to establish whether a system is viable. The simulation environments developed for robotics are designed to be compatible with a wide range of programming languages, which supports easy development. And simulation can cut development time as it allows mistakes in application logic to be corrected before they are committed to hardware and so become much more difficult to fix.

There are a number of approaches to robot simulation. Traditionally, simulation was focused on the kinematics of robot movement to demonstrate whether paths and trajectories are feasible and practical.

This type of simulation puts a virtual robot into a 3D space and demonstrates how joints are likely to move in the physical world. The simulation can also help determine whether a robot will be able to lift and manipulate heavy or bulky objects without losing stability.

Some kinematic simulators use a simplified set of calculations and focus primarily on how a program may rotate and move objects to ensure they do not collide with the boundaries of a safety cage or work-cell. Others involve more complex physics simulation to gauge the stresses and other issues that can affect robot performance in the field.

Simulating Robot Interactions in Dynamic Environments

As robots move out of controlled environments protected by safety cages and into areas where people and other robots can move around freely, designers need to take account of possible interactions. For mobile robotics design, simulators that deal with behaviour let designers create, at a high level of abstraction, virtual worlds that contain other objects. A simple behaviour simulation just takes into account the motion of a robot among a set of fixed objects. More complex simulations involve the use of multiple mobile agents or avatars. These behaviour-based simulators help with the design of applications where the robot is likely to be faced with complex environments. They can learn from collisions and other interactions to better deal with obstacles. Physics simulations are important for establishing that the kinematics of the robot are accurately represented.

Selecting the Right Physics Engine for Your Robot

Simulation environments such as the open-source Gazebo package can generate realistic sensor data that may be corrupted with varying levels of noise. Gazebo makes it possible to tune simulation to the specific requirements of the application – for example by using different physics engines. A maximal coordinate solver such as ODE or Bullet is often chosen when simulating cluttered environments. A Featherstone-based solver like DART or Simbody will find more applications in articulated systems such as humanoid robots or complex manufacturing robots. All of the physics engines are accessed through the same applications programming interface (API).

There are, however, limits to simulation. An application can only simulate characteristics and events for which it is programmed. Internal or external factors are not represented and will not be simulated, which can lead to problems when the design is translated to hardware. It also is often difficult to build sufficiently representative scenarios, especially when it comes to evaluating complex situations and behaviours. However, experience with translating simulated designs into the physical environment can be fed back into future projects, which will reduce errors as time goes on.

As a result, simulation remains one of the most powerful tools in the armoury of the robot engineer.

Total
0
Shares
Previous Post

The Ultimate Guide to Ghost Hunting with Thermal Cameras

Next Post

10 Engineering Innovations Powering a More Sustainable Future

Related Posts