STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian...

35
STARTING SOON “Controlling MAVLink drones with MAVSDK” 1

Transcript of STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian...

Page 1: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

STARTING SOON

“Controlling MAVLink drones with MAVSDK”

1

Page 2: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

2

Jonas Vautherin, Julian Oes2019-06-20

Page 3: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Speakers

Jonas VautherinMAVSDK Maintainer

Software Engineer, Auterion

Julian OesPX4 Maintainer

Senior Software Engineer, Auterion

3

Page 4: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

MAVSDK is a set of libraries providing a

high-level API to MAVLink

4

MAVSDK

Page 5: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

MAVSDK

5

Can be used to build a ground station, like QGC…

Page 6: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

MAVSDK

6

…or an onboard module, like with MAVROS…

PX4

Camera

Gimbal

Page 7: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

MAVSDK

7

…or both!

PX4

Camera

Gimbal

Page 8: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

8

Page 9: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

9

Not really...

Page 10: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

10

Not really...

Page 11: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

11

Not really...

Black Box

Page 12: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

12

Not really...

Python

Swift

JavaBlack Box

JavaScript

Page 13: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

13

Not really...

Python

Swift

JavaBlack Box

JavaScript

Page 14: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

14

Not really...

Python

Swift

JavaBlack Box

JavaScript mavsdk core

Page 15: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

15

Not really...

Python

Swift

JavaBlack Box

JavaScriptmavsdk_server

Page 16: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

16

Not really...

Python

Black Box

mavsdk-python

Page 17: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

17

Not really...

SwiftBlack Box

mavsdk-swift

Page 18: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

18

Not really...

JavaBlack Box

mavsdk-java

Page 19: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

19

Not really...

Black Box

JavaScriptmavsdk-javascript

Page 20: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

What does that bring?- One single MAVLink implementation for all platforms/languages

- Everything else (from the C++ API to the language bindings) is auto-generated

- Consistent set of features across MAVSDK

- Stable API

20

Python

Swift

JavaBlack Box

JavaScript

auto-generated

Page 21: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

More on the stable API

21

Find the API definition / available features on:

https://github.com/mavlink/MAVSDK-Proto

- Protobuf IDL

- CI tests to ensure stability

Page 22: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

And that’s not all!- Plugin architecture

- Packaged and distributed- C++ ⇒ *.deb and *.rpm packages

- Python ⇒ PyPI (pip install mavsdk)

- Swift ⇒ SwiftPM

- iOS ⇒ Carthage, Cocoapods

- Java ⇒ Maven/Gradle

22

Page 23: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

In short: if you need to talk MAVLink…

- Easy to install

- Easy to use

- Stable API

- Cross-platform and multi language

- Extensible

23

…then you should consider MAVSDK!

Page 24: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Current status

24

Python

Swift

JavaBlack Box

JavaScript

(MVP)

(prototype)(not auto-generated)

Page 25: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Roadmap- Auto-generate mavsdk_server

- Improve C++ packaging and distribution

- Package Java (including Android)

- Get some more experience with MAVSDK onboard

- Auto-generate documentation!

- We always review/support contributions!!!

25

Page 26: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

When can I start using MAVSDK?- Please do!

- The C++ core is 3 years old, and used in production

- MAVSDK-Swift is used in production

- Other bindings use the C++ core

- Version 0.x because the API is not stable yet (that will come with the

mavsdk_server auto-generation). It does NOT mean MAVSDK is in beta!

- Documentation may be lacking, but we are more than happy to help on

slack/discuss/github

26

Page 27: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Prerequisite: A working SITL (jmavsim, gazebo, …)

If you don’t have it installed, a quick way to run a headless SITL through docker is:

$ docker run --rm -it jonasvautherin/px4-gazebo-headless:v1.8.0

(source: https://github.com/JonasVautherin/px4-gazebo-headless)

Let’s run some code

27

Page 28: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

MAVSDK-Python

28

$ pip3 install mavsdk $ pip 3 install aioconsole $ apython

> from mavsdk import connect > from mavsdk import start_mavlink > start_mavlink() > drone = connect(host=’localhost’) > await drone.action.arm() > await drone.action.takeoff()

Quickstart (assuming Python 3.6+)

Page 29: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

MAVSDK

29

Install latest version

Download package: https://github.com/mavlink/MAVSDK/releases

or build from source:

$ git clone -b v0.18.0 https://github.com/mavlink/MAVSDK --recursive

$ cmake -Bbuild -H. && cmake --build build --target install

Page 30: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

$ dpkg -i mavsdk_0.18.0_ubuntu18.04_amd64.deb

MAVSDK

30

Simple C++ example:

https://gist.github.com/JonasVautherin/027724e93aeec4fc92140b14d1c01d28

Install the package (here on Ubuntu 18.04):

Page 31: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Resources

31

Python: https://github.com/mavlink/MAVSDK-Python

Swift: https://github.com/mavlink/MAVSDK-SwiftRxSwift: https://github.com/ReactiveX/RxSwift (Getting Started)

C++: https://github.com/mavlink/MAVSDK

Docs: https://sdk.dronecode.org/en/

Slack: https://slack.px4.io (#mavsdk)

Forum: http://discuss.px4.io/c/sdk

Page 32: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

Call For Contributions

- Report bugs

- Documentation

- Examples (C++, Swift, Python)

- Testing

- CI (Jenkins, Travis, AppVeyor, docker)

- SDK features

32

Page 33: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Controlling MAVLink drones with MAVSDK

(Some) contributors - Thanks!

33

Page 34: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Q&A

34

Resources

Slack: slack.px4.io (#mavsdk)Documentation: dronecode.org/sdkForum: discuss.px4.io/c/sdkGitHub: https://github.com/mavlink/MAVSDK

Page 35: STARTING SOON - PX4 autopilot · Controlling MAVLink drones with MAVSDK 2 Jonas Vautherin, Julian Oes 2019-06-20

Thank you!

35