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

Post on 03-Jun-2020

2 views 0 download

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

STARTING SOON

“Controlling MAVLink drones with MAVSDK”

1

Controlling MAVLink drones with MAVSDK

2

Jonas Vautherin, Julian Oes2019-06-20

Controlling MAVLink drones with MAVSDK

Speakers

Jonas VautherinMAVSDK Maintainer

Software Engineer, Auterion

Julian OesPX4 Maintainer

Senior Software Engineer, Auterion

3

Controlling MAVLink drones with MAVSDK

MAVSDK is a set of libraries providing a

high-level API to MAVLink

4

MAVSDK

Controlling MAVLink drones with MAVSDK

MAVSDK

5

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

Controlling MAVLink drones with MAVSDK

MAVSDK

6

…or an onboard module, like with MAVROS…

PX4

Camera

Gimbal

Controlling MAVLink drones with MAVSDK

MAVSDK

7

…or both!

PX4

Camera

Gimbal

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

8

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

9

Not really...

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

10

Not really...

Controlling MAVLink drones with MAVSDK

Why MAVSDK?- Is it meant to replace QGC?

- Is it meant to replace MAVROS?

11

Not really...

Black Box

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

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

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

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

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

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

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

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

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

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

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

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!

Controlling MAVLink drones with MAVSDK

Current status

24

Python

Swift

JavaBlack Box

JavaScript

(MVP)

(prototype)(not auto-generated)

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

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

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

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+)

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

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):

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

Controlling MAVLink drones with MAVSDK

Call For Contributions

- Report bugs

- Documentation

- Examples (C++, Swift, Python)

- Testing

- CI (Jenkins, Travis, AppVeyor, docker)

- SDK features

32

Controlling MAVLink drones with MAVSDK

(Some) contributors - Thanks!

33

Q&A

34

Resources

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

Thank you!

35