Calibrate

Hello,

I have a question about the “Calibrate” Function for GPS Sensing.

What does it do???

It doesn’t do anything at all.

5 Likes

I am using this at the start of every match. Does it work the same without calibrate and what is the point of having the function.

There are a couple of reasons why the GPS has a calibrate() class member function.

First, and really most important, is that the GPS, Inertial and gyro are all sub classes of a vex::guido class (guido being short for guidance officer), this allows any of them to be passed as a parameter to the smartdrive. The guido class, which is generally never used by customers although could be, looks like this.

namespace vex {
    class guido {
      public:
        guido(){};  
        virtual ~guido(){};
      
        // pure virtual methods that must be implemented
        virtual double angle( rotationUnits units = rotationUnits::deg ) = 0;
        virtual double heading( rotationUnits units = rotationUnits::deg ) = 0;
        virtual void   calibrate( int32_t value ) = 0;
        virtual bool   isCalibrating(void) = 0;
        virtual void   setHeading( double value, rotationUnits units ) = 0;
        virtual double rotation( rotationUnits units = rotationUnits::deg ) = 0;
        virtual void   setRotation( double value, rotationUnits units ) = 0;
        virtual turnType getTurnType( void ) = 0;
    };
};

It has no direct functionality, but has a number of pure virtual methods that must be implemented by any other class derived from it, hence the GPS has to implement a calibrate method.

Secondly, at one point during development, there was a thought that calibrate may be needed for the inertial sensor inside the GPS, turned out we didn’t need to do that, but the APIs were left incase that changed in the future.

6 Likes