William
William

Reputation: 1

MagicLane QT Position Source

I've embarked on a project involving a GPS receiver and QT, utilizing PositionSource and Magiclane. I'm currently using an example file to verify if everything works before diving into coding the entire application.

Here's the code I'm using:

// Importing necessary modules
import QtQuick 2.12
import QtQuick.Window 2.12
import GeneralMagic 2.0
import FpsCounter 1.0
import QtPositioning 5.12
import QtLocation 5.9

// Main window setup
Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Positioning")

    // Setting up PositionSource for GPS
    PositionSource {
        id: qtPositionSource
        name: "serialnmea"
        active: true
        PluginParameter { name: "serialnmea.serial_port"; value: "COM6" }
        Component.onCompleted: ServicesManager.dataSource.setPositionSource(qtPositionSource)
    }

    // Content updater setup
    property var updater: ServicesManager.contentUpdater(ContentItem.Type.RoadMap)
    Component.onCompleted: {
        ServicesManager.dataSource.setPositionSource(qtPositionSource)
        ServicesManager.settings.token = __my_secret_token;
        ServicesManager.logLevel = ServicesManager.Error;
        ServicesManager.settings.allowInternetConnection = true; // enable connection to online services
        updater.autoApplyWhenReady = true;
        updater.update();
    }

    // FPS counter setup
    FpsCounter {
        id: fpsCounter
    }

    // MapView setup
    MapView {
        id: map
        anchors.fill: parent
        viewAngle: 25
        zoomLevel: 69
        viewPerspective: MapView.ViewPerspective.View3D
        buildingsVisibility: MapView.BuildingsVisibility.Show3D
        detailsQualityLevel: MapView.DetailsQualityLevel.Medium
        gestures: MapView.Gesture.Pan | MapView.Gesture.PanEnableVelocity | MapView.Gesture.Pinch | MapView.Gesture.Rotate | MapView.Gesture.Tilt
        Text {
            anchors.left: parent.left
            anchors.top: parent.top
            text: fpsCounter.fps
        }
        Component.onCompleted: startFollowingPosition() // follow current position
    }
}

However, the application isn't registering my inputs, such as moving around, and the time it takes to display my current location on the map is unreasonably long (around 7/8 minutes after launching the app). I attempted to code an app for testing purposes, and while my inputs are registered, the time it takes to show my current location remains excessively long.

The function responsible for displaying the position, following the position and centering the position is startFollowingPosition().

I tried to debug the app for 2 days now but I can't seem to find the issue with it.

I'm running windows 10, QT 5.15.2 and the example file of the documentation of MagicLane : https://developer.magiclane.com/documentation/Qt/exampleqml_positioning.php#positioning

Any suggestions are welcome

Thanks

I've tried to run multiple times the application, sometimes its instantaneous and locate itself right after opening the app but most of the time (like 98%) it takes 7/8+ minutes (not because the GPS receiver is loading, the NMEA data is correctly sent by the GPS receiver on the COM6 port).

I tried to display the coordinates of the GPS receiver throught QT and it works too.

Upvotes: 0

Views: 84

Answers (0)

Related Questions