In air or ground status: Extended_sys_state

I am trying to get landed_state from EXTENDED_SYS_STATE using command_long_send() but I am not getting response.

self.mavlink.mav.command_long_send(
self.mavlink.target_system, self._mavlink.target_component,
mavutil.mavlink.MAV_CMD_SET_MESSAGE_INTERVAL, 0,
245,
0, 0, 0, 0, 0, 0)
print(self.mavlink.recv_match())

I don’t see any output or landed_state status being changed in mission planner.

I tried with
self.mavlink.mav.extended_sys_state_send(mavutil.mavlink.MAV_VTOL_STATE_FW, mavutil.mavlink.MAV_LANDED_STATE_IN_AIR)

But it doesn’t change the status or I don’t see landed_state changed in mission planner.

Welcome to the Ardupilot community!

I just tried your example with the simulator and had to set the rate to 1e6 (1 Hz) and then it worked. With this I could see the EXTENDED_SYS_STATE message being printed to the terminal window:

import time
# Import mavutil
from pymavlink import mavutil

# Connect to SITL
master = mavutil.mavlink_connection('tcp:127.0.0.1:5760')

# Make sure the connection is valid
master.wait_heartbeat()

master.mav.command_long_send(
        master.target_system, master.target_component,
        mavutil.mavlink.MAV_CMD_SET_MESSAGE_INTERVAL, 0,
        245, 
        1e6, 
        0, 0, 0, 0, 
        0, 
    )

# Get some information !
while True:
    try:
        print(master.recv_match().to_dict())
    except:
        pass
    time.sleep(0.1)
2 Likes

I am not getting EXTENDED_SYS_STATE message from recv_match()
Can you share the screenshot of your output?

I am using udp connection with my mission planner and it is connected. Am I missing something which needs to be configured?

Here is the output I got:

Do you get at least the heartbeat message?

Yes I am getting heartbeat message and tried arm and disarm commands which work fine using command_long_send.

But I am not getting EXTENDED_SYS_STATE either with command_long_send() or
self.mavlink.mav.extended_sys_state_send()

{‘mavpackettype’: ‘HEARTBEAT’, ‘type’: 2, ‘autopilot’: 3, ‘base_mode’: 81, ‘custom_mode’: 0, ‘system_status’: 3, ‘mavlink_version’: 3}

This is my heartbeat message output. Is there any issue with type?

I don’t think this should be an issue.

Which firmware version is your simulator running?

image

I am using exactly the same version.

Okay. I found EKF_STATUS_REPORT in my messages which is not present in Messages (common) · MAVLink Developer Guide

But it is present in ardupilotmega.xml · MAVLink Developer Guide which doesn’t have EXTENDED_SYS_STATE.

Is it something which is not giving me EXTENDED_SYS_STATE message?
How can I change messages to be picked from common instead of ardupilotmega?

if you look at the top of ardupilotmega.xml you will see that it actually includes common.xml so you should have those messages also.

I wonder if you are not maybe catching the heartbeat from Mission Planner and then using it’s system and component id when making the request to send EXTENDED_SYS_STATE. It would make sense that MP will not send this message as it’s a GCS. What happens when you hard-code the system and component id’s to 1, like so:

master.mav.command_long_send(
        1, 1,
        mavutil.mavlink.MAV_CMD_SET_MESSAGE_INTERVAL, 0,
        245, 
        1e6, 
        0, 0, 0, 0, 
        0, 
    )

Still the same issue.

What simulation are you using?
I am using a udpin connection with quad model multirotor simulation.

I start the simulator through MP as a quad (but I think for the terminal screenshot I posted previously I started it from the command line which is why the type was 0). Mission Planner then automatically connects to the simulated quad through a TCP connection on port 5760 which is bound to serial0.
Serial2 is bound to port 5762 and which is the one I connect to with ‘tcp:127.0.0.1:5762’. If I start from the command line and do not connect MP then I use ‘tcp:127.0.0.1:5760’.

How do you get MP to bind UDP connection to the ports?