VectorNav C++ Library
Public Types | Public Member Functions | Static Public Member Functions | List of all members
vn::sensors::VnSensor Class Reference

Helpful class for working with VectorNav sensors. More...

#include <sensors.h>

Inheritance diagram for vn::sensors::VnSensor:
vn::util::NoCopy

Public Types

enum  Family { VnSensor_Family_Unknown, VnSensor_Family_Vn100, VnSensor_Family_Vn200, VnSensor_Family_Vn300 }
 
typedef void(* RawDataReceivedHandler) (void *userData, const char *rawData, size_t length, size_t runningIndex)
 Defines a callback handler that can received notification when the VnSensor receives raw data from its port. More...
 
typedef void(* PossiblePacketFoundHandler) (void *userData, protocol::uart::Packet &possiblePacket, size_t packetStartRunningIndex)
 Defines the signature for a method that can receive notifications of new possible packets found. More...
 
typedef void(* AsyncPacketReceivedHandler) (void *userData, protocol::uart::Packet &asyncPacket, size_t packetStartRunningIndex)
 Defines the signature for a method that can receive notifications of when a new asynchronous data packet (ASCII or BINARY) is received. More...
 
typedef void(* ErrorPacketReceivedHandler) (void *userData, protocol::uart::Packet &errorPacket, size_t packetStartRunningIndex)
 Defines the signature for a method that can receive notifications when an error message is received. More...
 

Public Member Functions

uint32_t baudrate ()
 Returns the baudrate of the serial port connection. Note this is independent of the sensor's on-board serial baudrate setting. More...
 
std::string port ()
 Returns the name of the port the sensor is connected to. More...
 
protocol::uart::ErrorDetectionMode sendErrorDetectionMode ()
 Gets the current error detection mode used for commands sent to the sensor. Default is protocol::uart::ErrorDetectionMode::CHECKSUM. More...
 
void setSendErrorDetectionMode (protocol::uart::ErrorDetectionMode mode)
 Sets the error detection mode used by the class for commands sent to the sensor. More...
 
bool isConnected ()
 Indicates if the VnSensor is connected. More...
 
uint16_t responseTimeoutMs ()
 Gets the amount of time in milliseconds to wait for a response during read/writes with the sensor. More...
 
void setResponseTimeoutMs (uint16_t timeout)
 Sets the amount of time in milliseconds to wait for a response during read/writes with the sensor. More...
 
uint16_t retransmitDelayMs ()
 The delay in milliseconds between retransmitting commands. More...
 
void setRetransmitDelayMs (uint16_t delay)
 Sets the delay in milliseconds between command retransmits. More...
 
bool verifySensorConnectivity ()
 Checks if we are able to send and receive communication with a sensor. More...
 
void connect (const std::string &portName, uint32_t baudrate)
 Connects to a VectorNav sensor. More...
 
void connect (xplat::IPort *port)
 Allows connecting to a VectorNav sensor over a vn::common::ISimplePort. More...
 
void disconnect ()
 Disconnects from the VectorNav sensor. More...
 
std::string transaction (std::string toSend)
 Sends the provided command and returns the response from the sensor. More...
 
std::string send (std::string toSend, bool waitForReply=true, protocol::uart::ErrorDetectionMode errorDetectionMode=protocol::uart::ERRORDETECTIONMODE_CHECKSUM)
 Writes a raw data string to the sensor, normally appending an appropriate error detection checksum. More...
 
void tare (bool waitForReply=true)
 Issues a tare command to the VectorNav Sensor. More...
 
void setGyroBias (bool waitForReply=true)
 Issues a command to the VectorNav Sensor to set the gyro's bias. More...
 
void magneticDisturbancePresent (bool disturbancePresent, bool waitForReply=true)
 Command to inform the VectorNav Sensor if there is a magnetic disturbance present. More...
 
void accelerationDisturbancePresent (bool disturbancePresent, bool waitForReply=true)
 Command to inform the VectorNav Sensor if there is an acceleration disturbance present. More...
 
void writeSettings (bool waitForReply=true)
 Issues a Write Settings command to the VectorNav Sensor. More...
 
void restoreFactorySettings (bool waitForReply=true)
 Issues a Restore Factory Settings command to the VectorNav sensor. More...
 
void reset (bool waitForReply=true)
 Issues a Reset command to the VectorNav sensor. More...
 
void changeBaudRate (uint32_t baudrate)
 Issues a change baudrate to the VectorNav sensor and then reconnects the attached serial port at the new baudrate. More...
 
Family determineDeviceFamily ()
 This method will connect to the specified serial port, query the attached sensor, and determine the type of device. More...
 
void registerRawDataReceivedHandler (void *userData, RawDataReceivedHandler handler)
 Registers a callback method for notification when raw data is received. More...
 
void unregisterRawDataReceivedHandler ()
 Unregisters the registered callback method.
 
