I have recently started using MAVProxy. It is great, allowing control from multiple GCS along with a command-line interface. I am currently trying to set the 'mode' programatically. Browsed a bit and found pymavlink, so started about making a few changes - I am able to read messages sent by MAVProxy, but am unable to set the mode to 'AUTO'. This is what I have done so far:
- Generated a mavlink.py using message_definitions/v1.0/ardupilotmega.xml (using the mavlink code base).
- Opened a UDP socket that listens on a port known to MAVProxy (specified the address using --out option of MAVProxy).
- Created a 'MAVLink' object using the UDP socket (step 2).
- Wait for any message from MAVProxy to obtain the address of the remote end. Related code snippet:
data_from_mavproxy,address_of_mavproxy = mavproxy_sock.recvfrom (1024)
decoded_message = mav_obj.decode(data_from_mavproxy)
msg_id = decoded_message.get_msgId()
- Once I obtain the address, I am trying to set the mode using the following snippet:
msg = mav_obj.set_mode_encode(1, 92, 0)
I made sure that the message is actually sent (using tcpdump), however there is no mode change.
Can you please suggest what I may be doing wrong/missing?
You can enter auto mode by typing "auto" into the MAVProxy prompt:
You may need to arm it first though