MR60

Is there a Mavlink library or programming API (not python) ?

Hi,

I'm looking for a simple libray or programming API I could use on a windows PC to send commands to a pixhawk via telemetry. But I do not want to use an existing GUI (groundstation), and preferably I'd like to avoid the complexity of the python mavproxy approach (way too much dependencies to install).

So is there such a windows mavlink library/API I could use to program in C/C++ to communicate with a pixhawk ?

Thx

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hi!

    I'm also interested in some code examples on C/C++ or java of the MAVLink API. Anybody have found something functional?

    thks!

    • Developer
      You can use the c library from the first link Chris posted. But you can also just use PyMavlink library which is just the part that does the protocol stuff in Python.
    • MR60

      Thx Chris & Bill, i visited these links but could not find any working windows download links: either 404 page not found or empty gits.

      Any direct download link for such a library?

    • The MAVLink source code is available at: https://github.com/mavlink/mavlink

      I think there's a few examples in there.

      mavlink/mavlink
      Marshalling / communication library for drones. Contribute to mavlink/mavlink development by creating an account on GitHub.
    • MR60

      thx, that helps.

      I'm still amazed how writing/receiving mavlink protocol binary streams through a COM port can be made so difficult when it should be so simple. The choice of a binary protocol versus an ASCII based protocol for mavlink makes for this complexity (look at "http" for the easiness of an ASCII protocol); eventhough binary protocols can be more efficient in bandwidth versus ASCII protocols; but mavlink is not designed to transmit high quantity of data anyway (no images, no video).

      There should be a development of basic read/write params mavlink functions ready to be used within windows & office applications (wouldn't it be great to have a excel sheet from which you can display/write your pixhawk params ?), within all main IDEs such as Processing, Visual C++ and a Java jar !

      I also do not understand why python was chosen for mavproxy (probably just due to a personal preference of the developer), because this makes mavlink integration in applications (mostly C or Java) quite difficult (not even mentionning this CLI approach of mavproxy which is completely against programming integration). Am I the only one to challenge this ?

    • Developer

      with these two examples

      http://www.qgroundcontrol.org/dev/mavlink_onboard_integration_tutorial

      http://www.qgroundcontrol.org/dev/mavlink_linux_integration_tutorial

      You should be able to make a simple c program that sends commands over MAVLink.

      There are also  a Java Library (Droid Planner), Python (MAVProxy called pymavlink), C/C++ (see above), C# (Mission Planner), and a Javascript Library (used by Mavelous)

      If you need help I can help guide you.

    • MR60

      bill, these two examples show code running on an autopilot to talk to a ground station. What I am looking for is the opposite but no examples for that:  piece of code running on a PC to communicate with a standard pixhawk. A difference would be how to address com ports of a PC instead of an APM uart0 and uart1 ?

    • Hugues and others,

      Just wondering if there's an update to this thread? 

      Has anyone found a working code examples showing how to send mavlink commands via an API call? Preferably via a java API, but I'll take c/c++ API examples, too.

      Thanks!

    • I've been keeping an eye on the java drone api development located at the link below. Perhaps this is partly what will be announced at the embedded conference? 

      https://github.com/diydrones/droneapi-java

      However, I'm still not seeing the kind of logical/simple java API that MAVLink commanding needs. Keep in mind that there are important use-cases that do not involve ground control systems (for example: onboard flight management systems that needs to communicate with the autopilot/IMU in real time)

      IMO, what's needed for a simple approach to MAVLink commanding are 2 things.

      1) Java POJOs that define each MAVLink command message type, with setters and getters exposing the logical attributes (not param#'s). 

      2) A simple MAVLinkCommanding interface to send() these command messages. The send() method should take mavlink command types and forward them to the autopilot. Client code should be able to do all commanding via this interface. The interface should hide all the communication details. The interface's implementation would handle the lower level communication details (serial port, baud rate, etc).

      Sending commands via a MAVLinkCommanding interface should be simple and straightforward for java client code. Something like this if

      public void sendWithoutAck(MAVLinkCommandMessage cmd) 

      public CommandAck sendWithAck(MAVLinkCommandMessage cmd) 

      I'm not seeing this kind of a design yet in droneapi-java. It appears to be focused on a web/REST API. Is there perhaps additional java SDK work ongoing that is not visible for public review?  

      A web/REST API for java is fine. But IMO, that API should utilize an underlying API something like described here for its communication support. This is a pretty standard approach to API construction. 

This reply was deleted.