void registerPossiblePacketFoundHandler (void *userData, PossiblePacketFoundHandler handler)
 Registers a callback method for notification when a new possible packet is found. More...
 
void unregisterPossiblePacketFoundHandler ()
 Unregisters the registered callback method.
 
void registerAsyncPacketReceivedHandler (void *userData, AsyncPacketReceivedHandler handler)
 Registers a callback method for notification when a new asynchronous data packet is received. More...
 
void unregisterAsyncPacketReceivedHandler ()
 Unregisters the registered callback method.
 
void registerErrorPacketReceivedHandler (void *userData, ErrorPacketReceivedHandler handler)
 Registers a callback method for notification when an error packet is received. More...
 
void unregisterErrorPacketReceivedHandler ()
 Unregisters the registered callback method.
 
BinaryOutputRegister readBinaryOutput1 ()
 Reads the Binary Output 1 register. More...
 
void writeBinaryOutput1 (BinaryOutputRegister &fields, bool waitForReply=true)
 Writes to the Binary Output 1 register. More...
 
BinaryOutputRegister readBinaryOutput2 ()
 Reads the Binary Output 2 register. More...
 
void writeBinaryOutput2 (BinaryOutputRegister &fields, bool waitForReply=true)
 Writes to the Binary Output 2 register. More...
 
BinaryOutputRegister readBinaryOutput3 ()
 Reads the Binary Output 3 register. More...
 
void writeBinaryOutput3 (BinaryOutputRegister &fields, bool waitForReply=true)
 Writes to the Binary Output 3 register. More...
 
uint32_t readSerialBaudRate (uint8_t port)
 Reads the Serial Baud Rate register for the specified port. More...
 
void writeSerialBaudRate (const uint32_t &baudrate, uint8_t port, bool waitForReply=true)
 Writes to the Serial Baud Rate register for the specified port. More...
 
protocol::uart::AsciiAsync readAsyncDataOutputType (uint8_t port)
 Reads the Async Data Output Type register. More...
 
void writeAsyncDataOutputType (protocol::uart::AsciiAsync ador, uint8_t port, bool waitForReply=true)
 Writes to the Async Data Output Type register. More...
 
uint32_t readAsyncDataOutputFrequency (uint8_t port)
 Reads the Async Data Output Frequency register. More...
 
void writeAsyncDataOutputFrequency (const uint32_t &adof, uint8_t port, bool waitForReply=true)
 Writes to the Async Data Output Frequency register. More...
 
InsBasicConfigurationRegisterVn200 readInsBasicConfigurationVn200 ()
 Reads the INS Basic Configuration register for a VN-200 sensor. More...
 
void writeInsBasicConfigurationVn200 (InsBasicConfigurationRegisterVn200 &fields, bool waitForReply=true)
 Writes to the INS Basic Configuration register for a VN-200 sensor. More...
 
void writeInsBasicConfigurationVn200 (protocol::uart::Scenario scenario, const uint8_t &ahrsAiding, bool waitForReply=true)
 Writes to the INS Basic Configuration register for a VN-200 sensor. More...
 
InsBasicConfigurationRegisterVn300 readInsBasicConfigurationVn300 ()
 Reads the INS Basic Configuration register for a VN-300 sensor. More...
 
void writeInsBasicConfigurationVn300 (InsBasicConfigurationRegisterVn300 &fields, bool waitForReply=true)
 Writes to the INS Basic Configuration register for a VN-300 sensor. More...
 
void writeInsBasicConfigurationVn300 (protocol::uart::Scenario scenario, const uint8_t &ahrsAiding, const uint8_t &estBaseline, bool waitForReply=true)
 Writes to the INS Basic Configuration register for a VN-300 sensor. More...
 
std::string readUserTag ()
 Reads the User Tag register. More...
 
void writeUserTag (const std::string &tag, bool waitForReply=true)
 Writes to the User Tag register. More...
 
std::string readModelNumber ()
 Reads the Model Number register. More...
 
uint32_t readHardwareRevision ()
 Reads the Hardware Revision register. More...
 
uint32_t readSerialNumber ()
 Reads the Serial Number register. More...
 
std::string readFirmwareVersion ()
 Reads the Firmware Version register. More...
 
uint32_t readSerialBaudRate ()
 Reads the Serial Baud Rate register. More...
 
void writeSerialBaudRate (const uint32_t &baudrate, bool waitForReply=true)
 Writes to the Serial Baud Rate register. More...
 
protocol::uart::AsciiAsync readAsyncDataOutputType ()
 Reads the Async Data Output Type register. More...
 
void writeAsyncDataOutputType (protocol::uart::AsciiAsync ador, bool waitForReply=true)
 Writes to the Async Data Output Type register. More...
 
uint32_t readAsyncDataOutputFrequency ()
 Reads the Async Data Output Frequency register. More...
 
