Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Drones Yu David Liu.

Similar presentations


Presentation on theme: "Programming Drones Yu David Liu."— Presentation transcript:

1 Programming Drones Yu David Liu

2 Drones in the News

3 Drones in the News

4 Drones in the News

5 Unmanned Aerial Vehicle (UAV)
Drones are more technically called UAVs A flying computer! For historical reasons, the boundary between hardware and software in existing UAV systems is often blurred, and the boundary between system software and application software is blurred as well For this talk, we will focus on an open hardware-software UAV system, Paparazzi

6 Fixed Wing vs. Multi-Rotor Drones
Source:

7 Overview two-way data one-way control

8 Paparazzi UAV Main Autopilot Board Sensors Datalink Radio Modem
Attitude sensor (infrared) Inertial measurement (acceleration, rotation) Airspeed sensor Pressure sensor Datalink Radio Modem RC Receiver Actuators (movement and control) Propulsion system GPS Receiver Batteries Payload (Camera, Video recorder, etc)

9 MicroJet Example Autopilot Control Board Motor & Controller Battery
Datalink Radio-Modem & Antenna GPS Receiver IR Sensor Motor & Controller RC Receiver & Antenna Servos (actuators) Payload

10 Terms: Roll, Pitch, Yaw

11 Paparazzi Programming
Paparazzi programming comes in several layers: On the highest level, there is a GUI, a user-friendly way to set configurations of your aircraft and your flight information Under the GUI, most configuration information is textually represented as XML files Under the GUI/XML, the real flight control programs are written in C, with glue code written in ML and Python

12 Configurations Airframe XML File: autopilot parameters (e.g. hardware component settings) Flight Plan XML File: flight behavior definitions Radio XML File: RC transmitter behaviors (manual control) Telemetry XML File: data messages and transmission rate definitions Settings XML Files

13 A Typical UAV Program: Flight Plan
A typical UAV program describes the duration of flying a UAV through a sequence of points in physical space and completing a series of flying tasks Key questions: How to define points in physical space? (“waypoints”) How to describe flying tasks? (“blocks”)

14 Flight Plan Part I: Waypoint
A waypoint is a reference point in physical space used for purposes of navigation Conceptually, it’s like a coordinate in the 3D space In modern aviation industry: There are multiple established ways to represent such points For real airlines, waypoints are typically abstract and nicknamed (just as you often say “our university is located at exit 7 of I-81 north” instead of “longitude 101E, latitude 33N.”)

15 A Real-World Flight Plan Example

16 2D Waypoint through Latitude/Longitude
Latitude 0: Equator Longitude 0: Prime Meridian Example: ° N, ° W (where is this?)

17 The Third Dimension of Waypoint
Absolute: “altitude,” usually represented as Meters above Sea Level (MSL) Relative: “height,” usually represented as the difference in altitude from ground altitude

18 Paparazzi Waypoint Examples

19 Flight Plan Part II: Stages/Blocks
A flight plan is composed of a sequence of stages Logically, each stage defines a unit of the flying mission, such as take-off, landing, circling, etc The stages are enclosed in a pair of blocks tags. Each stage is defined through a block tag.

20 Blocks Example <blocks> <block name="Wait GPS">
<set value="1" var="kill_throttle"/> <while cond="!GpsFixValid()"/> </block> <block name="Geo init"> <while cond="LessThan(NavBlockTime(), 10)"/> <call fun="NavSetGroundReferenceHere()"/> <block name="Holding point"> <attitude roll="0" throttle="0" vmode="throttle"/> </blocks>

21 The Semantics of Blocks
As it turns out, the blocks construct is as expressive as a procedural language Order matters: the blocks are executed in sequence following the order of block definition Program behavior is undefined after the last block is completed You will see familiar features from procedural languages, such as “while” and “for” and “call” and “set” (guess what they mean!)

22 The Semantics of Blocks (Cnt’d)
Control flow can be altered when “exception” is thrown: <block name=”X” > <exception cond="GetPosAlt() > ground_alt+25" deroute= “Y"/> </block> <block name=”Y” > “deroute” is similar to “goto” when the “cond” of the “exception” is true

