Hello, i want to change the Flight Mode via Python (pymavlink) and a companion pc, but it doesn’t working.
ArduCopter 3.5.2 with Pixhawk and the latest pymavlink library on the Raspberry Pi.
It’s possible to change the Flight Mode via the Mission Planner and the RC but not over the Mavlink-Commands.
Primary I want to use the Guided Mode. But also when I want to change in Alt_Hold it’s not possible.
With the Mission Planner no problem.
When I use the follow commands from the library it’s possible to change in RTL or in LOITER
self.mav.command_long_send(self.target_system, self.target_component, mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 0, 0, 0, 0, 0, 0, 0, 0)
self.mav.command_long_send(self.target_system, self.target_component, mavlink.MAV_CMD_NAV_LOITER_UNLIM, 0, 0, 0, 0, 0, 0, 0, 0)
But the follow command doesn’t work for me:
self.mav.command_long_send(self.target_system, self.target_component,
mavlink.MAV_CMD_DO_SET_MODE, 0, mode, custom_mode, custom_sub_mode, 0, 0, 0, 0)
I tried 89 Dez for mode (base_mode) and 4,5 for custom_mode but no change is visible.
What I’m doing wrong?
And which command is used by the Mission Planner in the SourceCode?