Unable to set mode to 'AUTO' using MAVlink

Hi group,

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:

  1. Generated a mavlink.py using message_definitions/v1.0/ardupilotmega.xml (using the mavlink code base). 
  2. Opened a UDP socket that listens on a port known to MAVProxy (specified the address using --out option of MAVProxy).
  3. Created a 'MAVLink' object using the UDP socket (step 2).
  4. 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()

  5. 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)
           mavproxy_sock.sendto(msg.get_msgbuf(),(address_of_mavproxy))

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? 

Thanks,

Kasyap

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

Join diydrones

Email me when people reply –

Replies

This reply was deleted.

Activity

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