Mavlink Control in SITL over UDP interface - C language

20 views
Skip to first unread message

Martin Paques

unread,
Apr 9, 2025, 8:52:17 AMApr 9
to MAVLink
Hello everyone,
I hope you're doing well, and thank you for welcoming me into the MAVLINK community.
I'm still relatively new to using MAVLink in C (I previously used it with Python via DroneKit), and I'm having trouble achieving my goal.
In short, I want to create a program with two threads: one for receiving messages and the other for sending commands to change the altitude.
I have already created a program that compiles and works correctly, allowing me to connect to my SITL.
At the moment, I simply run the sim_vehicle.py script from ArduCopter and connect through the default UDP port.
When I execute my program, I can see the messages sent by the flight controller, but I can't change the altitude. However, the drone has taken off and is in "Guided" mode. Do you have any suggestions or ideas on how to fix this?

Thanks in advance,

Martin
udp_example_dualThread.c

Hamish Willee

unread,
Apr 10, 2025, 5:50:07 PMApr 10
to MAVLink
You're streaming the messages to control the setpoint, so that's good. Normally that is the problem :-)

This is really an ardupilot specific question - "why does it not obey my commands" and not generic MAVLink (provided you know the message is being received). Different flight stacks have subtle differences in their guided/offboard modes, and which combinations are supported. 
I suggest you post it on the ArduPilot discussion boards in the MAVLink channel. Include your example, but also information about what vehicle you are testing and what release version of ardupilot.
Reply all
Reply to author
Forward
0 new messages