void writeAsyncDataOutputFrequency (const uint32_t &adof, bool waitForReply=true)
 Writes to the Async Data Output Frequency register. More...
 
vn::math::vec3f readYawPitchRoll ()
 Reads the Yaw Pitch Roll register. More...
 
vn::math::vec4f readAttitudeQuaternion ()
 Reads the Attitude Quaternion register. More...
 
QuaternionMagneticAccelerationAndAngularRatesRegister readQuaternionMagneticAccelerationAndAngularRates ()
 Reads the Quaternion, Magnetic, Acceleration and Angular Rates register. More...
 
vn::math::vec3f readMagneticMeasurements ()
 Reads the Magnetic Measurements register. More...
 
vn::math::vec3f readAccelerationMeasurements ()
 Reads the Acceleration Measurements register. More...
 
vn::math::vec3f readAngularRateMeasurements ()
 Reads the Angular Rate Measurements register. More...
 
MagneticAccelerationAndAngularRatesRegister readMagneticAccelerationAndAngularRates ()
 Reads the Magnetic, Acceleration and Angular Rates register. More...
 
MagneticAndGravityReferenceVectorsRegister readMagneticAndGravityReferenceVectors ()
 Reads the Magnetic and Gravity Reference Vectors register. More...
 
void writeMagneticAndGravityReferenceVectors (MagneticAndGravityReferenceVectorsRegister &fields, bool waitForReply=true)
 Writes to the Magnetic and Gravity Reference Vectors register. More...
 
void writeMagneticAndGravityReferenceVectors (const vn::math::vec3f &magRef, const vn::math::vec3f &accRef, bool waitForReply=true)
 Writes to the Magnetic and Gravity Reference Vectors register. More...
 
FilterMeasurementsVarianceParametersRegister readFilterMeasurementsVarianceParameters ()
 Reads the Filter Measurements Variance Parameters register. More...
 
void writeFilterMeasurementsVarianceParameters (FilterMeasurementsVarianceParametersRegister &fields, bool waitForReply=true)
 Writes to the Filter Measurements Variance Parameters register. More...
 
void writeFilterMeasurementsVarianceParameters (const float &angularWalkVariance, const vn::math::vec3f &angularRateVariance, const vn::math::vec3f &magneticVariance, const vn::math::vec3f &accelerationVariance, bool waitForReply=true)
 Writes to the Filter Measurements Variance Parameters register. More...
 
MagnetometerCompensationRegister readMagnetometerCompensation ()
 Reads the Magnetometer Compensation register. More...
 
void writeMagnetometerCompensation (MagnetometerCompensationRegister &fields, bool waitForReply=true)
 Writes to the Magnetometer Compensation register. More...
 
void writeMagnetometerCompensation (const vn::math::mat3f &c, const vn::math::vec3f &b, bool waitForReply=true)
 Writes to the Magnetometer Compensation register. More...
 
FilterActiveTuningParametersRegister readFilterActiveTuningParameters ()
 Reads the Filter Active Tuning Parameters register. More...
 
void writeFilterActiveTuningParameters (FilterActiveTuningParametersRegister &fields, bool waitForReply=true)
 Writes to the Filter Active Tuning Parameters register. More...
 
void writeFilterActiveTuningParameters (const float &magneticDisturbanceGain, const float &accelerationDisturbanceGain, const float &magneticDisturbanceMemory, const float &accelerationDisturbanceMemory, bool waitForReply=true)
 Writes to the Filter Active Tuning Parameters register. More...
 
AccelerationCompensationRegister readAccelerationCompensation ()
 Reads the Acceleration Compensation register. More...
 
void writeAccelerationCompensation (AccelerationCompensationRegister &fields, bool waitForReply=true)
 Writes to the Acceleration Compensation register. More...
 
void writeAccelerationCompensation (const vn::math::mat3f &c, const vn::math::vec3f &b, bool waitForReply=true)
 Writes to the Acceleration Compensation register. More...
 
vn::math::mat3f readReferenceFrameRotation ()
 Reads the Reference Frame Rotation register. More...
 
void writeReferenceFrameRotation (const vn::math::mat3f &c, bool waitForReply=true)
 Writes to the Reference Frame Rotation register. More...
 
YawPitchRollMagneticAccelerationAndAngularRatesRegister readYawPitchRollMagneticAccelerationAndAngularRates ()
 Reads the Yaw, Pitch, Roll, Magnetic, Acceleration and Angular Rates register. More...
 
CommunicationProtocolControlRegister readCommunicationProtocolControl ()
 Reads the Communication Protocol Control register. More...
 
void writeCommunicationProtocolControl (CommunicationProtocolControlRegister &fields, bool waitForReply=true)
 Writes to the Communication Protocol Control register. More...
 
