Is MAV_CMD_DO_SEND_SCRIPT_MESSAGE unsupported on copter 4.5?


I am currently developing a python script to send mavlink messages to the drone.
I have sent message MAV_CMD_DO_AUX_FUNCTION with success, but when I change it to MAV_CMD_DO_SEND_SCRIPT_MESSAGE the result field of COMMAND_ACK returns a 3, MAV_RESULT_UNSUPPORTED.
I have put 0 in the ID and the 3 remaining parameters.

Is MAV_CMD_DO_SEND_SCRIPT_MESSAGE not supported in Ardupilot 4.5?

1 Like

Hi @DXR13KE,

@iampete will know best but from what I can see from the PR and looking at the code, this command is only supported as a mission command. It is not supported as an “immediate” command sent by a ground station or companion computer.

Also can you just confirm that SCR_ENABLE = 1? I’m sure it is but just to be sure. Also if you could just confirm how the command is being sent that would be great.

Correct, its a mission command only. Scripting does support MAVLInk parsing, so you could parse it from the MAVLink stream in the script its self.

We have a example here:

1 Like

Thank you for the kind and informative responses.

SCR_ENABLE is at 1.

I am working on adding out of the ordinary sensors and actuators to drones. I have successfully made the drone “talk” with an esp32 via i2c and vice versa. I am currently using MAV_CMD_DO_AUX_FUNCTION, but this is very limiting. I would love to send more data, I saw that MAV_CMD_DO_SEND_SCRIPT_MESSAGE allows for 1 int and 3 floats.
I am testing this with pymavlink.
The code is as follows:

import time
import sys
from pymavlink import mavutil

serial_port = "COM7"  # Replace with your serial port
### Connect to Mission Planner
the_connection = mavutil.mavlink_connection(serial_port, baudrate=57600)

# Wait for the first heartbeat 
#   This sets the system and component ID of remote system for the link
print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component))

# Once connected, use 'the_connection' to get and send messages

the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_DO_AUX_FUNCTION  ,0,300,2,0,0,0,0,0)

msg = the_connection.recv_match(type="COMMAND_ACK",blocking=True)


the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_DO_AUX_FUNCTION  ,0,300,0,0,0,0,0,0)
##the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_DO_SEND_SCRIPT_MESSAGE  ,0,300,0,0,0,0,0,0)

msg = the_connection.recv_match(type="COMMAND_ACK",blocking=True)


Is there a similar command that i can use for this situation?

Hi @DXR13KE,

That’s not much information to go on but perhaps the NAMED_VALUE_FLOAT or NAMED_VALUE_INT messages would be useful.

Thank you.
I will search a way to send those
For now I only know how to send long command messages.

1 Like