Sending Commands to ArduPilot Mega

I am attempting to send a navigate to waypoint command to the autopilot over the telemetry port. I believe I have the general method correct; however, I'm unsure of what some of the necessary values are. The steps I'm following are as below:

Send Preamble 1 (0x34)
Send Preamble 2 (0x44)
Send Payload Length (0x11) (17 in decimal)
Send Message ID (0x21) (command upload)
Send Message Version (0x01) (arbitrary at this point I believe)
Send Payload
Send Calculated Checksum

Now the payload is 17 bytes long according to the Wiki and consists of:

Action (byte) (0=insert in list, 1=execute immediately), Item number (uint16), List length (uint16), Command ID (byte), Command P1 (byte), Command P2 (int32), Command P3 (int32), Command P4 (int32). See APM Mission Commands for a list of commands

However, that is 19 bytes. Earlier when I was decoding GPS output I found out that ALT_MSL was actually a int16 instead of a int32 so I'm sticking to that assumption here which will result in a 17 byte payload.

My remaining questions are:
What exactly are the fields for Item Number and List Length?
In the case of a Command ID of (0x10), what is the Command P1 supposed to be?

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

Join diydrones

Email me when people reply –

Replies

  • Developer
    P2 , which contains altitude, was changed from 2 bytes to 4 bytes.

    Item number and list length are used if you are sending the command to be inserted into the stored mission, versus sending it for immediate execution.

    On command 0x01, P1 is currently unused.

    Please note that implementation of command uplink is still in development and all this is subject to change.
This reply was deleted.

Activity

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