ArduPilotMega 1.0.0 Commands

Command Structure in bytes
0 0x00	byte	Command ID
1 0x01	byte	Parameter 1
2 0x02	int		Parameter 2
3 0x03	..
4 0x04	long	Parameter 3
5 0x05	..
6 0x06	..
7 0x07	..
8 0x08	long	Parameter 4
9 0x09	..
10 0x0A	..
11 0x0B	..

0x00		Reserved
....
0x0F		Reserved

***********************************
Commands 0x10 to 0x2F are commands that have a end criteria, eg "reached waypoint" or "reached altitude"
***********************************
Command ID	Name						Parameter 1			Altitude			Latitude			Longitude
0x10		CMD_WAYPOINT				-					altitude			lat					lon
0x11		CMD_LOITER (indefinitely)	-					altitude			lat					lon
0x12		CMD_LOITER_N_TURNS			turns				altitude			lat					lon
0x13		CMD_LOITER_TIME				time (seconds*10)	altitude			lat					lon
0x14		CMD_RTL						-					altitude			lat					lon
0x15		CMD_LAND					-					altitude			lat					lon
0x16		CMD_TAKEOFF					angle				altitude			-					-
0x17		CMD_ALTITUDE				-					altitude			-					-
0x18		CMD_R_WAYPOINT				-					altitude			rlat				rlon
0x19		CMD_TARGET					-					altitude			lat					lon


***********************************
May Commands - these commands are optional to finish
Command ID	Name						Parameter 1			Parameter 2			Parameter 3			Parameter 4
0x20		CMD_DELAY					-					-					time (milliseconds) -
0x21		CMD_CLIMB					rate (cm/sec)		alt (finish)		-					-
0x22 		CMD_LAND_OPTIONS			pitch deg			airspeed m/s, 		throttle %, 		distance to WP
0x23		CMD_ANGLE					angle				speed				direction (-1,1)	rel (1), abs (0)


***********************************
Unexecuted commands >= 0x20 are dropped when ready for the next command <= 0x1F so plan/queue commands accordingly!
For example if you had a string of 0x21 commands following a 0x10 command that had not finished when the waypoint was 
reached, the unexecuted 0x21 commands would be skipped and the next command <= 0x1F would be loaded
***********************************
Now Commands - these commands are executed once until no more new now commands are available
0x31		CMD_RESET_INDEX
0x32		CMD_GOTO_INDEX				index				repeat count
0x33		CMD_GETVAR_INDEX			variable ID
0x34		CMD_SENDVAR_INDEX			off/on = 0/1
0x35		CMD_TELEMETRY				off/on = 0/1

0x40		CMD_THROTTLE_CRUISE 		speed
//0x41		CMD_AIRSPEED_CRUISE 		speed
0x44		CMD_RESET_HOME									altitude			lat					lon

0x60		CMD_KP_GAIN					array index			gain value*100,000	
0x61		CMD_KI_GAIN					array index			gain value*100,000	
0x62		CMD_KD_GAIN					array index			gain value*100,000	
0x63		CMD_KI_MAX					array index			gain value*100,000	
0x64		CMD_KFF_GAIN				array index			gain value*100,000	
	
0x70		CMD_RADIO_TRIM				array index			value
0x71		CMD_RADIO_MAX				array index			value
0x72		CMD_RADIO_MIN				array index			value
0x73		CMD_ELEVON_TRIM				array index			value	(index 0 = elevon 1 trim, 1 = elevon 2 trim)
0x75		CMD_INDEX	    			index 

0x80		CMD_REPEAT					type				value				delay in sec		repeat count
0x81		CMD_RELAY					(0,1 to change swicth position)
0x82		CMD_SERVO					number				value