Libvoxl_io with mavlink

  • Dev Team

    Hi, voxl-mavlink-server handles the UART IO then breaks out the mavlink packets into MPA as a pipe so multiple services can subscribe and send data from/to PX4, you don't need to use the UART port directly.

    You can copy most of the code out of the voxl-vision-px4 module that handles mavlink IO to/from PX4 and use it in your own service alongside voxl-vision-px4 without interfering with it.


  • Thank you, using px4-mavlink.c as example, we were able to open our own pipe:

    Mavlink doesn't raise an error, but the result is always 0.000

    Here are some screenshots from the script:

    Do we need to use our own pipe or should we make a client that connects to voxl-vision-px4's pipe?
    Is there a mavlink connection because it doesn't raise an error?

    Thank in advance!

  • Dev Team

    @SHofmeester voxl-mavlink-server creates the server pipe(s). The example code that James pointed to shows how a client connects to it to receive Mavlink packets. In that example code it is the function _data_from_px4_helper_cb that gets called every time there is new Mavlink data available.

  • Thank you, we put the code in _data_from_px4_helper_cb and we are able to get specific mavlink messages now.


    We added libapq8096_io to the and the CMakeLists.txt file. When we #include <voxl_io.h> and add voxl_i2c_init(i2c_bus); to the script and try to build it, the following error is raised:

    But when we add voxl_i2c_init(); without an argument, it says:
    41cf6159-ba8e-4b2a-bac5-7b826232d99c-image.png So the script seem to be connected to libapq8096_io.

    We tried to build it in voxl-cross, because voxl-vision-px4 is built in voxl-cross. But libapq8096_io is built in voxl-hexagon. Does the "undefined reference" problem have to do with the different compilers? If so, how can we change the compiler?

  • Dev Team


    Just want to make sure, the install build deps script will pull libapq8096-io but the CMakeLists need to link against libvoxl_io. Its a little confusing but the idea is to allow the build deps script to pull the right package (since it knows the platform it's building for) but the CMakeLists can remain the same.

  • Hi @Alex-Gardner,

    I'm not entirely getting what you are saying.

    In the build_deps file we only added the following line:

    In CMakeLists.txt (from the same folder as the script) we added:
    find_library(LIBAPQ8096_IO libapq8096_io LIBVOXL_IO libvoxl_io HINTS /usr/lib64)

    When we try to build these files in voxl-cross, we get the errors from the earlier post.

    Do we need to add anything else, or delete something?

  • Dev Team


    I did a little digging and found 2 things:

    First, the find_package looks like it shouldn't have "lib" in the name (so find_library(LIBVOXL_IO voxl_io HINTS /usr/lib64/)).

    Second and more importantly, there is no voxl_io lib in lib64 because on apq8096 we have to build it in 32 bit because the dsp libs are 32 bit only. So your process would either need to build/run 32 bit or, if you need it in 64 bit, have a 32 bit helper service do the io read/writes and communicate the data to the other process via some standard (like libmodal_pipe, that's why we built it)

  • Hi @Alex-Gardner,

    Thank you for your reply.

    We changed the find_library-line and now he is able to find the .so-file. It now says the .so-file is the wrong format, which is correct according to your second point.

    For your second point: which libraries below can be build/run 32bit and which ones can't?

    For the 64bit with 32bit helper service solution: we already made a pipe where we receive mavlink messages from using pipe_validate_mavlink_message_t in _data_from_px4_helper_cb.
    Can we use this pipe for the writing with voxl_io, or do we need to make a new one?
    And how can we write through the pipe with voxl_io, because we checked libmodal_pipe but couldn't find anything for that?
    Do we need to make another script with voxl_io functionalities and run it at the same time as the current mavlink message receiving script and communicate between them using a pipe?

    We are looking at different types of solutions, so we looking forward to your reply.

  • Dev Team


    From that list the following already have 32 bit builds that are present when the package is installed:

    Additionally, the voxl-mavlink package is header-only and should work fine in a 32 bit project.

    The only one that's 64 bit only is modal-cv. Is there a reason that you need the computer vision library for what seems like should just be a mavlink translator service?

    If your service here is just reading a modal-pipe and writing the data out of voxl-io you should be able to do this just fine with your current setup. If you're attempting a computer vision task that depends on modal-cv it should most likely be broken out into it's own 64 bit service to run much faster.

  • Hi @Alex-Gardner,

    We switched from using voxl-cross and using adjusted .sh files from voxl-vision-px4, to placing our script inside libvoxl_io and adjusting the install_deps and CMakeLists.txt file. Then we can use the 32bit compilers from libvoxl_io, instead of the 64bit compiler from voxl-vision-px4 (we are not really using voxl-vision-px4 as a whole, we just copied some files for dependencies en building).

    We added the libraries to install-deps, except modal-cv (because we don't need it) and that works. (Libvoxl_io is not among the installed libraries, because we placed our script inside libvoxl_io itself)

    But when we try to build it, it raises the following error:

    In /usr/include there is a file called modal_pipe_common.h, but the error remains.

    I also don't understand why the path in the error is: usr/include/c_library_v2/../modal_pipe_server.h, and not: usr/include/modal_pipe_server.h

    Is placing our script inside libvoxl_io like this the right path?
    How can we fix the error?

Log in to reply