Acerca de importar datos RTCM3 de la estación base RTK en QGC (QGroundControl) 3.4 y reenviarlos al terminal móvil del dron

#ifdef myadd # Agregué el código entre
#endif

void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
{
    // Since receiveBytes signals cross threads we can end up with signals in the queue
    // that come through after the link is disconnected. For these we just drop the data
    // since the link is closed.
    if (!_linkMgr->containsLink(link)) {
        return;
    }

//    receiveMutex.lock();
    mavlink_message_t message;
    mavlink_status_t status;

    int mavlinkChannel = link->mavlinkChannel();

    static int nonmavlinkCount = 0;
    static bool checkedUserNonMavlink = false;
    static bool warnedUserNonMavlink = false;

    for (int position = 0; position < b.size(); position++) {
        unsigned int decodeState = mavlink_parse_char(mavlinkChannel, (uint8_t)(b[position]), &message, &status);

        if (decodeState == 0 && !link->decodedFirstMavlinkPacket())
        {
            nonmavlinkCount++;
#ifdef myadd
            if (b[0]==0xD3&&b[1]==0x00){
                qDebug() <<"now it is on b1"<<b;
             RTCMMavlink * mavlink123 = new RTCMMavlink(*_toolbox);
              int blength =b.size();
              QByteArray message(b, blength);
              mavlink123->RTCMDataUpdate(message);
              break;
                   }
#endif
            if (nonmavlinkCount > 1000 && !warnedUserNonMavlink)
            {
                // 500 bytes with no mavlink message. Are we connected to a mavlink capable device?
                if (!checkedUserNonMavlink)
                {
                    link->requestReset();
                    checkedUserNonMavlink = true;
                }
                else
                {
                    warnedUserNonMavlink = true;
                    // Disconnect the link since its some other device and
                    // QGC clinging on to it and feeding it data might have unintended
                    // side effects (e.g. if its a modem)
                    qDebug() << "disconnected link" << link->getName() << "as it contained no MAVLink data";
#ifdef myadd
                    if (b[0]==0xD3&&b[1]==0x00){
                        qDebug() <<"now it is on b2"<<b;
                        RTCMMavlink * mavlink1234 = new RTCMMavlink(*_toolbox);
                        int blength2 =b.size();
                         QByteArray message2(b, blength2);
                        mavlink1234->RTCMDataUpdate(message2);
						break;
#endif
                    }
                  else{
                        QMetaObject::invokeMethod(_linkMgr, "disconnectLink", Q_ARG( LinkInterface*, link ) );
                    }
                        return;
                }
            }
        }

La fuente de los datos RTCM3 es convertir el formato UBX al formato RTCM3 a través del software RTKLIB y enviarlo a QGC a través de TCP, consulte mi artículo para conocer los pasos .
Además, recuerde agregar el archivo de encabezado RTCMMavlink.h

#define myadd
#ifdef myadd
#include "qgroundcontrol/src/GPS/RTCM/RTCMMavlink.h"
#endif

Use palabras como agregar una conexión TCP a
Inserte la descripción de la imagen aquí
la salida de la aplicación
Inserte la descripción de la imagen aquí

8 artículos originales publicados · Me gusta 11 · Visita 2925

Supongo que te gusta

Origin blog.csdn.net/weixin_44457020/article/details/103446845
Recomendado
Clasificación