C++ On Mars - Mark Maimone - CppCon 2014
C++ On Mars - Mark Maimone - CppCon 2014
C++ On Mars - Mark Maimone - CppCon 2014
on
Mars
Incorpora1ng
C++
into
Mars
Rover
Flight
So<ware
Mark
Maimone
Jet
Propulsion
Laboratory
California
Ins1tute
of
Technology
Ar#st’s
Concept.
NASA/JPL-‐Caltech
CppCon
2014
A Journey Through Time
and Space
Imagine …
Y2K
Y2K
Y2K
Y2K
On Mars.
CppCon
2014
Because of the distance between Earth and
Mars, we can t drive a rover in real time.
NASA/JPL-‐Caltech
CppCon
2014
A Day’s Plan Might Include Driving,
Using the Arm, or Remote Science
NASA/JPL-Caltech
CppCon
2014
Mars Rovers carry out their activities
then send data to the orbiters,
whose larger antennas relay it to Earth.
It takes less energy and a smaller antenna to send data 200 miles
(322 km) up to an orbiter, rather than millions of miles to Earth,
CppCon
2014
though direct contact is available.
So How Do You Build One?
Athena NASA/JPL-Caltech
CppCon
2014
Software Resources
MER
MSL
Radia1on-‐hardened
CPU
RAD6000
(PowerPC)
RAD750
(PowerPC)
Clock
Speed
20
MHz
133
MHz
On-‐board
RAM
128
Mbytes
128
Mbytes
Real
Time
Opera1ng
Sys
VxWorks
5.3.1
VxWorks
6.7
Addressable
Code
RAM
32
Mbytes
32
Mbytes
FSW
+
RTOS
Code
Size
10
Mbytes
21
Mbytes
Addi1onal
RAM
n/a
512
Mbytes
SDRAM
(half
for
RAMFS)
Per-‐Task
Memory
access
Shared
Memory
Shared
Memory
C/Embedded
C++
Green
Hills
MULTI
3.5
GCC
4.1.2
compiler
CppCon
2014
Mars Rover FSW Modules
MER and MSL each have over 100 individual source code
modules
Each module had a single FSW developer as its owner
Learn more:
“Curiosity’s FSW Architecture: A Platform for Mobility and
Science”, Dr. Kathryn Weiss, NASA JPL, video from 2012
Flight Software Workshop
CppCon
2014
MER Mobility FSW Modules
NASA/JPL-‐Caltech
CppCon
2014
Use C++ !
CppCon
2014
Why C++?
Urbie
NASA/JPL-Caltech
CppCon
2014
Why was C++ So Late to
Space?
Before MER development began in 2000, C++ code had not
flown on any JPL Mars mission.
C++ won!
CppCon
2014
What Does our C++ Code
Do?
Here is an overview of the Mars Rover C++ software.
Two
Years
of
Visual
Odometry
on
the
Mars
Explora@on
Rovers,
Maimone,
Cheng,
Ma>hies,
JFR
Vol
24
no
3,
3/2007,
pp
169-‐186.
ChemCam
RMI
Right
Le<
Navcams
(2)
Navcams
(2)
Right
Mastcam
Le<
Mastcam
(100mm)
(34
mm)
MAHLI
NASA/JPL-Caltech/MSSS NASA/JPL-‐Caltech
The 45o navigation cameras are almost
7 feet off the ground with 42cm baseline,
providing good views over nearby
obstacles or hills and into ditches.
NASA/JPL-‐Caltech
NASA/JPL-‐Caltech
Human Rover Drivers Decide How Much
Autonomy is Desired Based on Terrain
and Available Resources
CppCon
2014
Using visual odometry, the rover constantly
compares pairs of images of nearby terrain
to calculate its position.
NASA/JPL-‐Caltech NASA/JPL-‐Caltech
NASA/JPL-‐Caltech NASA/JPL-‐CaltecS
CppCon
2014
Rover Navigation 101
NASA/JPL-‐Caltech
Start
NASA/JPL-Caltech
Finish!
CppCon
2014
Curiosity’s map and tracks show this
decision to turn was based on her
evaluation of the terrain.
The
resul1ng
turn
Curiosity
avoids
the
darker
orange
in
favor
of
yellow
NASA/JPL-Caltech
CppCon
2014
The rover reduces a stereo point cloud into
a configuration space, labeling unsafe areas
red and safe areas green.
Engineers
have told
the rover
to stay
within the
white area.
Rover
Rover
NASA/JPL-Caltech
CppCon
2014
Field D* Optimal Global Path Planning
Overhead Imagery
Field D* Cost Map
CppCon
2014
IDD (Arm) Auto-place Sol A-1068
CppCon
2014
MER Visual Target Tracking (Sol B-992)
7 images and nearly 90o later…!
Seed Image!
CppCon
2014
Initial Concerns about C++
Exceptions: none
Templates: none
Iostream: none
CppCon
2014
Placement New
Recall that our O/S uses shared memory across all tasks;
every task shares the same system heap for dynamic
allocations.
CppCon
2014
Memory Allocator
Provides diagnostics
Optional display of each new and delete operation
Maintains free space map available for documentation
CppCon
2014
Running Tests
CppCon
2014
MER Engineering Model
NASA/JPL-‐Caltech
CppCon
2014
Indoor Testbed: In-Situ Lab
NASA/JPL-‐Caltech
NASA/JPL-‐Caltech
CppCon
2014
MSL FSW Simulation
Environments
Surface Navigation Unix binary
NASA/JPL-‐Caltech
CppCon
2014
VSTB Driving: 1
NASA/JPL-‐Caltech
CppCon
2014
VSTB Driving: 2
NASA/JPL-‐Caltech
CppCon
2014
Curiosity Odometry Per Sol
NASA/JPL-‐Caltech
CppCon
2014
Curiosity Cumulative Odometry
NASA/JPL-‐Caltech
CppCon
2014
C++ is pervasive on Earth
NASA/JPL-Caltech
Much of the software used to plan Mars rover drives on Earth is also
written in C++
49
CppCon
2014
C++ Annotates Drive Data
NASA/JPL-Caltech
CppCon
2014
C++ on Other Spacecraft
Earth Observing 1 –
Autonomous Sciencecraft
Experiment since 2005
Cubesats
MER and MSL paved the way for the 2020 Rover, which will
inherit MSL’s C++ code base
framework
The work described in this talk was performed at the Jet NASA/JPL-‐Caltech/JSC
Propulsion Laboratory, California Institute of Technology,
and was sponsored by the National Aeronautics and Space
Administration (NASA).
CppCon
2014
Planning
Mul1ple
Arm
Ac1vi1es:
Sol
612
NASA/JPL-‐Caltech
CppCon
2014
Sol 122: VO vs IMU
• By convention, any VO updates that measure more attitude
change than the IMU does will be rejected; we tend to trust
the IMU, especially over short distances
CppCon 2014