Dear Forum,
My goal is to have an external sensor, connected through serial port to my flight controller with PX4 in it, and use it to instruct the flight controller via mavlink messages.
My first development stage is the SITL.
MY SETUP
At the moment I have:
- My sensor connected through serial to my pc
- In my pc i have jmavsim running, version belonging to commit 310cbbed from the 13rd of June '25. This is my simulated flight controller.
- Mavproxy forwarding the serial data to an udp port
- QGroundControl running and displaying my simulation
MY PROBLEM AND INVESTIGATION
I achieved already the possibility to instruct the simulated flight controller with mavlink messages from my sensor. I can arm, change mode, takeoff.
What I am trying to achieve is to switch to offboard mode and i am currently failing. Once I try to send the set command for the offboard while flying, via mavlink protocol, i receive
ERROR [simulator_mavlink] poll timeout 0, 22
For this, i already realized there is a bug.
I also tried already to apply this configuration, with no luck.
Important to say, I was using a custom frame, i just recently switched to a default quadcopter through QGC.
I tried to follow the sequence of commands set at this link, just the order of commands since i am not using mavros or any other layer on top of the raw mavlink messages, this didn’t led me to the wanted result.
To set the offboard mode, through the mavlink v2 C libraries, i am setting a “SET MODE” command with the following parameters
Offboard: base_mode:209, main_mode:6, sub_mode:0
I don’t know in which conditions but when i tried to repeatedly send, from my sensor, a SET MODE command with these parameters i succeeded once… and never again.
MY GOAL
I would like to know:
- How do i enter in offboard mode both when i am flying and when i am not flying yet
- If i want to try to control my drone while flying through my sensor, from what i understood, I necessarily need to switch to offboard mode. Is this correct? Is there any alternative to this mode?
- If the quadcopter does not support the offboard mode, how can I control it with mavlink messages while flying?
ADDITIONAL INFO
I already read and tried the post Offboard mode and mavlink message for this mode.
Already read and tried OFFBOARD Mode not working in SITL
Just today, I was able through my sensor to arm and set the takeoff of my simulated drone, then thorugh the jmavsim commander i ran
commander mode offboard
this succeded but i then lost connection with the board and i got the classic
ERROR [simulator_mavlink] poll timeout 0, 22
Thanks to all the people who will try to help or address me to the solution.
Cheers