public byte[] arm_disarm() { MAVLink.mavlink_command_long_t req = new MAVLink.mavlink_command_long_t();//定义req为 MAVLink.mavlink_command_long_t类,填充常命令的数据包 req.target_system = 1; req.target_component = 1; req.command = (ushort)MAVLink.MAV_CMD.COMPONENT_ARM_DISARM; //‘COMPONENT_ARM_DISARM’代表你要发送什么类的信息(此处为解锁信息),可自己选择(看类里有多少种) //req.command = (ushort)MAVLink.MAV_CMD req.param1 = armed ? 0 : 1; //此处发送解锁信息,只需用param1。其余param2—7注释掉 armed = !armed; /* * req.param2 = p2;//具体想要发送什么类型的数据,param如何设置,需要查看阿木社区中的MAV_CMD * req.param3 = p3;//跟踪的可以参考里面的fellow * req.param4 = p4; * req.param5 = p5; * req.param6 = p6; * req.param7 = p7; */ byte[] packet = mavlink.GenerateMAVLinkPacket_PX4(MAVLink.MAVLINK_MSG_ID.COMMAND_LONG, req); //把req数据包,按照mavlink协议打包成(定义了临时变量packet) //foreach (byte i in packet) //{ // Console.Write("{0:X} ", i); //} return(packet); }