1 #ifndef _VNSENSORS_SENSORS_H_
2 #define _VNSENSORS_SENSORS_H_
5 #include "boostpython.h"
13 #include "packetfinder.h"
15 #include "registers.h"
48 char const*
what()
const throw();
51 protocol::uart::SensorError
error;
72 typedef Event<protocol::uart::Packet&, size_t, xplat::TimeStamp> AsyncPacketReceivedEvent;
83 typedef void(*RawDataReceivedHandler)(
void* userData,
const char* rawData,
size_t length,
size_t runningIndex);
93 typedef void(*PossiblePacketFoundHandler)(
void* userData,
protocol::uart::Packet& possiblePacket,
size_t packetStartRunningIndex);
107 typedef void(*AsyncPacketReceivedHandler)(
void* userData,
protocol::uart::Packet& asyncPacket,
size_t packetStartRunningIndex);
120 typedef void(*ErrorPacketReceivedHandler)(
void* userData,
protocol::uart::Packet& errorPacket,
size_t packetStartRunningIndex);
123 static std::vector<uint32_t> supportedBaudrates();
150 protocol::uart::ErrorDetectionMode sendErrorDetectionMode();
157 void setSendErrorDetectionMode(protocol::uart::ErrorDetectionMode mode);
168 uint16_t responseTimeoutMs();
174 void setResponseTimeoutMs(uint16_t
timeout);
179 uint16_t retransmitDelayMs();
184 void setRetransmitDelayMs(uint16_t delay);
191 bool verifySensorConnectivity();
197 void connect(
const std::string &portName, uint32_t baudrate);
227 std::string transaction(std::string toSend);
256 bool waitForReply =
true,
257 protocol::uart::ErrorDetectionMode errorDetectionMode = protocol::uart::ERRORDETECTIONMODE_CHECKSUM);
263 void tare(
bool waitForReply =
true);
269 void setGyroBias(
bool waitForReply =
true);
276 void magneticDisturbancePresent(
bool disturbancePresent,
bool waitForReply =
true);
283 void accelerationDisturbancePresent(
bool disturbancePresent,
bool waitForReply =
true);
289 void writeSettings(
bool waitForReply =
true);
296 void restoreFactorySettings(
bool waitForReply =
true);
302 void reset(
bool waitForReply =
true);
308 void changeBaudRate(uint32_t baudrate);
321 Family determineDeviceFamily();
327 static Family determineDeviceFamily(std::string modelNumber);
341 void registerRawDataReceivedHandler(
void* userData, RawDataReceivedHandler handler);
348 PyObject* registerRawDataReceivedHandler(PyObject* callable);
354 void unregisterRawDataReceivedHandler();
362 void registerPossiblePacketFoundHandler(
void* userData, PossiblePacketFoundHandler handler);
365 void unregisterPossiblePacketFoundHandler();
373 void registerAsyncPacketReceivedHandler(
void* userData, AsyncPacketReceivedHandler handler);
379 AsyncPacketReceivedEvent eventAsyncPacketReceived;
384 PyObject* registerAsyncPacketReceivedHandler(PyObject* callable);
389 void unregisterAsyncPacketReceivedHandler();
397 void registerErrorPacketReceivedHandler(
void* userData, ErrorPacketReceivedHandler handler);
400 void unregisterErrorPacketReceivedHandler();
448 uint32_t readSerialBaudRate(uint8_t port);
455 void writeSerialBaudRate(
const uint32_t &baudrate, uint8_t port,
bool waitForReply =
true);
461 protocol::uart::AsciiAsync readAsyncDataOutputType(uint8_t port);
468 void writeAsyncDataOutputType(protocol::uart::AsciiAsync ador, uint8_t port,
bool waitForReply =
true);
474 uint32_t readAsyncDataOutputFrequency(uint8_t port);
481 void writeAsyncDataOutputFrequency(
const uint32_t &adof, uint8_t port,
bool waitForReply =
true);
499 void writeInsBasicConfigurationVn200(
500 protocol::uart::Scenario scenario,
501 const uint8_t &ahrsAiding,
502 bool waitForReply =
true);
521 void writeInsBasicConfigurationVn300(
522 protocol::uart::Scenario scenario,
523 const uint8_t &ahrsAiding,
524 const uint8_t &estBaseline,
525 bool waitForReply =
true);
530 std::string readUserTag();
536 void writeUserTag(
const std::string &tag,
bool waitForReply =
true);
541 std::string readModelNumber();
546 uint32_t readHardwareRevision();
551 uint32_t readSerialNumber();
556 std::string readFirmwareVersion();
561 uint32_t readSerialBaudRate();
567 void writeSerialBaudRate(
const uint32_t &baudrate,
bool waitForReply =
true);
572 protocol::uart::AsciiAsync readAsyncDataOutputType();
578 void writeAsyncDataOutputType(protocol::uart::AsciiAsync ador,
bool waitForReply =
true);
583 uint32_t readAsyncDataOutputFrequency();
589 void writeAsyncDataOutputFrequency(
const uint32_t &adof,
bool waitForReply =
true);
642 void writeMagneticAndGravityReferenceVectors(
645 bool waitForReply =
true);
665 void writeFilterMeasurementsVarianceParameters(
666 const float &angularWalkVariance,
670 bool waitForReply =
true);
688 void writeMagnetometerCompensation(
691 bool waitForReply =
true);
711 void writeFilterActiveTuningParameters(
712 const float &magneticDisturbanceGain,
713 const float &accelerationDisturbanceGain,
714 const float &magneticDisturbanceMemory,
715 const float &accelerationDisturbanceMemory,
716 bool waitForReply =
true);
734 void writeAccelerationCompensation(
737 bool waitForReply =
true);
748 void writeReferenceFrameRotation(
const vn::math::mat3f &c,
bool waitForReply =
true);
776 void writeCommunicationProtocolControl(
777 protocol::uart::CountMode serialCount,
778 protocol::uart::StatusMode serialStatus,
779 protocol::uart::CountMode spiCount,
780 protocol::uart::StatusMode spiStatus,
781 protocol::uart::ChecksumMode serialChecksum,
782 protocol::uart::ChecksumMode spiChecksum,
783 protocol::uart::ErrorMode errorMode,
784 bool waitForReply =
true);
807 void writeSynchronizationControl(
808 protocol::uart::SyncInMode syncInMode,
809 protocol::uart::SyncInEdge syncInEdge,
810 const uint16_t &syncInSkipFactor,
811 protocol::uart::SyncOutMode syncOutMode,
812 protocol::uart::SyncOutPolarity syncOutPolarity,
813 const uint16_t &syncOutSkipFactor,
814 const uint32_t &syncOutPulseWidth,
815 bool waitForReply =
true);
834 void writeSynchronizationStatus(
835 const uint32_t &syncInCount,
836 const uint32_t &syncInTime,
837 const uint32_t &syncOutCount,
838 bool waitForReply =
true);
859 void writeFilterBasicControl(
860 protocol::uart::MagneticMode magMode,
861 protocol::uart::ExternalSensorMode extMagMode,
862 protocol::uart::ExternalSensorMode extAccMode,
863 protocol::uart::ExternalSensorMode extGyroMode,
865 bool waitForReply =
true);
885 void writeVpeBasicControl(
886 protocol::uart::VpeEnable enable,
887 protocol::uart::HeadingMode headingMode,
888 protocol::uart::VpeMode filteringMode,
889 protocol::uart::VpeMode tuningMode,
890 bool waitForReply =
true);
909 void writeVpeMagnetometerBasicTuning(
913 bool waitForReply =
true);
934 void writeVpeMagnetometerAdvancedTuning(
937 const float &maxAdaptRate,
938 const float &disturbanceWindow,
939 const float &maxTuning,
940 bool waitForReply =
true);
959 void writeVpeAccelerometerBasicTuning(
963 bool waitForReply =
true);
984 void writeVpeAccelerometerAdvancedTuning(
987 const float &maxAdaptRate,
988 const float &disturbanceWindow,
989 const float &maxTuning,
990 bool waitForReply =
true);
1009 void writeVpeGyroBasicTuning(
1013 bool waitForReply =
true);
1024 void writeFilterStartupGyroBias(
const vn::math::vec3f &bias,
bool waitForReply =
true);
1043 void writeMagnetometerCalibrationControl(
1044 protocol::uart::HsiMode hsiMode,
1045 protocol::uart::HsiOutput hsiOutput,
1046 const uint8_t &convergeRate,
1047 bool waitForReply =
true);
1057 float readIndoorHeadingModeControl();
1063 void writeIndoorHeadingModeControl(
const float &maxRateError,
bool waitForReply =
true);
1074 void writeVelocityCompensationMeasurement(
const vn::math::vec3f &velocity,
bool waitForReply =
true);
1093 void writeVelocityCompensationControl(
1094 protocol::uart::VelocityCompensationMode mode,
1095 const float &velocityTuning,
1096 const float &rateTuning,
1097 bool waitForReply =
true);
1125 void writeGpsConfiguration(
1126 protocol::uart::GpsMode mode,
1127 protocol::uart::PpsSource ppsSource,
1128 bool waitForReply =
true);
1139 void writeGpsAntennaOffset(
const vn::math::vec3f &position,
bool waitForReply =
true);
1190 void writeInsAdvancedConfiguration(
1191 const uint8_t &useMag,
1192 const uint8_t &usePres,
1193 const uint8_t &posAtt,
1194 const uint8_t &velAtt,
1195 const uint8_t &velBias,
1196 protocol::uart::FoamInit useFoam,
1197 const uint8_t &gpsCovType,
1198 const uint8_t &velCount,
1199 const float &velInit,
1200 const float &moveOrigin,
1201 const float &gpsTimeout,
1202 const float &deltaLimitPos,
1203 const float &deltaLimitVel,
1204 const float &minPosUncertainty,
1205 const float &minVelUncertainty,
1206 bool waitForReply =
true);
1235 void writeStartupFilterBiasEstimate(
1238 const float &pressureBias,
1239 bool waitForReply =
true);
1263 void writeDeltaThetaAndDeltaVelocityConfiguration(
1264 protocol::uart::IntegrationFrame integrationFrame,
1265 protocol::uart::CompensationMode gyroCompensation,
1266 protocol::uart::CompensationMode accelCompensation,
1267 bool waitForReply =
true);
1288 void writeReferenceVectorConfiguration(
1289 const uint8_t &useMagModel,
1290 const uint8_t &useGravityModel,
1291 const uint32_t &recalcThreshold,
1294 bool waitForReply =
true);
1312 void writeGyroCompensation(
1315 bool waitForReply =
true);
1341 void writeImuFilteringConfiguration(
1342 const uint16_t &magWindowSize,
1343 const uint16_t &accelWindowSize,
1344 const uint16_t &gyroWindowSize,
1345 const uint16_t &tempWindowSize,
1346 const uint16_t &presWindowSize,
1347 protocol::uart::FilterMode magFilterMode,
1348 protocol::uart::FilterMode accelFilterMode,
1349 protocol::uart::FilterMode gyroFilterMode,
1350 protocol::uart::FilterMode tempFilterMode,
1351 protocol::uart::FilterMode presFilterMode,
1352 bool waitForReply =
true);
1370 void writeGpsCompassBaseline(
1373 bool waitForReply =
true);
1398 void writeImuRateConfiguration(
1399 const uint16_t &imuRate,
1400 const uint16_t &navDivisor,
1401 const float &filterTargetRate,
1402 const float &filterMinRate,
1403 bool waitForReply =
true);
1417 #ifdef PYTHON_WRAPPERS
1421 #if PYTHON && !PL156_ORIGINAL && !PL156_FIX_ATTEMPT_1
1424 bool threadStopped();
1425 void unregisterListners();
1426 void shutdownRequest();
Structure representing the Velocity Compensation Status register.
Definition: registers.h:681
Structure representing the INS Basic Configuration register for a VN-200 sensor.
Definition: registers.h:960
Unknown device family.
Definition: sensors.h:65
Structure representing the VPE Gyro Basic Tuning register.
Definition: registers.h:585
Structure representing the INS Basic Configuration register for a VN-300 sensor.
Definition: registers.h:981
Template for a Euclidean vector.
Definition: vector.h:22
Structure representing the Startup Filter Bias Estimate register.
Definition: registers.h:1145
Structure representing the Yaw, Pitch, Roll, True Body Acceleration and Angular Rates register...
Definition: registers.h:1406
char const * what() const
Returns a description of the exception.
Structure representing the Acceleration Compensation register.
Definition: registers.h:250
Structure representing the Magnetometer Compensation register.
Definition: registers.h:200
Structure representing the Yaw, Pitch, Roll, True Inertial Acceleration and Angular Rates register...
Definition: registers.h:1431
Structure representing the Synchronization Status register.
Definition: registers.h:382
Structure representing the Filter Measurements Variance Parameters register.
Definition: registers.h:171
Structure representing the GPS Compass Estimated Baseline register.
Definition: registers.h:1348
Structure representing the VPE Accelerometer Basic Tuning register.
Definition: registers.h:527
Structure representing the INS Advanced Configuration register.
Definition: registers.h:1006
Structure representing the INS State - ECEF register.
Definition: registers.h:1112
Structure representing the INS Solution - ECEF register.
Definition: registers.h:911
Structure representing the GPS Solution - LLA register.
Definition: registers.h:764
Structure representing the GPS Compass Baseline register.
Definition: registers.h:1327
Interface for a simple port.
Definition: port.h:12
A device of the VectorNav VN-200 sensor family.
Definition: sensors.h:67
Template for a matrix.
Definition: matrix.h:20
Structure representing the IMU Rate Configuration register.
Definition: registers.h:1377
Family
Definition: sensors.h:63
Structure representing the INS Solution - LLA register.
Definition: registers.h:862
Structure representing the IMU Filtering Configuration register.
Definition: registers.h:1274
Structure representing the Magnetic and Gravity Reference Vectors register.
Definition: registers.h:150
Structure representing the Filter Basic Control register.
Definition: registers.h:407
Structure representing the Gyro Compensation register.
Definition: registers.h:1253
Structure representing the Yaw, Pitch, Roll, Magnetic, Acceleration and Angular Rates register...
Definition: registers.h:271
Structure representing the VPE Magnetometer Advanced Tuning register.
Definition: registers.h:494
protocol::uart::SensorError error
The associated sensor error.
Definition: sensors.h:51
A timeout occurred.
Definition: exceptions.h:85
Helpful class for working with VectorNav sensors.
Definition: sensors.h:58
A device of the VectorNav VN-100 sensor family.
Definition: sensors.h:66
Structure representing the VPE Basic Control register.
Definition: registers.h:440
Structure representing the Synchronization Control register.
Definition: registers.h:341
Structure representing the GPS Configuration register.
Definition: registers.h:743
Identifies a derived class as being unable to be copied and prevents copy attempts.
Definition: nocopy.h:21
Represents an error from a VectorNav sensor.
Definition: sensors.h:29
Structure representing the GPS Solution - ECEF register.
Definition: registers.h:813
Structure representing the Quaternion, Magnetic, Acceleration and Angular Rates register.
Definition: registers.h:96
Structure representing the Magnetic, Acceleration and Angular Rates register.
Definition: registers.h:125
Structure representing the Velocity Compensation Control register.
Definition: registers.h:656
Structure representing the Calculated Magnetometer Calibration register.
Definition: registers.h:635
Structure representing the Reference Vector Configuration register.
Definition: registers.h:1220
Structure representing a Binary Output register.
Definition: registers.h:24
Structure representing the Communication Protocol Control register.
Definition: registers.h:300
Structure representing the Delta Theta and Delta Velocity Configuration register. ...
Definition: registers.h:1195
Structure representing the VPE Accelerometer Advanced Tuning register.
Definition: registers.h:552
Structure representing the VPE Magnetometer Basic Tuning register.
Definition: registers.h:469
Structure representing the Magnetometer Calibration Control register.
Definition: registers.h:610
Structure representing the INS State - LLA register.
Definition: registers.h:1079
Structure representing the Delta Theta and Delta Velocity register.
Definition: registers.h:1170
Structure representing the Filter Active Tuning Parameters register.
Definition: registers.h:221
Structure representing a UART packet received from the VectorNav sensor.
Definition: packet.h:16
Structure representing the IMU Measurements register.
Definition: registers.h:710