void writeCommunicationProtocolControl (protocol::uart::CountMode serialCount, protocol::uart::StatusMode serialStatus, protocol::uart::CountMode spiCount, protocol::uart::StatusMode spiStatus, protocol::uart::ChecksumMode serialChecksum, protocol::uart::ChecksumMode spiChecksum, protocol::uart::ErrorMode errorMode, bool waitForReply=true)
 Writes to the Communication Protocol Control register. More...
 
SynchronizationControlRegister readSynchronizationControl ()
 Reads the Synchronization Control register. More...
 
void writeSynchronizationControl (SynchronizationControlRegister &fields, bool waitForReply=true)
 Writes to the Synchronization Control register. More...
 
void writeSynchronizationControl (protocol::uart::SyncInMode syncInMode, protocol::uart::SyncInEdge syncInEdge, const uint16_t &syncInSkipFactor, protocol::uart::SyncOutMode syncOutMode, protocol::uart::SyncOutPolarity syncOutPolarity, const uint16_t &syncOutSkipFactor, const uint32_t &syncOutPulseWidth, bool waitForReply=true)
 Writes to the Synchronization Control register. More...
 
SynchronizationStatusRegister readSynchronizationStatus ()
 Reads the Synchronization Status register. More...
 
void writeSynchronizationStatus (SynchronizationStatusRegister &fields, bool waitForReply=true)
 Writes to the Synchronization Status register. More...
 
void writeSynchronizationStatus (const uint32_t &syncInCount, const uint32_t &syncInTime, const uint32_t &syncOutCount, bool waitForReply=true)
 Writes to the Synchronization Status register. More...
 
FilterBasicControlRegister readFilterBasicControl ()
 Reads the Filter Basic Control register. More...
 
void writeFilterBasicControl (FilterBasicControlRegister &fields, bool waitForReply=true)
 Writes to the Filter Basic Control register. More...
 
void writeFilterBasicControl (protocol::uart::MagneticMode magMode, protocol::uart::ExternalSensorMode extMagMode, protocol::uart::ExternalSensorMode extAccMode, protocol::uart::ExternalSensorMode extGyroMode, const vn::math::vec3f &gyroLimit, bool waitForReply=true)
 Writes to the Filter Basic Control register. More...
 
VpeBasicControlRegister readVpeBasicControl ()
 Reads the VPE Basic Control register. More...
 
void writeVpeBasicControl (VpeBasicControlRegister &fields, bool waitForReply=true)
 Writes to the VPE Basic Control register. More...
 
void writeVpeBasicControl (protocol::uart::VpeEnable enable, protocol::uart::HeadingMode headingMode, protocol::uart::VpeMode filteringMode, protocol::uart::VpeMode tuningMode, bool waitForReply=true)
 Writes to the VPE Basic Control register. More...
 
VpeMagnetometerBasicTuningRegister readVpeMagnetometerBasicTuning ()
 Reads the VPE Magnetometer Basic Tuning register. More...
 
void writeVpeMagnetometerBasicTuning (VpeMagnetometerBasicTuningRegister &fields, bool waitForReply=true)
 Writes to the VPE Magnetometer Basic Tuning register. More...
 
void writeVpeMagnetometerBasicTuning (const vn::math::vec3f &baseTuning, const vn::math::vec3f &adaptiveTuning, const vn::math::vec3f &adaptiveFiltering, bool waitForReply=true)
 Writes to the VPE Magnetometer Basic Tuning register. More...
 
VpeMagnetometerAdvancedTuningRegister readVpeMagnetometerAdvancedTuning ()
 Reads the VPE Magnetometer Advanced Tuning register. More...
 
void writeVpeMagnetometerAdvancedTuning (VpeMagnetometerAdvancedTuningRegister &fields, bool waitForReply=true)
 Writes to the VPE Magnetometer Advanced Tuning register. More...
 
void writeVpeMagnetometerAdvancedTuning (const vn::math::vec3f &minFiltering, const vn::math::vec3f &maxFiltering, const float &maxAdaptRate, const float &disturbanceWindow, const float &maxTuning, bool waitForReply=true)
 Writes to the VPE Magnetometer Advanced Tuning register. More...
 
VpeAccelerometerBasicTuningRegister readVpeAccelerometerBasicTuning ()
 Reads the VPE Accelerometer Basic Tuning register. More...
 
void writeVpeAccelerometerBasicTuning (VpeAccelerometerBasicTuningRegister &fields, bool waitForReply=true)
 Writes to the VPE Accelerometer Basic Tuning register. More...
 
void writeVpeAccelerometerBasicTuning (const vn::math::vec3f &baseTuning, const vn::math::vec3f &adaptiveTuning, const vn::math::vec3f &adaptiveFiltering, bool waitForReply=true)
 Writes to the VPE Accelerometer Basic Tuning register. More...
 
VpeAccelerometerAdvancedTuningRegister readVpeAccelerometerAdvancedTuning ()
 Reads the VPE Accelerometer Advanced Tuning register. More...
 
void writeVpeAccelerometerAdvancedTuning (VpeAccelerometerAdvancedTuningRegister &fields, bool waitForReply=true)
 Writes to the VPE Accelerometer Advanced Tuning register. More...
 
void writeVpeAccelerometerAdvancedTuning (const vn::math::vec3f &minFiltering, const vn::math::vec3f &maxFiltering, const float &maxAdaptRate, const float &disturbanceWindow, const float &maxTuning, bool waitForReply=true)
 Writes to the VPE Accelerometer Advanced Tuning register. More...
 
VpeGyroBasicTuningRegister readVpeGyroBasicTuning ()
 Reads the VPE Gyro Basic Tuning register. More...
 
void writeVpeGyroBasicTuning (VpeGyroBasicTuningRegister &fields, bool waitForReply=true)
 Writes to the VPE Gyro Basic Tuning register. More...
 
void writeVpeGyroBasicTuning (const vn::math::vec3f &angularWalkVariance, const vn::math::vec3f &baseTuning, const vn::math::vec3f &adaptiveTuning, bool waitForReply=true)
 Writes to the VPE Gyro Basic Tuning register. More...
 
vn::math::vec3f readFilterStartupGyroBias ()
 Reads the Filter Startup Gyro Bias register. More...
 
void writeFilterStartupGyroBias (const vn::math::vec3f &bias, bool waitForReply=true)
 Writes to the Filter Startup Gyro Bias register. More...
 
MagnetometerCalibrationControlRegister readMagnetometerCalibrationControl ()
 Reads the Magnetometer Calibration Control register. More...
 
void writeMagnetometerCalibrationControl (MagnetometerCalibrationControlRegister &fields, bool waitForReply=true)
 Writes to the Magnetometer Calibration Control register. More...
 
void writeMagnetometerCalibrationControl (protocol::uart::HsiMode hsiMode, protocol::uart::HsiOutput hsiOutput, const uint8_t &convergeRate, bool waitForReply=true)
 Writes to the Magnetometer Calibration Control register. More...
 
CalculatedMagnetometerCalibrationRegister readCalculatedMagnetometerCalibration ()
 Reads the Calculated Magnetometer Calibration register. More...
 
float readIndoorHeadingModeControl ()
 Reads the Indoor Heading Mode Control register. More...
 
void writeIndoorHeadingModeControl (const float &maxRateError, bool waitForReply=true)
 Writes to the Indoor Heading Mode Control register. More...
 
vn::math::vec3f readVelocityCompensationMeasurement ()
 Reads the Velocity Compensation Measurement register. More...
 
void writeVelocityCompensationMeasurement (const vn::math::vec3f &velocity, bool waitForReply=true)
 Writes to the Velocity Compensation Measurement register. More...
 
VelocityCompensationControlRegister readVelocityCompensationControl ()
 Reads the Velocity Compensation Control register. More...
 
void writeVelocityCompensationControl (VelocityCompensationControlRegister &fields, bool waitForReply=true)
 Writes to the Velocity Compensation Control register. More...
 
void writeVelocityCompensationControl (protocol::uart::VelocityCompensationMode mode, const float &velocityTuning, const float &rateTuning, bool waitForReply=true)
 Writes to the Velocity Compensation Control register. More...
 
VelocityCompensationStatusRegister readVelocityCompensationStatus ()
 Reads the Velocity Compensation Status register. More...
 
ImuMeasurementsRegister readImuMeasurements ()
 Reads the IMU Measurements register. More...
 
GpsConfigurationRegister readGpsConfiguration ()
 Reads the GPS Configuration register. More...
 
void writeGpsConfiguration (GpsConfigurationRegister &fields, bool waitForReply=true)
 Writes to the GPS Configuration register. More...
 
void writeGpsConfiguration (protocol::uart::GpsMode mode, protocol::uart::PpsSource ppsSource, bool waitForReply=true)
 Writes to the GPS Configuration register. More...
 
vn::math::vec3f readGpsAntennaOffset ()
 Reads the GPS Antenna Offset register. More...
 
void writeGpsAntennaOffset (const vn::math::vec3f &position, bool waitForReply=true)
 Writes to the GPS Antenna Offset register. More...
 
GpsSolutionLlaRegister readGpsSolutionLla ()
 Reads the GPS Solution - LLA register. More...
 
GpsSolutionEcefRegister readGpsSolutionEcef ()
 Reads the GPS Solution - ECEF register. More...
 
InsSolutionLlaRegister readInsSolutionLla ()
 Reads the INS Solution - LLA register. More...
 
InsSolutionEcefRegister readInsSolutionEcef ()
 Reads the INS Solution - ECEF register. More...
 
InsAdvancedConfigurationRegister readInsAdvancedConfiguration ()
 Reads the INS Advanced Configuration register. More...
 
