Page 1
Introduction RT-MaG ToolBox Overview Examples Conclusion
RT-MaG: an open-source SIMULINKToolbox for Linux-Based Real-Time Robotic
Applications
Manecy Augustin1,2 Marchand Nicolas2
Viollet Stéphane1
1Biorobotic Department, Aix-Marseille Université/CNRS, Marseille, France2Control Systems Department, CNRS-University of Grenoble, France
IEEE Conference on Robotics and Biomimetics (ROBIO),5-10 December 2014, Bali, Indonesia
1/15
Page 2
Introduction RT-MaG ToolBox Overview Examples Conclusion
Outline
1 IntroductionWhat do a classical robotic application need?
2 RT-MaG ToolBox OverviewRequirementsAppearance & interfaceArchitecture
3 ExamplesGeneral useAerial robotics
4 ConclusionFunctionalityFuture work
2/15
Page 3
Introduction RT-MaG ToolBox Overview Examples Conclusion
What do a classical robotic application need?
Classical architecture
Objectives:
Simplify access to I/Os,A unique simulation and programming environment,3/15
Page 4
Introduction RT-MaG ToolBox Overview Examples Conclusion
What do a classical robotic application need?
Real-Time requirements and Task priorities
Hierarchical tasks’ priorities,Preemption mechanism,Accurate timing,
4/15
Page 5
Introduction RT-MaG ToolBox Overview Examples Conclusion
Requirements
Requirement and installation
HOST:MATLAB/Simulink >2011b + Embedded Coder + VS ExpressOptional: A real-Time Simulink Target (Real-Time Windows Targetof Mathworks, Quarc of Quanser, etc.)
⇒ http://www.gipsa-lab.fr/projet/RT-MaG/RT-MaG_Download.php
COM (Computer On Module):Linux (recommended: >3.5.0) + Patch PREEMPT-RTA gcc compiler + standard C libraries and headers,
Gumstix Overo
Linux Images,
Flash instructions,
Communication instructions,
Other COMs
Prepare_your_COM.pdf
Working with Yocto:
Prepare_your_COM.pdfGithub
5/15
Page 6
Introduction RT-MaG ToolBox Overview Examples Conclusion
Appearance & interface
A simple Simulink Library
The COM library
6/15
Page 7
Introduction RT-MaG ToolBox Overview Examples Conclusion
Appearance & interface
A simple Simulink Library
The HOST library
7/15
Page 8
Introduction RT-MaG ToolBox Overview Examples Conclusion
Appearance & interface
Generation workflow
Wifi
EmbeddedCoder
RT-MaGCoderRT-MaGCoder
RT-MaGImageRT-MaGImage
RT-MaGLibraryRT-MaGLibrary
TM
RT-MaGApplicationRT-MaGApplication
SIMULINK ®
EmbeddedCOM Model
C-CodeGeneration
Encapsulationfor Real-Time execution
HOST Model COM Model
Real-Time
Tuning&Monitoring
C-Codecompilation
gcc
FTP server
Linux Kernel
I/Os
COM
HOST COMPUTER
Real-Time Application
SIMULINK ® SIMULINK ®
8/15
Page 9
Introduction RT-MaG ToolBox Overview Examples Conclusion
Architecture
RT-MaG applications’ architecture
Embedded Linux 3.5.0
Sensors values
Control inputs
Serial
Real-Time Application:
Monitoring
Set Points
Quarc Real-Time Windows Target
High level SetPointsParameters
Console Application
root@gumstix:~$
WIFI
Estimates, control inputs...
High levelSetPoints,parameters
LinuxCommands
Task monitoring
Serial
SPI
I2C
ADC
GPIO
WIFI
SSH
UDP
WIFI
WIFI
SSH
UDP
Serial
Gumstix COM Ground Station
RT-MaGApplicationRT-MaGApplication
SIMULINK ®
EmbeddedCOM Model
COM side
Linux Program,
Multi-rate application (multi-thread),
Real-Time execution,
Host side
Real-Time Simulink program,
Monitoring, High-Level Setpoints,
Console application,9/15
Page 10
Introduction RT-MaG ToolBox Overview Examples Conclusion
Architecture
RT-MaG applications’ architecture
Embedded Linux 3.5.0
Sensors values
Control inputs
Serial
Real-Time Application:
Monitoring
Set Points
Quarc Real-Time Windows Target
High level SetPointsParameters
Console Application
root@gumstix:~$
WIFI
Estimates, control inputs...
High levelSetPoints,parameters
LinuxCommands
Task monitoring
Serial
SPI
I2C
ADC
GPIO
WIFI
SSH
UDP
WIFI
WIFI
SSH
UDP
Serial
Gumstix COM Ground Station
RT-MaGApplicationRT-MaGApplication
SIMULINK ®
EmbeddedCOM Model
COM side
Linux Program,
Multi-rate application (multi-thread),
Real-Time execution,
Host side
Real-Time Simulink program,
Monitoring, High-Level Setpoints,
Console application,9/15
Page 11
Introduction RT-MaG ToolBox Overview Examples Conclusion
Architecture
RT-MaG applications’ architecture
Embedded Linux 3.5.0
Sensors values
Control inputs
Serial
Real-Time Application:
Monitoring
Set Points
Quarc Real-Time Windows Target
High level SetPointsParameters
Console Application
root@gumstix:~$
WIFI
Estimates, control inputs...
High levelSetPoints,parameters
LinuxCommands
Task monitoring
Serial
SPI
I2C
ADC
GPIO
WIFI
SSH
UDP
WIFI
WIFI
SSH
UDP
Serial
Gumstix COM Ground Station
RT-MaGApplicationRT-MaGApplication
SIMULINK ®
EmbeddedCOM Model
COM side
Linux Program,
Multi-rate application (multi-thread),
Real-Time execution,
Host side
Real-Time Simulink program,
Monitoring, High-Level Setpoints,
Console application,9/15
Page 12
Introduction RT-MaG ToolBox Overview Examples Conclusion
Architecture
Debugging tools
Assistant toolsMis-configuration,
Incompatible block use,
Inline debugging toolsVerbose I/O mode,
I/O errors,
Execution time of eachprogram steps (Inputs,Outputs, tasks, etc.)
10/15
Page 13
Introduction RT-MaG ToolBox Overview Examples Conclusion
Architecture
Debugging tools
Assistant toolsMis-configuration,
Incompatible block use,
Inline debugging toolsVerbose I/O mode,
I/O errors,
Execution time of eachprogram steps (Inputs,Outputs, tasks, etc.)
10/15
Page 14
Introduction RT-MaG ToolBox Overview Examples Conclusion
General use
Multi-rate application
A 4 rate application:
0 50 100 150 200 250 3000
1000
2000
3000
4000
5000
6000
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000
5
10
15
20
25
30
a)
b)
UDP at 1kHz,Serial at 500Hz,PWM at 333Hz,SPI and I2C at200Hz,
11/15
Page 15
Introduction RT-MaG ToolBox Overview Examples Conclusion
Aerial robotics
X4-MaG quadrotor
Run exclusively RT-MaG Programs!
10 cm
http://www.gipsa-lab.fr/projet/RT-MaG/
Gumstix COM
12/15
Page 16
Introduction RT-MaG ToolBox Overview Examples Conclusion
Functionality
Main features:Automatic generation of multi-rate real-time application,Real-time monitoring, logging and parameter tuning,Several verbose and debugging tools,CPU load and overruns monitoring,Different timing mode (timer or interruption)
Supported I/O:UDP (WIFI and Ethernet),Serial (UART), I2C (master only), SPI (master only),File logging,
Gumstix Overo specific I/O:4x PWM up to 13MHz,GPIO (work in progress),7x ADC (work in progress),4x input-capture (work in progress),
13/15
Page 17
Introduction RT-MaG ToolBox Overview Examples Conclusion
Future work
Evolution and customization
Migration to Xenomai (Hard Real-Time Linux):
⇒ More than 10x lower latency
SystemLatency
min [µs] avg [µs] max[µs]
STD[µs]
PREEMPT-RT 33 - 435 131XENOMAI 9 11 26 1.6
Writing Real-Time driver (RTDM)⇒ Asynchronous mode to save CPU
An "add-on" of the RT-MaG PREEMPT-RT imageinherit all the RT-MaG functionality,Transparent for the user,Yocto: an independent layer⇒ easy to add to a custom distribution (i.e., other COM)14/15
Page 18
Introduction RT-MaG ToolBox Overview Examples Conclusion
Future work
Useful information
http://www.gipsa-lab.fr/projet/RT-MaG/RT-MaG_ToolBox.php
DocumentationsDownload
http://www.gipsa-lab.fr/projet/RT-MaG/X4-MaG.php
Documentation & assembly instructions
Download
10 cm
http://www.gipsa-lab.fr/projet/RT-MaG/
Gumstix COM
https://github.com/augustinmanecy/meta-rt-mag-overohttps://github.com/augustinmanecy/meta-xenomai
15/15