SSSnow / MAVSDK-Java

MAVSDK client for Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MAVSDK-Java

This is the Java frontend implementation to MAVSDK.

It is organized as follows:

  • The examples directory contains Java and Android examples using the sdk.
  • The sdk directory contains the actual SDK.
  • The mavsdk_server directory contains the Android library exposing mavsdk_server.

QuickStart

The fastest way to start is to follow the instructions in the README of the java-client example. For Android, the android-client is the next step.

MAVSDK-Java is distributed through MavenCentral, meaning that it can be imported using gradle with:

dependencies {
    ...
    implementation 'io.mavsdk:mavsdk:0.4.0'
    ...
}

For Android, mavsdk_server is distributed as an Android library (aar):

dependencies {
    ...
    implementation 'io.mavsdk:mavsdk:0.4.0'
    implementation 'io.mavsdk:mavsdk-server:0.4.0'
    ...
}

Contributing

Coding style

Java/Android coding style is ensured using CheckStyle with the Google style.

Command line

A checkstyle task is defined in the root build.gradle of each project and can be run as follows:

$ ./gradlew checkstyle

The build task depends on checkstyle, meaning that $ ./gradlew build runs the checks as well.

IntelliJ / Android-Studio

There exist a plugin for CheckStyle in JetBrains' IDEs.

Setup
  1. Install the plugin called "CheckStyle-IDEA" in IntelliJ / Android-Studio.
  2. Import the checkstyle configuration as a code style scheme in Settings > Editor > Code Style > Java > Manage... > Import... by selecting "CheckStyle configuration" and then browsing to config/checkstyle/checkstyle.xml.
  3. In Settings > Other Settings > Checkstyle, change the "Scan Scope" to "Only Java sources (including tests)".
  4. Still in Settings > Other Settings > Checkstyle, add a new configuration file and browse to config/checkstyle/checkstyle.xml.
Usage

In IntelliJ / Android-Studio's bottom task bar, you should see a "CheckStyle" tab. It will allow you to select your configuration with the "Rules" dropdown-list, and to run the analysis on your code.

Note that by default, the IDE will not run checkstyle when building the project (whereas $ ./gradlew build always does it).

Troubleshooting

In IntelliJ / Android-Studio, the IDE might force the order of the imports in a way that is not following the checkstyle rules. For some reason, this is not set when importing checkstyle.xml as a code style scheme. However, it can be manually updated in Settings > Code Style > Java > Import Layout.

Releasing

Both sdk and mavsdk_server are released with Maven. Publishing can be done through a gradle task:

./gradlew uploadArchives

This task requires a few secrets in gradle.properties:

signing.keyId=<keyId>
signing.password=<password>
signing.secretKeyRingFile=<ring_file>

ossrhUsername=<username>
ossrhPassword=<password>

Further Information

About

MAVSDK client for Java.


Languages

Language:Java 67.9%Language:C++ 21.0%Language:C 6.0%Language:CMake 5.0%