void writeInsAdvancedConfiguration (InsAdvancedConfigurationRegister &fields, bool waitForReply=true)
 Writes to the INS Advanced Configuration register. More...
 
void writeInsAdvancedConfiguration (const uint8_t &useMag, const uint8_t &usePres, const uint8_t &posAtt, const uint8_t &velAtt, const uint8_t &velBias, protocol::uart::FoamInit useFoam, const uint8_t &gpsCovType, const uint8_t &velCount, const float &velInit, const float &moveOrigin, const float &gpsTimeout, const float &deltaLimitPos, const float &deltaLimitVel, const float &minPosUncertainty, const float &minVelUncertainty, bool waitForReply=true)
 Writes to the INS Advanced Configuration register. More...
 
InsStateLlaRegister readInsStateLla ()
 Reads the INS State - LLA register. More...
 
InsStateEcefRegister readInsStateEcef ()
 Reads the INS State - ECEF register. More...
 
StartupFilterBiasEstimateRegister readStartupFilterBiasEstimate ()
 Reads the Startup Filter Bias Estimate register. More...
 
void writeStartupFilterBiasEstimate (StartupFilterBiasEstimateRegister &fields, bool waitForReply=true)
 Writes to the Startup Filter Bias Estimate register. More...
 
void writeStartupFilterBiasEstimate (const vn::math::vec3f &gyroBias, const vn::math::vec3f &accelBias, const float &pressureBias, bool waitForReply=true)
 Writes to the Startup Filter Bias Estimate register. More...
 
DeltaThetaAndDeltaVelocityRegister readDeltaThetaAndDeltaVelocity ()
 Reads the Delta Theta and Delta Velocity register. More...
 
DeltaThetaAndDeltaVelocityConfigurationRegister readDeltaThetaAndDeltaVelocityConfiguration ()
 Reads the Delta Theta and Delta Velocity Configuration register. More...
 
void writeDeltaThetaAndDeltaVelocityConfiguration (DeltaThetaAndDeltaVelocityConfigurationRegister &fields, bool waitForReply=true)
 Writes to the Delta Theta and Delta Velocity Configuration register. More...
 
void writeDeltaThetaAndDeltaVelocityConfiguration (protocol::uart::IntegrationFrame integrationFrame, protocol::uart::CompensationMode gyroCompensation, protocol::uart::CompensationMode accelCompensation, bool waitForReply=true)
 Writes to the Delta Theta and Delta Velocity Configuration register. More...
 
ReferenceVectorConfigurationRegister readReferenceVectorConfiguration ()
 Reads the Reference Vector Configuration register. More...
 
void writeReferenceVectorConfiguration (ReferenceVectorConfigurationRegister &fields, bool waitForReply=true)
 Writes to the Reference Vector Configuration register. More...
 
void writeReferenceVectorConfiguration (const uint8_t &useMagModel, const uint8_t &useGravityModel, const uint32_t &recalcThreshold, const float &year, const vn::math::vec3d &position, bool waitForReply=true)
 Writes to the Reference Vector Configuration register. More...
 
GyroCompensationRegister readGyroCompensation ()
 Reads the Gyro Compensation register. More...
 
void writeGyroCompensation (GyroCompensationRegister &fields, bool waitForReply=true)
 Writes to the Gyro Compensation register. More...
 
void writeGyroCompensation (const vn::math::mat3f &c, const vn::math::vec3f &b, bool waitForReply=true)
 Writes to the Gyro Compensation register. More...
 
ImuFilteringConfigurationRegister readImuFilteringConfiguration ()
 Reads the IMU Filtering Configuration register. More...
 
void writeImuFilteringConfiguration (ImuFilteringConfigurationRegister &fields, bool waitForReply=true)
 Writes to the IMU Filtering Configuration register. More...
 
void writeImuFilteringConfiguration (const uint16_t &magWindowSize, const uint16_t &accelWindowSize, const uint16_t &gyroWindowSize, const uint16_t &tempWindowSize, const uint16_t &presWindowSize, protocol::uart::FilterMode magFilterMode, protocol::uart::FilterMode accelFilterMode, protocol::uart::FilterMode gyroFilterMode, protocol::uart::FilterMode tempFilterMode, protocol::uart::FilterMode presFilterMode, bool waitForReply=true)
 Writes to the IMU Filtering Configuration register. More...
 
GpsCompassBaselineRegister readGpsCompassBaseline ()
 Reads the GPS Compass Baseline register. More...
 
void writeGpsCompassBaseline (GpsCompassBaselineRegister &fields, bool waitForReply=true)
 Writes to the GPS Compass Baseline register. More...
 
void writeGpsCompassBaseline (const vn::math::vec3f &position, const vn::math::vec3f &uncertainty, bool waitForReply=true)
 Writes to the GPS Compass Baseline register. More...
 
