Flying Penguins Embedded Linux applications for autonomous - - PowerPoint PPT Presentation

flying penguins
SMART_READER_LITE
LIVE PREVIEW

Flying Penguins Embedded Linux applications for autonomous - - PowerPoint PPT Presentation

Flying Penguins Embedded Linux applications for autonomous UAVs Clay McClure github.com/claymation Roadmap MAV Your UAV mavros Link App ROS Linux autopilot autopilots autopilots RC input motor mixing


slide-1
SLIDE 1

Embedded ¡Linux ¡applications ¡ for ¡autonomous ¡UAVs

Flying Penguins

slide-2
SLIDE 2

Clay McClure

github.com/claymation
slide-3
SLIDE 3

Roadmap

UAV MAV Link mavros Your App ROS Linux

slide-4
SLIDE 4
slide-5
SLIDE 5

autopilot

slide-6
SLIDE 6

autopilots

slide-7
SLIDE 7

autopilots

slide-8
SLIDE 8

RC input motor mixing stabilization telemetry missions failsafes

slide-9
SLIDE 9
slide-10
SLIDE 10

AUTO PILOT AUTO NOMOUS

slide-11
SLIDE 11

where to go how to get there what to do next “system finds its own goal positions”

slide-12
SLIDE 12

SO MANY ALGORITHMS, SO LITTLE COMPUTER

http://ra3ndy.deviantart.com/art/Sad-Panda-69204875
slide-13
SLIDE 13

+

slide-14
SLIDE 14

Autopilot runs on Linux

slide-15
SLIDE 15

Autopilot talks to Linux

slide-16
SLIDE 16

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
slide-17
SLIDE 17

Roadmap (so far)

UAV Your App Linux

?

slide-18
SLIDE 18

Roadmap (so far)

UAV MAV Link Your App Linux

slide-19
SLIDE 19

MAVLink is the HTTP of drones

slide-20
SLIDE 20

(it’s also the libcurl)

slide-21
SLIDE 21

MAVLink

slide-22
SLIDE 22

status configuration position / attitude setpoints missions

slide-23
SLIDE 23

Roadmap (so far)

UAV MAV Link Your App Linux

?

slide-24
SLIDE 24

Roadmap (so far)

UAV MAV Link Your App Linux Middle ware

slide-25
SLIDE 25

Middleware

DroneAPI

  • Python
  • Go to Kevin Hester’s talk tomorrow

mavros

  • Python, C++, Lisp (really)
  • Access to a wealth of robotics research and tools
slide-26
SLIDE 26

Roadmap (so far)

UAV MAV Link mavros Your App Linux

?

slide-27
SLIDE 27

Roadmap (so far)

UAV MAV Link mavros Your App ROS Linux

slide-28
SLIDE 28

ROS Crash Course

slide-29
SLIDE 29

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

slide-30
SLIDE 30

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

slide-31
SLIDE 31
slide-32
SLIDE 32

Nodes

Node Node Node Node Node Node Node Node Node

slide-33
SLIDE 33

Topics

Node Node Node Node Topic

slide-34
SLIDE 34

Services

Node Node

slide-35
SLIDE 35

but wait, that’s not all…

parameters dynamic reconfig coordinate frames transformations record/playback visualization logging

slide-36
SLIDE 36

Roadmap

UAV MAV Link mavros Your App ROS Linux

slide-37
SLIDE 37

mavros is the Babel fish of drones

slide-38
SLIDE 38

Topics

/mavros/state /mavros/imu/data /mavros/global_position/global /mavros/local_position/local /mavros/setpoint_position/local_position /mavros/setpoint_velocity/cmd_vel

slide-39
SLIDE 39

Services

/mavros/cmd/arming /mavros/cmd/land /mavros/cmd/takeoff /mavros/set_mode /mavros/set_stream_rate

slide-40
SLIDE 40
  • FCU
  • MAVLink
  • mavros
  • ROS
  • Application nodes

PX4 + ROS

Credit: Kabir Mohammed
slide-41
SLIDE 41

Roadmap

UAV MAV Link mavros Your App ROS Linux

slide-42
SLIDE 42

YAPL

Yet Another Precision Lander
slide-43
SLIDE 43

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”
slide-44
SLIDE 44

Nodes

  • Tracker
  • Processes video stream, looks for landing pad
  • Publishes target position/velocity messages
  • Commander
  • Subscribes to vehicle state and position messages
  • Subscribes to target tracker messages
  • Controls vehicle velocity
slide-45
SLIDE 45
slide-46
SLIDE 46
slide-47
SLIDE 47

