-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d3defc
commit 97e63b8
Showing
6 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
rootProject.name = 'TakeoffAndLand' | ||
rootProject.name = 'MAVSDK-Java-example' | ||
|
||
includeBuild '../../sdk' | ||
// Uncomment the following line to use the SDK built from sources. | ||
// This will require `protoc-gen-dcsdk` to be in your PATH. See | ||
// the README in ../../sdk for more instructions about building | ||
// from sources. | ||
//includeBuild '../../sdk' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,50 @@ | ||
# MAVSDK-Java - SDK | ||
|
||
This project is the actual Java SDK that gets deployed on [Maven Central](https://search.maven.org/search?q=a:mavsdk). It works by connecting to a running instance of `mavsdk_server`, that can be downloaded from the [MAVSDK release artifacts](https://github.com/mavlink/MAVSDK/releases). By default, it connects on a `mavsdk_server` instance running locally (i.e. on 'localhost'), but it can connect on any machine over the network. | ||
|
||
## Getting started | ||
|
||
Because it is deployed on Maven Central, adding MAVSDK-Java to your project is a matter of adding the dependency to your gradle file: | ||
|
||
```groovy | ||
dependencies { | ||
implementation 'io.mavsdk:mavsdk:0.1.0' | ||
} | ||
``` | ||
|
||
In your project, it can then be used to e.g. takeoff with the following (assuming an instance of `mavsdk_server` is running): | ||
|
||
```java | ||
import io.mavsdk.action.Action | ||
|
||
Action action = new Action(); | ||
action.arm().andThen(action.takeoff()).subscribe(); | ||
``` | ||
|
||
Note that the MAVSDK-Java API is using [RxJava](https://github.com/ReactiveX/RxJava), for which extensive documentation can be found online. Don't forget to have a look at our [examples](../examples). | ||
|
||
## Contributing | ||
|
||
The SDK implements the MAVSDK protobuf interfaces by using RxJava and TDD-style. This means that every single public method of a component must be unit-tested. | ||
MAVSDK-Java is mainly autogenerated from the MAVSDK [proto files](./proto), using our [protoc-gen-dcsdk plugin](./proto/pb_plugins) and [templates](./templates). Before starting contributing, learn to build from sources (below). | ||
|
||
## Building from sources | ||
|
||
### Prerequisites | ||
|
||
MAVSDK-Java is built using gradle, but `protoc-gen-dcsdk` must be in your PATH in order to auto-generate the code. It requires Python 3.6+ and can be built from `sdk/proto/pb_plugins` by running: | ||
|
||
```sh | ||
pip install -r requirements.txt | ||
pip install -e . | ||
``` | ||
|
||
Make sure to add `protoc-gen-dcsdk` to your PATH! | ||
|
||
## Project organization | ||
### Building the SDK | ||
|
||
This is the root of the main "sdk" project, composed of multiple modules. Each module corresponds to a component defined by a protobuf interface (see [MAVSDK-Proto](https://github.com/mavlink/MAVSDK-Proto)). | ||
Once the prerequisites are met, the SDK can be built with: | ||
|
||
Each module is only building a specific part of the overall protobuf interface by using a symbolic link to the corresponding folder in MAVSDK-Proto (see for instance [the core module](https://github.com/mavlink/MAVSDK-Proto)). | ||
```sh | ||
./gradlew build | ||
``` | ||
|
||
Most of the gradle setup is shared between the components and can be found in [build.gradle](./build.gradle). |