Hello to everyone, I am working on a project where i want to send custom messages and command to flight controller via python script and show the results in mission planner. I am also using MAVproxy. python script is sending commands via udp and mavproxy is forwarding the commands to mission planner. for now I have written a script that changes the mode from GUIDED to STABILIZE and vice versa. I can clearly see on mission planner that mode is changing but I cant see in Mavlink Inspector. I faced the same issue when i wrote the custom message and send it using " master.mav.named_value_float_send", I could not see in mavlink inspector. I can see the modes in Mavproxy console meaning my python code is running successfully.
I asked GPT, didn’t get much of a help. I went to other forums for insights but didn’t get much.
Any insights would be great.
Any insights would be helpful.
following is the MAVproxy command.
python -m MAVProxy.mavproxy --master=COM5 --baudrate=115200 --out=udp:127.0.0.1:14550 --out=udp:127.0.0.1:14551
And My Python code is
from pymavlink import mavutil
import time
udp_ip=‘127.0.0.1’
udpin=“0.0.0.0”
udp_port=14550
master = mavutil.mavlink_connection(f’udp:{udp_ip}:{udp_port}')
master.wait_heartbeat()
print(“Connected to Pixhawk”)
def set_mode(mode):
mode_id = master.mode_mapping()[mode]
master.mav.set_mode_send(
master.target_system,
mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
mode_id
)
while True:
Change to GUIDED mode
set_mode("STABILIZE")
print("Flight mode changed to STABILIZE")
time.sleep(5)
set_mode("GUIDED")
print("Flight mode changed to GUIDED")
time.sleep(5)