Skip to content

Setter function do not work #65

@shubham9436

Description

@shubham9436

Subject of the issue

I am trying to retrieve and set the parameters but only retrieve part works and setter functions (for e.g setDynamicModel(), enableGNSS(), setVal32()) always fail. setNavigationFrequency() works but I need to call getNavigationFrequency() twice to get the changed value. I have checked in u-center Windows Application and it works well. I am able to change the parameters.

Your workbench

  • I am using SparkFun GPS-RTK-SMA Breakout - ZED-F9P.
  • I am not able to figure out the hardware version. I hope the image helps.
    1
  • I am using https://github.com/sugbuv/Ublox_Linux_Library to run the library on Linux Environment. I am using Ubuntu and the development board is directly powered by laptop using a type-C cable.

Steps to reproduce

I follow the commands given in https://github.com/sugbuv/Ublox_Linux_Library. The getter functions (for eg. getVal32(), getDynamicModel(), isGNSSenabled(), ) work great. But setter functions do not work at all. Only setNavigationFrequency() works but to get the changed value I need to call getNavigationFrequency() twice. I have tried out the following code. I have commented everything for now. I have checked in u-center Windows Application and it works well. I am able to change the parameters.

#include "SparkFun_u-blox_GNSS_Arduino_Library.h"
#include <iostream>
#include<unistd.h>

unsigned int microsecond = 1000000;

using namespace std;
SFE_UBLOX_GNSS myGNSS;

int main(__attribute__((unused)) int argc, char **argv) {
    Stream seriComm("/dev/ttyACM0");
    seriComm.begin(115200);
    if (!seriComm.isConnected()) {
        printf("Ublox is not connected. Please connect ublox GNSS module and try again...\n");
        return 0;
    }

    myGNSS.begin(seriComm);

//    if (myGNSS.getPVT()) {
//        printf("%02d/%02d/%02d %02d:%02d:%02d %d:%d\n", myGNSS.getDay(), myGNSS.getMonth(), myGNSS.getYear(),
//               myGNSS.getHour(), myGNSS.getMinute(), myGNSS.getSecond(),
//               myGNSS.getMillisecond(), myGNSS.getNanosecond());
//        printf("Latitude                : %2.8f (deg)\n", myGNSS.getLatitude() * 1e-7);
//        printf("Longitude               : %2.8f (deg)\n", myGNSS.getLongitude() * 1e-7);
//        printf("Altitude                : %d (mm)\n", myGNSS.getAltitude());
//        printf("Altitude MSL            : %d (mm)\n", myGNSS.getAltitudeMSL());
//        printf("SIV                     : %d\n", myGNSS.getSIV());
//        printf("PDOP                    : %f\n", myGNSS.getPDOP() * 1e-2);
//        printf("Fix type                : %d\n", myGNSS.getFixType());
//        printf("Ground Speed            : %d\n", myGNSS.getGroundSpeed());
//        printf("VelN                    : %08d (mm/s)\n", myGNSS.getNedNorthVel());
//        printf("VelE                    : %08d (mm/s)\n", myGNSS.getNedEastVel());
//        printf("VelD                    : %08d (mm/s)\n", myGNSS.getNedDownVel());
//        printf("VAcc                    : %08d (mm)\n", myGNSS.getVerticalAccEst());
//        printf("HAcc                    : %08d (mm)\n", myGNSS.getHorizontalAccEst());
//        printf("SpeedAccEst             : %08d (mm/s)\n", myGNSS.getSpeedAccEst());
//        printf("HeadAccEst              : %08d (degrees * 10^-5)\n", myGNSS.getHeadingAccEst());
//        printf("HeadVehValid            : %s\n", myGNSS.getHeadVehValid() ? "true" : "false");
//        printf("HeadVeh                 : %08d (degrees * 10^-5)\n", myGNSS.getHeadVeh());
//        printf("MagDec                  : %08d (degrees * 10^-2)\n", myGNSS.getMagDec());
//        printf("MagAcc                  : %08d (degrees * 10^-2)\n", myGNSS.getMagAcc());
//        int solnType = myGNSS.getCarrierSolutionType();
//        if (solnType == 0) printf("### No RTK Fix yet ###\n");
//        else if (solnType == 1) printf("&&& DGNSS/Float &&&\n");
//        else if (solnType == 2) printf("*** DGNSS/Fix ***\n");
//        printf("\n--------------------------------------------------------\n");
//    }

//     GNSS Setting

//##########################################
//------------------------------------------
// set Navigation Frequency
//------------------------------------------
//    int i = 0;
//    while (!myGNSS.setNavigationFrequency(1)) {
//        usleep(0.5 * microsecond);
//        cout << "delay" << endl;
//        i += 1;
//        if (i > 10) {
//            break;
//        }
//    }
//    myGNSS.getNavigationFrequency();
//    cout << unsigned(myGNSS.getNavigationFrequency()) << endl;
//##########################################


//    myGNSS.saveConfiguration();
    //    int i = 0;
//    while (!myGNSS.setNavigationFrequency(1)) {
//        usleep(0.5 * microsecond);
//        cout << "delay" << endl;
//        i += 1;
//        if (i > 10) {
//            break;
//        }
//    }
//    uint32_t currentUART2Baud = myGNSS.getVal32(UBLOX_CFG_UART2_BAUDRATE);
//    cout<<"currentUART2Baud: "<<currentUART2Baud<<endl;
//    bool response = true;
//    if (currentUART2Baud != 57600)
//    {
//        response &= myGNSS.setVal32(UBLOX_CFG_UART2_BAUDRATE, 57600);
//        if (!response)
//            cout<<"SetVal failed"<<endl;
//        else
//            cout<<"SetVal succeeded"<<endl;
//    }
//    else
//        cout<<"No baud change needed";
//
//    cout<<"Done";
//    myGNSS.setDynamicModel(DYN_MODEL_STATIONARY);
//    while (!myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GALILEO)) {
//        cout << "delay enableGNNS" << endl;
//        usleep(0.1 * microsecond);
//    }
//    while (!myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_GPS)){
//        cout << "delay isEnabled" << endl;
//        usleep(0.1 * microsecond);
//    }
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_GPS) << endl;
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_BEIDOU) << endl;
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_GALILEO) << endl;
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_GLONASS) << endl;
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_IMES) << endl;
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_QZSS) << endl;
//    cout << myGNSS.isGNSSenabled(SFE_UBLOX_GNSS_ID_SBAS) << endl;

    return 1;
}

Expected behavior

Setter functions should change the respective parameters.

Actual behavior

Setter functions do not change the respective parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions