Servers by jDrones

Unable to read Command Messages in Pymavlink

Hi,

I’m using pymavlink on my Edison in a Pixhawk2 to monitor the incoming commands from the Ground control station. I am trying to read the mavlink messages using pymavlink with this small script,

from pymavlink import mavutil

master = mavutil.mavlink_connection('127.0.0.1:14655', 921600)
master.wait_heartbeat()
master.mav.request_data_stream_send(master.target_system, master.target_component,
               mavutil.mavlink.MAV_DATA_STREAM_ALL, 4, 1)
while True:
   msg = master.recv_match()
   if msg:
       print msg

However, I am only seeing a subset of the mavlink messages which are the status messages like ATTITUDE, RC_CHANNELS etc. I am also able to see SET_MODE messages when I change mode using Mission Planner. However, when I arm or disarm the drone, I only see the COMMAND_ACK message and STATUSTEXT but not the MAV_CMD_COMPONENT_ARM_DISARM message or COMMAND_LONG.

What can I do to get the MAV_CMD messages?

1 Like

I am not pymavlink expert but in my opinion your pymavlink code is working just like another GroundControlStation. When you establish connection you can force custom id (as default it is 255).

Furthermore mavlink messages you are receiving is standard information send from autopilot to GS.

This is strange.

And this is normal. Your drone/plane doesn’t send COMMAND_LONG messages to GS.

In my opinion if you would like to see MAV_CMD which is send from Mission Planner to drone you need wireshark and udp sniffer https://askubuntu.com/questions/913393/sniff-udp-packets-on-a-local-port. I tried it works, but is low level. I do not recommend it you do not have a lot of time.

Servers by jDrones