mavlink / mavlink2rest

mavlink2rest creates a REST server that provides mavlink information from a mavlink source
MIT License
78 stars 27 forks source link

M2R fails to receive some COMMAND_LONGS #98

Open Williangalvani opened 6 months ago

Williangalvani commented 6 months ago

sample script:

from pymavlink import mavutil
import time

# MAV_CMD_ACCELCAL_VEHICLE_POS command definition
MAV_CMD_ACCELCAL_VEHICLE_POS = 42424 #defined at https://mavlink.io/en/messages/common.html#MAV_CMD_SET_MESSAGE_INTERVAL
MAV_CMD_SET_MESSAGE_INTERVAL = 511 #defined at https://mavlink.io/en/messages/ardupilotmega.html#MAV_CMD_ACCELCAL_VEHICLE_POS

# needs a mavlink udp client pointing to your machines 
mavlink_connection = mavutil.mavlink_connection('udp:0.0.0.0:14550')

# Wait for the heartbeat msg to find the system ID
mavlink_connection.wait_heartbeat()
print("Heartbeat from system (system ID: %u component ID: %u)" % (mavlink_connection.target_system, mavlink_connection.target_component))

def send_cmd_long(msg):
  mavlink_connection.mav.command_long_send(
    0, # target_system (0 for broadcast)
    1, # target_component (1 as specified)
    msg, # command
    0, # confirmation
    123,
    0, # param2 (unused)
    0, # param3 (unused)
    0, # param4 (unused)
    0, # param5 (unused)
    0, # param6 (unused)
    0, # param7 (unused)
)

# this works
send_cmd_long(MAV_CMD_SET_MESSAGE_INTERVAL)
print("Good MAV_CMD_LONG message sent.")

time.sleep(3)

#this does not work
send_cmd_long(MAV_CMD_ACCELCAL_VEHICLE_POS)

print("Bad MAV_CMD_LONG message sent.")