ProductPromotion
Logo

Kotlin

made by https://0x3d.site

GitHub - divyanshupundir/mavlink-kotlin: A modern MAVLink library for Kotlin Multiplatform.
A modern MAVLink library for Kotlin Multiplatform. - divyanshupundir/mavlink-kotlin
Visit Site

GitHub - divyanshupundir/mavlink-kotlin: A modern MAVLink library for Kotlin Multiplatform.

GitHub - divyanshupundir/mavlink-kotlin: A modern MAVLink library for Kotlin Multiplatform.

mavlink-kotlin

License Kotlin Maven Central Gradle Plugin Portal

A modern MAVLink library for Kotlin Multiplatform.

Overview

mavlink-kotlin was created out of the need for a type-safe, high-performance and flexible MAVLink library for targeting multiple platforms.

We had realized several problems with existing JVM MAVLink implementations. These include:

  • Performance problems at very high message rates
  • Hassle to generate and maintain MAVLink message objects from custom XML definitions
  • Difficulties in understanding and fixing reflection-based code
  • Difficulties in extending existing code-base due to lack of modularity
  • No support for multiplatform projects

Through mavlink-kotlin we want to address the problems that we had faced while adopting and understanding MAVLink libraries not only for the JVM but also C/C++, Golang, Rust and Python. This library takes inspiration from several great features of these libraries. We want to make the adoption of this library as easy as possible by being flexible in terms of creating a modular and easy-to-extend API that allows the users to use the same base MAVLink and connection classes to create adapters of their own to fit whatever pub-sub library they want to use. Apart from this, the MAVLink generator plugin is designed to fit well with stand-alone Kotlin Multiplatform projects while keeping the setup quick and hassle-free.

Key Design Considerations

Code generation instead of reflection

Reflection-based code is prone to errors, difficult to understand and difficult for compilers to optimize.

On the other hand, generated code is much easier for the users to go through and understand. And apart from the obvious possibilities of compile-time and run-time optimizations, it is free from the fragility that reflection brings in. mavlink-kotlin heavily uses code generation to avoid reflection and provide compile-time safety.

Interface-based API and modular design

Don't think the in-built implementation is good enough? No issues. Write your own code generators for the messages, enums, dialects etc. and the rest of the modules will work without requiring a reimplementation.

Message generator Gradle plugin

You can provide your own dialect files and the Gradle plugin will take care of generating the messages. Use it to generate and maintain your own private MAVLink message implementations for your drone systems by simply providing the MAVLink XMLs.

Support for Kotlin Multiplatform

Target Android, iOS, JS, JVM, Linux, macOS, watchOS and Windows applications using the same codebase.

Project Structure

api

Core interfaces, classes and annotations for the MAVLink protocol.

serialization

Tools for serializing and deserializing MAVLink messages/frames to and from ByteArrays.

generator

MAVLink generator Gradle Plugin that uses the api and the serialization modules to generate the MAVLink classes. This plugin is available at Gradle Plugin Portal with ID com.divpundir.mavlink.generator. It can be used by anyone to generate MAVLink classes from their own XML files. No need to fork this project.

definitions

Implementation of the standard MAVLink messages from the official MAVLink repository generated using the Gradle plugin.

connections

Defines the interfaces and classes to handle the MAVLink connection modes and streams. Users can create MavConnection implementations of their own or use the ready-made ones.

adapters

The different connection classes only handle the underlying connection interfaces and provides reader and writer methods to and from byte streams. The adapters module wraps the connection classes to provide an abstraction layer that makes the handling of the connections easy.

Users can create an adapter of their own or use the ready-made adapters which are:

  • RxJava2
  • RxJava3
  • Kotlin Coroutines

Usage

Dependencies

The latest artifacts are available on Maven Central.

You can either use the standard definitions artifact available for standard messages, or you can use the generator to generate your own. The details on how to do that is available in the generator module.

implementation("com.divpundir.mavlink:definitions:$version")

Pick one or more connection modules. For example, the TCP connection module.

implementation("com.divpundir.mavlink:connection-tcp:$version")

Pick an adapter of your choice to wrap the MavConnection. For example, the coroutines adapter.

implementation("com.divpundir.mavlink:adapter-coroutines:$version")

The build.gradle.kts should look like this:

repositories {
    mavenCentral()
}

dependencies {
    implementation("com.divpundir.mavlink:definitions:$version")
    implementation("com.divpundir.mavlink:connection-tcp:$version")
    implementation("com.divpundir.mavlink:adapter-coroutines:$version")
}

Connection handling

Refer the different adapter modules for details on how to use them.

API docs

For the API docs, please refer the KDoc.

Advanced usage

For advanced usage, please refer the following blog series:


Supported By

JetBrains Open Source Support

JetBrains Open Source Support

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory