I'm writing a java implementation of some mavlink messages for a college project. I can receive all messages and unpack successfully, now I'm trying to send messages and commands. I'm starting with sending a heartbeat then requesting a data stream but its not working. My code below is hardcoded and crude, but it is just meant for testing at the moment. In the code you can see every individual byte. Please let me know if something in it is wrong. I'm fairly sure the checksum is correct because I use the same method to verify checksum when receiving. I have been trying to figure this out for hours, any help would be extremely appreciated.

Heartbeat
heartbeat.jpg

Request Data Stream
stream.jpg

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

Join diydrones

Email me when people reply –

Replies

  • Hi Andrew, did you ever solve your problem?

    I am also new to Mavlink and got it working with C#, one thing I noticed is that you have a "crc extra" byte. Not sure where it fits as I don't use such a byte.

    Here are some of my packet contents that can hopefully help:

    Heartbeat: 254 9 0 255 1 0 0 0 0 0 6 3 0 0 3

    Request Data Stream (all): 254 6 16 255 1 66 20 0 1 0 0 1 242 240

  • Is your array packing right? Looks like you are trying to pack a 12 byte payload + 1 byte start marker + 2 bytes crc into 14 bytes?

    Watever it is, one approach would be to capture a live heartbeat from an APM, then set your hardcodes to be the same sequence and and payload values etc, and check you get the same binary message on the wire. This will check your CRC and packing is good.

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…