How to export the ATTITUDE messages on a local UDP port

Hi all,

I’m working on a project that aims to connect QGC to a motion simulator. To do it, I use the SimTools framework that allows to add plugins to bind to racing video games or any other applications that export Roll, Pitch, Heave, Yaw, Sway and Surge data. Then, my intention is pretty simple in the principale : I try to export the ATTITUDE messages from QGroundControl toward a local UDP port (in my case :4123) to make me able to route them on the Motion Simulator Controler.
Actually, it should be simple but I’m not familiar with the Qt environment and I’m a bit confused about the way to do my patch.
As a workaround, I found the project MAVLink router that could be a good solution to catch the corresponding message but I would really like to make a proper and generic SimTools plugin that could work with any version of QGC or MAVLink.


I found the place where the message is parsed and emitted to other threads, it is in but this file seems to be deprecated :

        mavlink_attitude_t attitude;
        mavlink_msg_attitude_decode(&message, &attitude);
        quint64 time = getUnixReferenceTime(attitude.time_boot_ms);

        emit attitudeChanged(this, message.compid, QGC::limitAngleToPMPIf(attitude.roll), QGC::limitAngleToPMPIf(attitude.pitch), QGC::limitAngleToPMPIf(attitude.yaw), time);

        if (!wrongComponent)
            lastAttitude = time;

            attitudeKnown = true;
            emit attitudeChanged(this, getRoll(), getPitch(), getYaw(), time);

Would it be the right place to add a sort of socket.send() ?
Perhaps it would be better to do a connect() to a new class but I don’t really know how and where to do that…

I would suggest taking a look at MavProxy to do this.

Thank you for your reply and for your advice. I didn’t know MAVProxy and it seems to be nice to handle the MAVLink data flow and to route it.
Nevertheless, it’s not what I have to do. I have to work only with QGC and I must find a way to link it easily and directly to the simtools service thru a simple pluggin dedicated to QGC. Usally, the games have an option to send the Gauge data over UDP packet. In our case, QGC has nothing already in place to send those data. In consequence, I must find a way to do it but I’m more experimented in embeded system than in windows application… And again less in Qt application…
So, I gonna try to create a new object in charge of sending the Gauge data and to connect it to the attitudeChanged().
If my understanding is correct, I’ll declare my connect in the in Vehicle::_commonInit().

By the way, If anyone wants to help me or at least to give his view, I will appreciate.


I’m not sure I follow what you are trying to do, are you trying to connect an external process to a mavlink stream from PX4? if so you should try to avoid using QGC as a forwarder and use mavlink-router to connect something on the other side, I would also suggest using DroneCore to read telemetry data (see example here)

Example networking:

PX4 < = > MAVLink < = > mavlink-router < = > QGC
                                     \ < = > motion simulator / controller

Hi RRoche,

Actually, you perfectly understand what we are trying to do. Like I said before, your proposition is perfect if I just try to simply reach my goal with a control of my motion simulator thanks to the MAVLink messages.
But, it is not only our intention.
Actually, What we are questionning here it is : Why is there the possibility to use a Joystick through QGC to control the drone without the possibility the reproduce the behavior with a motion simulator…
What we would like to do it is to plug all interfaces with the user directly to QGC either to control and to feel the drone behavior. It would help to get an immersive user experience with a simple configuration. Also, the same configuration could work during a simulation or a replay…

Our expectation is :
[Drone] <=> PX4 <=> MAVLINK <=> QGC <=> All UI’s <=> [User]