Type of FMT messages

Hi!

I’m trying to parse mavlink messages and create a log file (.log) that mission planner can understand.
Log files starts with the definition of each message and then It has the messages. The file looks like:

FMT, 128, 89, FMT, BBnNZ, Type,Length,Name,Format,Columns
FMT, 130, 50, GPS, QBIHBcLLeffffB, TimeUS,Status,GMS,GWk,NSats,HDop,Lat,Lng,Alt,Spd,GCrs,VZ,Yaw,U
GPS, 205599926, 3, 215463999, 2197, 13, 0.75, 39.000000, -7.00000, 22.44, 0.02408319, 138.3665, 0.054, 0, 1

We can see the type of GPS message is 130. How it is calculated?

I readed some part of the ardupilot code.
In the file AP_GPS.cpp (line 2090, code) , there is a struct called log_GPS. In the header, it is specified the id which is LOG_GPS_MSG = 86u. But this id is not equal to 130. How is calculated the type of each message?

Thanks in advanced.

Hello Nazaret,

I am not sure if I understand your doubt, but why do you want to convert mavlink messages to a log? Are you aware that MP saves a telemetry log that can be accessed in your documents folder just as it is done with regular log you download from your drone? And this .tlog files can be accessed with MP and this link:

QGC also have a similar mechanism to provide the tlogs, you just have to enable it under App Settings.

Hello Bruno,

I tried to make a tlog just by saving the mavlink messages I received in a file. But it seems that it didn’t work because the file was read very fast and the GCS didn’t show the GPS.

Also I have custom mavlink messages (that I created) and I don’t know how it will interpret them. That’s why I’m trying to parse from mavlink to a log file.

Thank you,

Nazaret.

Now I see your problem… but probably it will save labeled as unknown or something like this… but indeed, it is always a good practice to encode your custom mav messages in messages created for user specific purposes inside MAVLink Common Message. Take a look NAMED_INT, NAMED_FLOAT and DEBUG, so this way your GCS can properly recognize and label these messages and as soon as you are clear about what to find in these messages, it should be pretty straightforward to extract information from them.

Thank you.

I needed to implement the MAVLink messages that’s why i have custom messages. If i use those labels, It may recognize all the “unknown message” as the same, but i would like to differentiate among them because when I load the log in ardupilot, I can choose which message i want to see its values.

I read this Adding a new log message but i am not using ardupilot to do the log file. I just want that ardupilot can understand my log file.

What can i do?

Thanks,
Nazaret.

Ok Nazareth,

I am afraid I am not able to help you more than this. But both Ardupilot and GCSs based in MAVLink messages (like QGC and MP) should recognize these labels. I always use this kind of MAVLink message inside common protocol and works pretty fine when I open the mavlink inspector embedded on theses GCSs.

If I understand it right, you need to interpret these custom messages in ardupilot embedded firmware? If so, you should add parsers for these custom messages inside your embedded firmware source code. That’s what you want to do?

Hello Bruno,
I’ll try to explain myself better.

I have a GCS witch receives MAVLink messages (common messages and custom messages). I want to do a program to record all the MAVLink messages that GCS receives. This program will create a log file that can be detected by mission planer so mission planner can show graphs with the value of the selected message.

If I use the labels that you said, i don’t know how to distinguish the messages. Is there any way to do it?

Thanks in advance,
Nazaret.

Hello Nazareth,

I`m sorry I do not know how to help you… but this kind of generic use message I shownt you should be recognized by the mavlink inspector of your GCS.

Try to use this tool to analyze your tlog:

At Plot Individual Field menu you should see the label for these messages I suggested you.

Hi,

When I check the log file (only with generic messages) it’s Ok. The problem is when I try to introduce custom mavlink messages.

Anyway thanks Bruno,

Nazaret.

Hello Nazaret,

I’m afraid I can’t help you more with this. I am really out of new ideas.

Hi Bruno,

Thanks you anyway.