Professional Documents
Culture Documents
net/publication/328131120
CITATIONS READS
0 1,036
1 author:
Asad Abbas
Technische Universität Clausthal
3 PUBLICATIONS 0 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Asad Abbas on 07 October 2018.
Now a day's drones are getting way further from being treated as a
hobby for the general public use. They are getting more advanced,
reliable and equipped with advance cameras, sensors which give them
stability, well guided by remote and satellites, unmanned self control
operations, autopilot for the flights, sensing for weather conditions,
speed monitoring and control, distance travel, height and positions,
gesture control operations and many others. These features are leading
the drone technology to the autonomous capabilities and for
commercial use for various purposes. Drones are being used or planed
to used for the delivery, first aid's, firefighters, professional
photography, surveillance and others. The influence of drones to the
human life is growing and increasing the system complexity. Where
drones are need to make the decisions and process it fast at the real-
time for the precision and increasing their capabilities. In this report we
will discuss the drones and the Real Time Operating System (RTOS).
What is RTOS? Type of Drones, Do we really need RTOS in the drones?
what kind of RTOS used in drones? Types of RTOS and how does the
RTOS work with drone?
2. Types Of Drones
Drones are made with different types, depends upon the need and the
demand. In the most popular drones category multi rotor drones are
more in use by general public and perform well in the term of stability,
control and the reliability, but beside it also has the issue of short
flights, speed, maintenance and short battery life. Every other type of
drones need different software to control and having different
hardware. In the following table you will find the pros and cons of
drones and their preferred usage [7].
Single-Rotor > VTOL and hover flight > More dangerous Aerial LIDAR laser scanning
> Long endurance (with gas > Harder to fly, more
power) training needed
> Heavier payload > Expensive
capability
3. RTOS
Real time operating system (RTOS) are usually used for embedded
machines, industrial robots, scientific research equipments and others.
RTOS uses real time applications because it is used for a particular
purpose in a limited time span. It is fast and able to manage task in the
particular time limit. RTOS are used for multi tasking / multi threading.
RTOS kernel is accountable for memory management, message
interpreter, device or input output management, storage management.
RTOS interfaces with the firmware or application to receive input and
send output from the hardware. RTOS task scheduling is a priority
There are two types of real time operating systems, Soft RTOS and Hard
RTOS.
3.2.2 Messaging
3.2.4 Scheduling
4. Ardupilot
Ardupilot is famous in drone autopilot software and uses open source
GPL license. It supports any type of drone including fixed-wing,
helicopters and multi-rotors. It uses same telemetry protocol
(MAVLink). Ardupilot used control loop, which gets data from the
sensors and help it to run talks periodically in the cycle and send the
data to the drive rotors after processing. Ardupilot support different
hardware and operating systems for enhancing their capabilities and
improvements. It support OS NuttX for PX4Hawk flight controller and
4.1 MAVLink
Micro Air Vehicle Link (MAVLink) is a protocol which is used for ground
to vehicle communication with the small unmanned vehicles. It is used
for transmitting the speed orientation of the drone, and the GPS
Location.
5. NuttX
Every module run as a task with the list of their own file descriptor and
every task can start the number of threads for that list, and share the
same address space. Every thread/task represented by the data
structure called the task control block (TCB) and has a fixed-size stack
and all the stacks have been checked for enough free space depending
9 Real Time Operating Systems(RTOS) For Drones | Asad Abbas , TU Clausthal.
on stack colors by a single periodic task. Nonetheless, tasks and
pthreads are distinct by the programming models [6].
5.2 Features
Fully Preemptible
Highly configurable
FIFO and round-robin scheduling
Real-time, deterministic, with support for priority inheritance
Task management and watchdog timers
POSIX/ANSI-like task controls, named message queues, counting
semaphores, clocks/timers, signals, pthreads, environment
variables, file system.
Built-in, per-thread CPU load measurements
Custom NuttX C library
Symmetric Multi-Processing (SMP) and more.
POSIX is the standard defined by IEEE, which defines the API with the
utility interface and command line shells for the software compatibility
for Unix and other operating systems.
The core NuttX RTOS used on Pixhawk boards, NuttX provide the
interface between Micro Controller and the firmware. ArduPilot is the
firmware for the autonomous flight, NuttX provides the real time
operational functionalities and customized library for enhancing the
flight experience with the PX4 hardware while PX4 firmware is a base
PX4 middleware and drivers used on the Pixhawk boards.
Task control interfaces (TCI) are defines in the in 'task ' directory under
'sched' where all the standard and non-standard interfaces are define
[6].
5.4.1.1 task_create
#include <sched.h>
int task_create(char *name, int priority, int stack_size, main_t entry,
char * const argv[]);
Input Parameters:
priority. Priority of the task
entry. Entry point of a task
argv. A pointer to an array of input parameters.
name. Name of the task
stack_size. size of the stack needed (bytes)
The function create and activate a task with the specific priority and
return the system assigned ID. This function called once the C
environment has been setup. The "main" function of the task is
5.4.1.2 task_init
#include <sched.h>
int task_init(struct tcb_s *tcb, char *name, int priority, uint32_t *stack,
uint32_t stack_size, maint_t entry, char * const argv[]);
Input Parameters:
stack. Start of the pre-allocated stack
tcb. Address of the new task's TCB
stack_size. size of the pre-allocated stack (bytes)
entry. Entry point of a new task
argv. A pointer to an array of input parameters
name. Name of the new task
priority. Priority of the new task
5.4.1.3 task_activate
#include <sched.h>
int task_activate(struct tcb_s *tcb);
Input Parameters:
tcb. The TCB for the task for the task (task_init() argument).
5.4.1.4 task_delete
#include <sched.h>
int task_delete(pid_t pid);
Input Parameters:
pid. task ID of the task to delete.
This function only deletes tasks which are not running and de-allocate
the TCB and stack of the task, if the task is in running state it urge it to
exit() from the process. It can be fail if the pid does not respond to
currently executing task.
5.4.1.5 task_restart
#include <sched.h>
int task_restart(pid_t pid);
Input Parameters:
pid. The task ID of the task to restart.
This function restart the task and reinitialize it with the same initial
parameters given in that particular task. file descriptors are not closed,
allocated memory for the task is not set to be free. It can fail if the pid is
not valid or the task could not be restarted for some reason.
5.4.2.1 exit
#include <sched.h>
void exit(int code); // ANSI Interface
or
#include <nuttx/unistd.h>
void _exit(int code); // UNIX Interface
Input Parameters:
5.4.2.1 getpid
#include <unistd.h>
pid_t getpid(void);
Input Parameters: None.
The function return the calling task's ID. Task ID will be invalid in the
case if called at the interrupt level. It has no input parameters and but it
contains the task ID of the calling task as a return value. It is compatible
with the same name POSIX interface.
Scheduling with strict priority is maintain in NuttX. The tasks have the
CPU ingress if they contains maximum priority until they blocked. The
processor is available to the task of lower priority at that time. If the
tasks have the equal priority first in, first out (FIFO) method is used. In
NuttX sporadic scheduling or round-robin scheduling is possible with
threads or task, on choice. Unlike priority scheduling round-robin is
similar except the tasks share the CPU time via the time-slicing
technique, time-slice is constant and set positive numeric value in the
CONFIG_RR_INTERVAL.
The NuttX scheduler provide the POSIX compliant interface in the given
functions:
sched_setparam
sched_getparam
sched_setscheduler
sched_getscheduler
sched_yield
sched_get_priority_max
sched_get_priority_min
sched_get_rr_interval
Scheduling with strict priority is maintain in NuttX. The tasks have the
CPU ingress if they contains maximum priority until they blocked. The
processor is available to the task of lower priority at that time. If the
tasks have the equal priority first in, first out (FIFO) method is used. In
16 Real Time Operating Systems(RTOS) For Drones | Asad Abbas , TU Clausthal.
NuttX sporadic scheduling or round-robin scheduling is possible with
threads or task, on choice [6]. Unlike priority scheduling round-robin is
similar except the tasks share the CPU time via the time-slicing
technique, time-slice is constant and set positive numeric value in the
CONFIG_RR_INTERVAL.
The NuttX scheduler provide the POSIX compliant interface in the given
functions:
sched_setparam
sched_getparam
sched_setscheduler
sched_getscheduler
sched_yield
sched_get_priority_max
sched_get_priority_min
sched_get_rr_interval
mq_open
mq_close
mq_unlink
sem_init
sem_destroy
sem_open
sem_close
sem_unlink
sem_wait
sem_timedwait
sem_trywait
sem_post
sem_getvalue
sem_getprotocol
sem_setprotocol
ArduPilot is designed for the auto pilot capabilities while it requires the
OS to communicate and perform the real time tasks, NuttX is one of the
operating system which provide the real-time operations to the
ArduPilot and linking the hardware. It supports multiple threads
processing and perform the scheduling and interrupts for the firmware.
Drones can fly with the firmware itself because of the simultaneous
continuous improvements, hardware supports, and a firmware can
have a RTOS functionalities. On other hand, to enhance the firmware /
drone capabilities and external hardware support RTOS is useful to give
the performance.
[2] Jojo, General Purpose Operating System versus Real Time Operating
System for an Embedded System. June 12, 2012
[3] Mathew Kevin, What is Real Time Operating System (RTOS) - How it
works? July 10, 2017
[4] Gregory Nutt, NuttX Wiki, Release 7.24 / Mar 2, 2018. website:
www.nuttx.org