GpsCompassEstimatedBaselineRegister readGpsCompassEstimatedBaseline ()
 Reads the GPS Compass Estimated Baseline register. More...
 
ImuRateConfigurationRegister readImuRateConfiguration ()
 Reads the IMU Rate Configuration register. More...
 
void writeImuRateConfiguration (ImuRateConfigurationRegister &fields, bool waitForReply=true)
 Writes to the IMU Rate Configuration register. More...
 
void writeImuRateConfiguration (const uint16_t &imuRate, const uint16_t &navDivisor, const float &filterTargetRate, const float &filterMinRate, bool waitForReply=true)
 Writes to the IMU Rate Configuration register. More...
 
YawPitchRollTrueBodyAccelerationAndAngularRatesRegister readYawPitchRollTrueBodyAccelerationAndAngularRates ()
 Reads the Yaw, Pitch, Roll, True Body Acceleration and Angular Rates register. More...
 
YawPitchRollTrueInertialAccelerationAndAngularRatesRegister readYawPitchRollTrueInertialAccelerationAndAngularRates ()
 Reads the Yaw, Pitch, Roll, True Inertial Acceleration and Angular Rates register. More...
 

Static Public Member Functions

static std::vector< uint32_t > supportedBaudrates ()
 The list of baudrates supported by VectorNav sensors.
 
static Family determineDeviceFamily (std::string modelNumber)
 This method determines which device family a VectorNav sensor belongs to based on the provided model number. More...
 

Detailed Description

Helpful class for working with VectorNav sensors.

Examples:
getting_started/main.cpp.

Member Typedef Documentation

typedef void(* vn::sensors::VnSensor::AsyncPacketReceivedHandler) (void *userData, protocol::uart::Packet &asyncPacket, size_t packetStartRunningIndex)

Defines the signature for a method that can receive notifications of when a new asynchronous data packet (ASCII or BINARY) is received.

This packet will have already had and pertinent error checking performed and determined to be an asynchronous packet.

Parameters
[in]userDataPointer to user data that was initially supplied when the callback was registered via registerAsyncPacketReceivedHandler.
[in]asyncPacketThe asynchronous packet received.
[in]packetStartRunningIndexThe running index of the start of the packet.
typedef void(* vn::sensors::VnSensor::ErrorPacketReceivedHandler) (void *userData, protocol::uart::Packet &errorPacket, size_t packetStartRunningIndex)

Defines the signature for a method that can receive notifications when an error message is received.

This packet will have already had and pertinent error checking performed and determined to be an asynchronous packet.

Parameters
[in]userDataPointer to user data that was initially supplied when the callback was registered via registerErrorPacketReceivedHandler.
[in]errorPacketThe error packet received.
[in]packetStartRunningIndexThe running index of the start of the packet.
typedef void(* vn::sensors::VnSensor::PossiblePacketFoundHandler) (void *userData, protocol::uart::Packet &possiblePacket, size_t packetStartRunningIndex)

Defines the signature for a method that can receive notifications of new possible packets found.

Parameters
[in]userDataPointer to user data that was initially supplied when the callback was registered via registerPossiblePacketFoundHandler.
[in]possiblePacketThe possible packet that was found.
[in]packetStartRunningIndexThe running index of the start of the packet.
typedef void(* vn::sensors::VnSensor::RawDataReceivedHandler) (void *userData, const char *rawData, size_t length, size_t runningIndex)

Defines a callback handler that can received notification when the VnSensor receives raw data from its port.

Parameters
[in]userDataPointer to user data that was initially supplied when the callback was registered via registerRawDataReceivedHandler.
[in]rawDataPointer to the raw data.
[in]lengthThe number of bytes of raw data.
[in]runningIndexThe running index of the received data.

Member Enumeration Documentation

Enumerator
VnSensor_Family_Unknown 

Unknown device family.

VnSensor_Family_Vn100 

A device of the VectorNav VN-100 sensor family.

VnSensor_Family_Vn200 

A device of the VectorNav VN-200 sensor family.

VnSensor_Family_Vn300 

A device of the VectorNav VN-300 sensor family.

Member Function Documentation

void vn::sensors::VnSensor::accelerationDisturbancePresent ( bool  disturbancePresent,
bool  waitForReply = true 
)

Command to inform the VectorNav Sensor if there is an acceleration disturbance present.

Parameters
[in]disturbancePresentIndicates the presense of an acceleration disturbance.
[in]waitForReplyIndicates if the method should wait for a response from the sensor.
uint32_t vn::sensors::VnSensor::baudrate ( )

Returns the baudrate of the serial port connection. Note this is independent of the sensor's on-board serial baudrate setting.

Returns
The connected baudrate.
The connected baudrate.
void vn::sensors::VnSensor::changeBaudRate ( uint32_t  baudrate)

Issues a change baudrate to the VectorNav sensor and then reconnects the attached serial port at the new baudrate.

