Extracting data using Mavlink Router and using that data in a custom app on HereLink


We are currently using an orange cube, and a herelink controller unit to control and move a robot. We are trying to make a custom app that will visualise important data such as voltage, current, battery, etc. However, im a bit confused on where to get started, i’ve done some research and found that the easiest most effecient way to extract the data is by using mavlink router - but how does this actually work? if i was doing this on linux i would do the following:

  1. download putty (or another similar software) and open up a new uart port
  2. set up mavlink router to route to the new uart port
  3. extract and store the data using C

can i follow the same concept on the herelink controller? is there a Putty like application that i can use on the herelink to open a Uart port? Or am i thinking to deep and there is a simpler solution?

You may have a look at the Herelink QGC to understand how we modified it to get all the signals from hardware

Also, the following topic discussed how Android app access to mavlink:

Hi Alvin,

Thank you for linking me that forum i took a look at it and now i have a more clear picture of how i am meant to accomplish this. so from my understanding i need to set up a UDP socket to listen to port 14552 (before i start listening i need to send a packet to establish a connection).

I still cant seem to get the data stream working though. I have created a new thread and set up a udp port - im firstly trying to send a packet to the udp port to establish the connection but it doesnt even allow this. it immediately rejects the packet and gives me a permission denies. is there a configuration or setting im meant to change in the cube pilot? any help would be appreciated.

here is the error that im getting:

this is my code:

and this is the main activity file:

on the device itself connect to 14551

how do i do this? I’m looking in the system configurations and cant find anything

Okay so i realised my code has an issue in it (i was accidentally connecting twice) and fixed up my code quality a bit. now the socket is connecting and I’m getting no errors but im not getting any packets at all. I’m also looking at my mission planner and it looks like packets are being sent correctly,

check here for a similar problem and fix

I believe the problem is the same, but we have not no fix yet

I ended up finding a solution to this issue, it turned out the issue i was having was with my settings and i ended up fixing it. But now i’ve ran into another problem, I’m receiving the packets now but i cant seem to figure out how to get them into a readable format. I’m trying to use .getdata() and ive tried all the other methods but it stills comes out as either gibberish english or the address such as [B@5a88ab1] I’ve really seemed to hit a rock wall here cant figure it out.

The message [B@5a88ab1] is just the binary being printed.

I’m developing an app in Ionic, and use an custom Plugin (that’s not working at 100% yet) to receive UDP data via telemetry, and convert the binary to malink in javascript, using a mavlink parser (mavlink - npm).

do you know if it’s possible to use this module in android studio at all?