23 Terms: Flying Cycle Take-off Climb Cruise Descent Approach Landing Go-Around (aborted landing)

24 Basic Waypoint Navigation: Go
<go wp="HOME"/> Navigate to the waypoint “Home” May lead to altitude change if the waypoint to go to may have a different altitude Control flow goes to the next stage once “Home” is reached

25 Basic Waypoint Navigation: Go
<go from="wp1" wp="wp2" hmode="route"/> Navigate from waypoint “wp1” to “wp2” with a linear route in between

26 Basic Waypoint Navigation: Go
<go from="wp1" wp="wp2" hmode="route" pitch="auto" throttle="0.75" alt="ground_alt+100"/> Navigate from waypoint “wp1” to “wp2” with a linear route in between, with a fixed level of throttle, and overrides the target waypoint’s altitude with “ground_alt+100”

27 Terms: Throttle An aircraft needs power in the engine to perform flying tasks, such as take-off and maintaining speed. The level of power is called throttle The throttle value is between 0 and 1 Obviously, for different flying tasks, the level of throttle is different

28 Basic Waypoint Navigation: Go
<go from="wp1" wp="wp2" hmode="route" vmode="climb" climb="1.5"/> Navigate from waypoint “wp1” to “wp2” with a linear route in between, with a fixed level of climb speed (1.5 meters per second)

29 Basic Waypoint Navigation: Go
<go from="wp1" wp="wp2" hmode="route" approaching_time="1"/> Navigate from waypoint “wp1” to “wp2” with a linear route in between, with a duration of 1 unit of time

30 Basic Waypoint Navigation: Circle
<circle wp="HOME" radius="75"/> Circle clock-wise around waypoint “HOME”, with a radius of 75 meters

31 Basic Waypoint Navigation: Circle
<circle wp="HOME" radius=”-75"/> Circle counter-clock-wise around waypoint “HOME”, with a radius of 75 meters

32 Basic Waypoint Navigation: Circle
<circle wp="HOME" radius=” 50+(GetPosAlt()-ground_alt)/2” vmode="throttle" throttle="0.75" pitch="15”/> Circle and climb clock-wise around waypoint “HOME”, with an expanding radius

33 Example: Take-Off <block name="Takeoff” >
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/> <set value="0" var="kill_throttle"/> <set value="0" var="autopilot_flight_time"/> <go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/> </block>

34 Example: Land <block name="land">
<call fun="nav_compute_baseleg(WP_AF, WP_TD, WP_BASELEG, nav_radius)"/> <circle radius="nav_radius" until="NavCircleCount() > 0.5" wp=”WP_BASELEG"/> </block> <block name="final"> <exception cond="ground_alt + 10 > GetPosAlt()" deroute="flare"/> <go from="AF" hmode="route" vmode="glide" wp="TD"/> <block name="flare"> <go approaching_time="0” hmode="route" throttle="0.0" vmode="throttle" wp="TD"/> <attitude roll="0.0" throttle="0.0" until="FALSE" vmode="throttle"/>

35 Acknowledgments Paparazzi website Bhavin Desai, exploratory studies Wikipedia Images of news articles are from Google News

36 Terms: Course, Track, Heading
Course is the angle that the intended path of the UAV makes with a fixed reference object (typically north). Course is measured in degrees from 0° clockwise to 360° in compass convention (0° being north, 90° being east). Track is the actual path over the ground (ideally the course) Heading is the direction the UAV has to point in order to achieve its course (course and heading may differ because of e.g., wind)

37 Terms: Vertical Control Modes
Specified by the vmode attribute in Paparazzi Can be one of the four: Throttle mode (vmode = “throttle”): specifying the desired throttle, with speed implicitly determined Speed mode (vmode = “climb”): specifying the desired (climb) speed (meter/second), with throttle level implicitly determined Maintain altitude mode (vmode = “alt”): maintain the altitude specified by the waypoint (default) Glide mode (vmode = “glide”): maintain the slope between two waypoints

38 Terms: Horizontal Control Modes
Specified by the hmode attribute in Paparazzi The most widely used one is “route”, which connects two way points


Download ppt "Programming Drones Yu David Liu."

Similar presentations


Ads by Google