class ¡TrackerNode(object): ¡

  • ¡ ¡ ¡ ¡def ¡__init__(self): ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡rospy.init_node("tracker") ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡use_sim ¡= ¡rospy.get_param("~use_sim", ¡False) ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡camera_matrix ¡= ¡rospy.get_param("~camera_matrix") ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡# ¡... ¡
  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡self.image_publisher ¡= ¡\ ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡rospy.Publisher("tracker/image", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡sensor_msgs.msg.Image, ¡queue_size=1) ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡self.track_publisher ¡= ¡\ ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡rospy.Publisher("tracker/track", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Track, ¡queue_size=1)

slide-48
SLIDE 48

class ¡TrackerNode(object): ¡

  • ¡ ¡ ¡ ¡def ¡__init__(self): ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡rospy.init_node("tracker") ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡use_sim ¡= ¡rospy.get_param("~use_sim", ¡False) ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡camera_matrix ¡= ¡rospy.get_param("~camera_matrix") ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡# ¡... ¡
  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡self.image_publisher ¡= ¡\ ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡rospy.Publisher("tracker/image", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡sensor_msgs.msg.Image, ¡queue_size=1) ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡self.track_publisher ¡= ¡\ ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡rospy.Publisher("tracker/track", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Track, ¡queue_size=1)

slide-49
SLIDE 49

$ ¡cat ¡msg/Track.msg ¡ ¡ # ¡Whether ¡we're ¡tracking ¡an ¡object ¡ std_msgs/Bool ¡is_tracking ¡

  • # ¡Relative ¡position ¡and ¡velocity ¡of ¡the ¡tracked ¡object ¡

geometry_msgs/Vector3 ¡position ¡ geometry_msgs/Vector3 ¡velocity ¡

slide-50
SLIDE 50

¡ ¡ ¡ ¡def ¡publish_track(self, ¡position, ¡velocity): ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg ¡= ¡TrackStamped() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.is_tracking.data ¡= ¡self.is_tracking ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡self.is_tracking: ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.position.x ¡= ¡position[0] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.position.y ¡= ¡position[1] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.position.z ¡= ¡position[2] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.velocity.x ¡= ¡velocity[0] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.velocity.y ¡= ¡velocity[1] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg.track.velocity.z ¡= ¡velocity[2] ¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡self.track_publisher.publish(msg) ¡
slide-51
SLIDE 51

¡ ¡ ¡ ¡def ¡publish_image(self, ¡image): ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡msg ¡= ¡self.image_bridge.cv2_to_imgmsg(image, ¡"bgr8") ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡self.image_publisher.publish(msg) ¡

slide-52
SLIDE 52

simulation

slide-53
SLIDE 53

HITL

  • Hardware in the loop
  • Flight software runs on flight hardware
  • Simulated sensor and control inputs
slide-54
SLIDE 54

SITL

  • Software in the loop
  • Flight software runs on (Linux) desktop
  • Simulated sensor and control inputs and HAL
slide-55
SLIDE 55
slide-56
SLIDE 56
slide-57
SLIDE 57
slide-58
SLIDE 58 –Johnny Appleseed

“Type a quote here.”

“In theory there is no difference between theory and practice. 
 In practice there is.”

  • ~ Yogi Berra
slide-59
SLIDE 59

Practical Considerations

slide-60
SLIDE 60
slide-61
SLIDE 61

Connections

  • UART recommended
  • Requires 6-pin DF-13, possibly a level shifter
  • USB works for me
  • Use hot glue gun
  • sudo ¡apt-­‑get ¡remove ¡modemmanager
slide-62
SLIDE 62

Power

5V 5A UBEC

  • ODROID

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

slide-63
SLIDE 63

Launch files

  • ROS feature that makes it easy to start and manage

multiple nodes and their parameters

  • roslaunch ¡lander ¡lander.launch
slide-64
SLIDE 64

Startup

  • Use ubuntu’s upstart to launch ROS + mavros +

application nodes

  • rosrun ¡robot_upstart ¡install ¡\


¡ ¡ ¡ ¡lander/launch/lander.launch

slide-65
SLIDE 65

Telemetry

  • MAVLink + 3DR radio
  • WiFi
  • Ad-Hoc mode (man ¡wireless)
  • Need high-gain antenna and a tracker (helper)
  • sudo ¡apt-­‑get ¡remove ¡wpasupplicant ¡
  • GSM?
slide-66
SLIDE 66

Coordinate Frames

  • Global / Local
  • NED
  • ENU
  • Body-fixed
  • tf library
slide-67
SLIDE 67

In closing…

slide-68
SLIDE 68
slide-69
SLIDE 69

What will you make?

slide-70
SLIDE 70

For more information…

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