Parameters
[in]baudrateThe new sensor baudrate.
void vn::sensors::VnSensor::connect ( const std::string &  portName,
uint32_t  baudrate 
)

Connects to a VectorNav sensor.

Parameters
[in]portNameThe name of the serial port to connect to.
[in]baudrateThe baudrate to connect at.
Examples:
getting_started/main.cpp.
void vn::sensors::VnSensor::connect ( xplat::IPort port)

Allows connecting to a VectorNav sensor over a vn::common::ISimplePort.

The caller is responsible for properly destroying the vn::common::ISimplePort object when this method is used. Also, if the provided vn::common::ISimplePort is already open, then when the method disconnect is called, VnSensor will not attempt to close the port. However, if the vn::common::ISimplePort is not open, then any subsequent calls to disconnect will close the port.

Parameters
[in]simplePortAn vn::common::ISimplePort. May be either currently open or closed.
Family vn::sensors::VnSensor::determineDeviceFamily ( )

This method will connect to the specified serial port, query the attached sensor, and determine the type of device.

Parameters
[in]portNameThe COM port name to connect to.
[in]baudrateThe baudrate to connect at. This method will query the attached sensor and determine the device family it belongs to.
Returns
The determined device family.
static Family vn::sensors::VnSensor::determineDeviceFamily ( std::string  modelNumber)
static

This method determines which device family a VectorNav sensor belongs to based on the provided model number.

Returns
The determined device family.
void vn::sensors::VnSensor::disconnect ( )

Disconnects from the VectorNav sensor.

Exceptions
invalid_operationThrown if the VnSensor is not connected.
Examples:
getting_started/main.cpp.
void vn::sensors::VnSensor::magneticDisturbancePresent ( bool  disturbancePresent,
bool  waitForReply = true 
)

Command to inform the VectorNav Sensor if there is a magnetic disturbance present.

Parameters
[in]disturbancePresentIndicates the presence of a magnetic disturbance
[in]waitForReplyIndicates if the method should wait for a response from the sensor.
std::string vn::sensors::VnSensor::port ( )

Returns the name of the port the sensor is connected to.

Returns
The port name.
void vn::sensors::VnSensor::reset ( bool  waitForReply = true)

Issues a Reset command to the VectorNav sensor.

Parameters
[in]waitForReplyIndicates if the method should wait for a response from the sensor.
void vn::sensors::VnSensor::restoreFactorySettings ( bool  waitForReply = true)

Issues a Restore Factory Settings command to the VectorNav sensor.

Parameters
[in]waitForReplyIndicates if the method should wait for a response from the sensor.
std::string vn::sensors::VnSensor::send ( std::string  toSend,
bool  waitForReply = true,
protocol::uart::ErrorDetectionMode  errorDetectionMode = protocol::uart::ERRORDETECTIONMODE_CHECKSUM 
)

Writes a raw data string to the sensor, normally appending an appropriate error detection checksum.

No checksum is necessary as any missing checksum will be provided. For example, the following toSend data will be correctly received by the sensor.

  • $VNRRG,1*42\r\n
  • $VNRRG,1*42
  • $VNRRG,1*
  • $VNRRG,1
  • VNRRG,1

If waitForReply is true, then the method will wait for a response and return the received response. Otherwise, if false, the method will send the data and return immediately with an empty string.

Parameters
[in]toSendThe data to send. The method will automatically append a checksum/CRC if none is provided.
[in]waitForReplyIndicates if the method should wait for a response and return the received response.
[in]errorDetectionModeIndicates the error detection mode to append to any packets to send.
Returns
The received response if waitForReply is true; otherwise this will be an empty string.
void vn::sensors::VnSensor::setGyroBias ( bool  waitForReply = true)

Issues a command to the VectorNav Sensor to set the gyro's bias.

Parameters
[in]waitForReplyIndicates if the method should wait for a response from the sensor.
void vn::sensors::VnSensor::tare ( bool  waitForReply = true)

Issues a tare command to the VectorNav Sensor.

Parameters
[in]waitForReplyIndicates if the method should wait for a response from the sensor.
std::string vn::sensors::VnSensor::transaction ( std::string  toSend)

Sends the provided command and returns the response from the sensor.

If the command does not have an asterisk '*', then a checksum will be performed and appended based on the current error detection mode. Also, if the line-ending \r\n is not present, these will be added also.

Parameters
[in]toSendThe command to send to the sensor.
Returns
The response received from the sensor.
bool vn::sensors::VnSensor::verifySensorConnectivity ( )

Checks if we are able to send and receive communication with a sensor.

Returns
true if we can communicate with the sensor; otherwise false.
void vn::sensors::VnSensor::writeSettings ( bool  waitForReply = true)

Issues a Write Settings command to the VectorNav Sensor.

Parameters
[in]waitForReplyIndicates if the method should wait for a response from the sensor.

The documentation for this class was generated from the following file: