flying penguins - elinux · 2016-07-06 · launch files • ros feature that makes it easy to...

54
Embedded Linux applications for autonomous UAVs Flying Penguins

Upload: others

Post on 28-Feb-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Embedded  Linux  applications  for  autonomous  UAVs

Flying Penguins

Page 2: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Clay McClure twitter.com/claymcclure github.com/claymation

Page 3: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 4: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 5: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 6: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 7: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 8: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

stabilizationtelemetry

failsafesmissions

Page 9: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 10: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

≠AUTO

PILOT

AUTO

NOMOUS

Page 11: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

AUTONOMY

“system finds its own goal positions”

Page 12: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

where to go

“system finds its own goal positions”

AUTONOMY

Page 13: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

where to gohow to get there

“system finds its own goal positions”

AUTONOMY

Page 14: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

where to gohow to get therewhat to do next

“system finds its own goal positions”

AUTONOMY

Page 15: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

SO MANY

ALGORITHMS,

SO LITTLE

MEGAHERTZhttp://ra3ndy.deviantart.com/art/Sad-Panda-69204875

Page 16: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

+

Page 17: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

• Real-time kernel • Hardware drivers (SPI, I2C, CAN, UART) • Device trees • Programmable real-time units • PixHawk Fire Cape • BeaglePilot project

Autopilot runs on Linux

Page 18: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

• Linux runs on a companion computer • RS-232 serial interface to autopilot • Treat the autopilot as a peripheral • This is what I’m talking about today

Autopilot talks to Linux

Page 19: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

ODROID-XU3 Lite• Samsung Exynos5422 octa core

• 4x Cortex™-A15 2.0GHz

• 4x Cortex™-A7 1.4GHz

• 2 GB RAM

• 32+ GB flash

• 4x USB 2.0 + 1x USB 3.0

Page 20: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Your App

Autopilot

Page 21: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Your App

Autopilot

Middleware

Page 22: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Middleware• DroneAPI!

• Python

• Go to Kevin Hester’s talk tomorrow

• ROS + mavros!

• Python, C++, Lisp (really)

• Access to a wealth of robotics research and tools

Page 23: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Credit: Kabir Mohammed

PX4 + ROS

Page 24: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

ROS Crash Course

Page 25: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Robot Operating System

“ROS is an open-source, meta-operating system for your robot.”

– http://wiki.ros.org/ROS/Introduction

Page 26: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Nodes• Process / address space

• ROS applications composed of many small nodes

• “Do one thing and do it well”

• Modular

• Reusable

• Separation of concerns

Page 27: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Topics• Publish / subscribe message bus

• Strongly-typed messages

• Peer-to-peer message passing

• Centralized name registry (master node)

Page 28: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Services• Similar to topics, but with request / reply semantics

• Think of it as RPC

Page 29: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

but that's not all...parameters transformations record/playback visualization logging

Page 30: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

mavros

Page 31: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Topics• /mavros/global_position/global

• /mavros/local_position/local

• /mavros/imu/data

• /mavros/state

• /mavros/setpoint_position/local_position

• /mavros/setpoint_velocity/cmd_vel

Page 32: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Services• /mavros/cmd/arming

• /mavros/cmd/land

• /mavros/cmd/takeoff

• /mavros/set_mode

• /mavros/set_stream_rate

Page 33: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Event-driven programming• “Don’t call me, I’ll call you”

• Your application code responds to events

• Message arrival

• “my position is (x, y, z)”

• Timer expiry

• “it’s time to run the control loop”

Page 34: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Example ApplicationYet Another Precision Lander

Page 35: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Nodes• Tracker!

• Processes video stream, looking for landing pad

• Publishes target position/velocity messages

• Commander!

• Subscribes to vehicle state and position messages

• Controls vehicle velocity

Page 36: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 37: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

(TODO: code snippets)

Page 38: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Simulations

Page 39: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

HITL• Hardware in the loop

• Flight software runs on flight hardware

• Simulated sensor and control inputs

Page 40: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

SITL• Software in the loop

• Flight software runs on (Linux) desktop

• Simulated sensor and control inputs and HAL

Page 41: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

ArduPilot SITL

Page 42: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 43: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

PX4 SITL• 3D simulation with Gazebo

• TODO

Page 44: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Practical Considerations

Page 45: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 46: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Connections• UART recommended

• USB works for development

Page 47: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Power• UBEC

• ODROID + USB camera + WiFi + 3S LiPo = 5 hours

Page 48: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Launch files• ROS feature that makes it easy to start and manage

multiple nodes and their parameters

• `roslaunch mavros apm.launch`

• `rosparam load ~/tracker.yaml /tracker`

Page 49: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Startup• use ubuntu’s upstart to launch ROS + mavros +

application nodes

• robot_upstart

Page 50: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Telemetry• MAVLink + radio

• WiFi

• Ad-Hoc mode (man wireless)

• sudo apt-get remove wpasupplicant

• GSM

Page 51: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

Coordinate Frames• Global / Local

• NED

• NEU

• ENU

• Body-fixed

• tf library

Page 52: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`
Page 53: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

What will you make?

Page 54: Flying Penguins - eLinux · 2016-07-06 · Launch files • ROS feature that makes it easy to start and manage multiple nodes and their parameters • `roslaunch mavros apm.launch`

ardupilot.com pixhawk.org/start ros.org github.com/mavlink/mavros github.com/claymation/lander