class mrpt::hwdrivers::CGyroKVHDSP3000

Overview

A class for interfacing KVH DSP 3000 gyroscope with an assynchronous serial communication (product SN : 02-1222-01).

It uses a serial port connection to the device. The class implements the generic sensor class. See also the application “rawlog-grabber” for a ready-to-use application to gather data from the scanner. The generated observation is a CObservationIMU, but only the yaw angular velocity and the absolute yaw position are are set in the vector CObservationIMU::rawMeasurements. The sensor process rate is imposed by hardware at 100Hz. For now, this sensor is only supported on posix system.

   PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
  -------------------------------------------------------
    [supplied_section_name]
     process_rate = 100             ; MUST be 100 Hz.
     pose_x=0       ; Sensor 3D position relative to the robot (meters)
     pose_y=0
     pose_z=0
     pose_yaw=0 ; Angles in degrees
     pose_pitch=0
     pose_roll=0
     sensorLabel = <label> ; Label of the sensor
     COM_port_LIN   = /dev/ttyUSB0       ; COM PORT in LINUX
     operatingMode = <"rate"/"integrated", "incremental">  ; Default mode is
*Rate.

In most of the communs applications, this class will be used as :

CGyroKVHDSP3000 kvh;
/// ...
CConfigFile conf("conf.ini");
/// ...
kvh.loadConfig_sensorSpecific(conf, "KVH");
/// ...
while(1) {
  kvh.doProcess();
      TListObservations rateObs;
  kvh.getObservations(rateObs);
      // ....
#include <mrpt/hwdrivers/CGyroKVHDSP3000.h>

class CGyroKVHDSP3000: public mrpt::hwdrivers::CGenericSensor
{
public:
    // construction

    CGyroKVHDSP3000();

    // methods

    virtual void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase& configSource, const std::string& iniSection);
    virtual void doProcess();
    virtual void initialize();
    void resetIncrementalAngle();
    void changeMode(GYRO_MODE _newMode);
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CGenericSensor> Ptr;
    typedef std::multimap<mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr> TListObservations;
    typedef std::pair<mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr> TListObsPair;

    // enums

    enum TSensorState;

    // methods

    virtual const mrpt::hwdrivers::TSensorClassId* GetRuntimeClass() const = 0;
    TSensorState getState() const;
    double getProcessRate() const;
    std::string getSensorLabel() const;
    void setSensorLabel(const std::string& sensorLabel);
    void enableVerbose(bool enabled = true);
    bool isVerboseEnabled() const;
    CGenericSensor& operator = (const CGenericSensor&);
    virtual void loadConfig(const mrpt::config::CConfigFileBase& configSource, const std::string& section);
    virtual void initialize();
    virtual void doProcess() = 0;
    virtual TListObservations getObservations();
    virtual void setPathForExternalImages(] const std::string& directory);
    virtual void setExternalImageFormat(const std::string& ext);
    virtual void setExternalImageJPEGQuality(const unsigned int quality);
    virtual unsigned int getExternalImageJPEGQuality() const;
    static void registerClass(const TSensorClassId* pNewClass);
    static CGenericSensor* createSensor(const std::string& className);
    static Ptr createSensorPtr(const std::string& className);

Construction

CGyroKVHDSP3000()

Constructor.

Methods

virtual void loadConfig_sensorSpecific(
    const mrpt::config::CConfigFileBase& configSource,
    const std::string& iniSection
    )

See the class documentation at the top for expected parameters.

virtual void doProcess()

This method will be invoked at a minimum rate of “process_rate” (Hz)

Parameters:

This

method must throw an exception with a descriptive message if some critical error is found.

virtual void initialize()

Turns on the KVH DSP 3000 device and configure it for getting orientation data.

you must have called loadConfig_sensorSpecific before calling this function.

void resetIncrementalAngle()

Send to the sensor the command ‘Z’ which reset the integrated angle.

(in both rate mode and incremental, this function has no effect)