Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QT PositionSource / MagicLane slow

QT PositionSource / MagicLane slow

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 255 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WilliamH07
    wrote on last edited by
    #1

    Hi everyone,

    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 is startFollowingPosition().

    I tried to debug the app for 3/4 hours but I can't seem to find the issue with it.
    Any suggestions are welcome
    Thanks

    W 1 Reply Last reply
    0
    • W WilliamH07

      Hi everyone,

      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 is startFollowingPosition().

      I tried to debug the app for 3/4 hours but I can't seem to find the issue with it.
      Any suggestions are welcome
      Thanks

      W Offline
      W Offline
      WilliamH07
      wrote on last edited by
      #2

      @WilliamH07 I just tried to open the app, and it's nearly instantaneous, and it immediately locates itself upon opening. However, 5 seconds later, after closing and reopening the app, it takes 7 to 8 minutes.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved