61 [[nodiscard]] std::string
type()
const override;
81 constexpr static size_t OUTPUT_PORT_INDEX_ASCII_OUTPUT = 0;
84 bool initialize()
override;
87 void deinitialize()
override;
92 static void mergeVectorNavBinaryObservations(
const std::shared_ptr<VectorNavBinaryOutput>& target,
const std::shared_ptr<VectorNavBinaryOutput>& source);
98 static void asciiOrBinaryAsyncMessageReceived(
void* userData, vn::protocol::uart::Packet& p,
size_t index);
101 enum class VectorNavModel :
int
111 VectorNavModel _sensorModel = VectorNavModel::VN100_VN110;
114 vn::sensors::VnSensor _vs;
117 std::string _connectedSensorPort;
120 static constexpr double IMU_DEFAULT_FREQUENCY = 800;
123 std::pair<std::vector<uint16_t>, std::vector<std::string>> _dividerFrequency;
126 std::array<InsTime, 3> _lastMessageTime{};
129 std::array<uint64_t, 3> _lastMessageTimeSinceStartup{};
144 vn::protocol::uart::AsciiAsync _asyncDataOutputType = vn::protocol::uart::AsciiAsync::VNOFF;
148 static constexpr std::array _possibleAsyncDataOutputFrequency = { 1, 2, 4, 5, 10, 20, 25, 40, 50, 100, 200 };
152 uint32_t _asyncDataOutputFrequency = 40;
154 int _asyncDataOutputFrequencySelected = 7;
157 int _asciiOutputBufferSize = 10;
160 ScrollingBuffer<std::string> _asciiOutputBuffer{
static_cast<size_t>(_asciiOutputBufferSize) };
166 vn::sensors::SynchronizationControlRegister _synchronizationControlRegister{
167 vn::protocol::uart::SyncInMode::SYNCINMODE_COUNT,
168 vn::protocol::uart::SyncInEdge::SYNCINEDGE_RISING,
170 vn::protocol::uart::SyncOutMode::SYNCOUTMODE_NONE,
171 vn::protocol::uart::SyncOutPolarity::SYNCOUTPOLARITY_POSITIVE,
177 TimeSync _timeSyncOut;
180 bool _syncInPin =
false;
183 bool _coupleImuRateOutput =
true;
189 static void coupleImuFilterRates(
NAV::VectorNavSensor* sensor, vn::sensors::BinaryOutputRegister& bor, uint32_t& binaryField);
195 vn::sensors::CommunicationProtocolControlRegister _communicationProtocolControlRegister{
196 vn::protocol::uart::CountMode::COUNTMODE_NONE,
197 vn::protocol::uart::StatusMode::STATUSMODE_OFF,
198 vn::protocol::uart::CountMode::COUNTMODE_NONE,
199 vn::protocol::uart::StatusMode::STATUSMODE_OFF,
200 vn::protocol::uart::ChecksumMode::CHECKSUMMODE_CHECKSUM,
201 vn::protocol::uart::ChecksumMode::CHECKSUMMODE_OFF,
202 vn::protocol::uart::ErrorMode::ERRORMODE_SEND
206 enum class BinaryRegisterMerge
215 BinaryRegisterMerge _binaryOutputRegisterMerge = BinaryRegisterMerge::None;
218 std::shared_ptr<VectorNavBinaryOutput> _binaryOutputRegisterMergeObservation =
nullptr;
220 size_t _binaryOutputRegisterMergeIndex{};
227 std::array<vn::sensors::BinaryOutputRegister, 3> _binaryOutputRegister = { vn::sensors::BinaryOutputRegister{
228 vn::protocol::uart::AsyncMode::ASYNCMODE_NONE,
230 vn::protocol::uart::CommonGroup::COMMONGROUP_NONE,
231 vn::protocol::uart::TimeGroup::TIMEGROUP_NONE,
232 vn::protocol::uart::ImuGroup::IMUGROUP_NONE,
233 vn::protocol::uart::GpsGroup::GPSGROUP_NONE,
234 vn::protocol::uart::AttitudeGroup::ATTITUDEGROUP_NONE,
235 vn::protocol::uart::InsGroup::INSGROUP_NONE,
236 vn::protocol::uart::GpsGroup::GPSGROUP_NONE
238 vn::sensors::BinaryOutputRegister{
239 vn::protocol::uart::AsyncMode::ASYNCMODE_NONE,
241 vn::protocol::uart::CommonGroup::COMMONGROUP_NONE,
242 vn::protocol::uart::TimeGroup::TIMEGROUP_NONE,
243 vn::protocol::uart::ImuGroup::IMUGROUP_NONE,
244 vn::protocol::uart::GpsGroup::GPSGROUP_NONE,
245 vn::protocol::uart::AttitudeGroup::ATTITUDEGROUP_NONE,
246 vn::protocol::uart::InsGroup::INSGROUP_NONE,
247 vn::protocol::uart::GpsGroup::GPSGROUP_NONE
249 vn::sensors::BinaryOutputRegister{
250 vn::protocol::uart::AsyncMode::ASYNCMODE_NONE,
252 vn::protocol::uart::CommonGroup::COMMONGROUP_NONE,
253 vn::protocol::uart::TimeGroup::TIMEGROUP_NONE,
254 vn::protocol::uart::ImuGroup::IMUGROUP_NONE,
255 vn::protocol::uart::GpsGroup::GPSGROUP_NONE,
256 vn::protocol::uart::AttitudeGroup::ATTITUDEGROUP_NONE,
257 vn::protocol::uart::InsGroup::INSGROUP_NONE,
258 vn::protocol::uart::GpsGroup::GPSGROUP_NONE
261 std::array<size_t, 3> _binaryOutputSelectedFrequency{};
271 vn::math::mat3f _referenceFrameRotationMatrix{ { 1, 0, 0 },
279 vn::sensors::ImuFilteringConfigurationRegister _imuFilteringConfigurationRegister{
285 vn::protocol::uart::FilterMode::FILTERMODE_NOFILTERING,
286 vn::protocol::uart::FilterMode::FILTERMODE_BOTH,
287 vn::protocol::uart::FilterMode::FILTERMODE_BOTH,
288 vn::protocol::uart::FilterMode::FILTERMODE_BOTH,
289 vn::protocol::uart::FilterMode::FILTERMODE_NOFILTERING
296 vn::sensors::DeltaThetaAndDeltaVelocityConfigurationRegister _deltaThetaAndDeltaVelocityConfigurationRegister{
297 vn::protocol::uart::IntegrationFrame::INTEGRATIONFRAME_BODY,
298 vn::protocol::uart::CompensationMode::COMPENSATIONMODE_NONE,
299 vn::protocol::uart::AccCompensationMode::ACCCOMPENSATIONMODE_NONE,
300 vn::protocol::uart::EarthRateCorrection::EARTHRATECORR_NONE
309 vn::sensors::GpsConfigurationRegister _gpsConfigurationRegister{
310 vn::protocol::uart::GpsMode::GPSMODE_ONBOARDGPS,
311 vn::protocol::uart::PpsSource::PPSSOURCE_GPSPPSRISING,
312 vn::protocol::uart::GpsRate::GPSRATE_5HZ,
313 vn::protocol::uart::AntPower::ANTPOWER_INTERNAL
320 vn::math::vec3f _gpsAntennaOffset{
329 vn::sensors::GpsCompassBaselineRegister _gpsCompassBaselineRegister{
330 vn::math::vec3f{ 1.0F, 0.0F, 0.0F },
331 vn::math::vec3f{ 0.254F, 0.254F, 0.254F }
342 vn::sensors::VpeBasicControlRegister _vpeBasicControlRegister{
343 vn::protocol::uart::VpeEnable::VPEENABLE_ENABLE,
344 vn::protocol::uart::HeadingMode::HEADINGMODE_RELATIVE,
345 vn::protocol::uart::VpeMode::VPEMODE_MODE1,
346 vn::protocol::uart::VpeMode::VPEMODE_MODE1
353 vn::sensors::VpeMagnetometerBasicTuningRegister _vpeMagnetometerBasicTuningRegister{
354 vn::math::vec3f{ 4.0F, 4.0F, 4.0F },
355 vn::math::vec3f{ 5.0F, 5.0F, 5.0F },
356 vn::math::vec3f{ 5.5F, 5.5F, 5.5F }
363 vn::sensors::VpeAccelerometerBasicTuningRegister _vpeAccelerometerBasicTuningRegister{
364 vn::math::vec3f{ 6.0F, 6.0F, 6.0F },
365 vn::math::vec3f{ 3.0F, 3.0F, 3.0F },
366 vn::math::vec3f{ 5.0F, 5.0F, 5.0F }
373 vn::sensors::VpeGyroBasicTuningRegister _vpeGyroBasicTuningRegister{
374 vn::math::vec3f{ 8.0F, 8.0F, 8.0F },
375 vn::math::vec3f{ 4.0F, 4.0F, 4.0F },
376 vn::math::vec3f{ 0.0F, 0.0F, 0.0F }
383 vn::math::vec3f _filterStartupGyroBias{
393 vn::sensors::InsBasicConfigurationRegisterVn300 _insBasicConfigurationRegisterVn300{
394 vn::protocol::uart::Scenario::SCENARIO_GPSMOVINGBASELINEDYNAMIC,
403 vn::sensors::StartupFilterBiasEstimateRegister _startupFilterBiasEstimateRegister{
404 vn::math::vec3f{ 0, 0, 0 },
405 vn::math::vec3f{ 0, 0, 0 },
417 vn::sensors::MagnetometerCalibrationControlRegister _magnetometerCalibrationControlRegister{
418 vn::protocol::uart::HsiMode::HSIMODE_RUN,
419 vn::protocol::uart::HsiOutput::HSIOUTPUT_USEONBOARD,
431 vn::sensors::MagneticAndGravityReferenceVectorsRegister _magneticAndGravityReferenceVectorsRegister{
432 vn::math::vec3f{ 1.0F, 0.0F, 1.8F },
433 vn::math::vec3f{ 0.0F, 0.0F, -9.793746F }
440 vn::sensors::ReferenceVectorConfigurationRegister _referenceVectorConfigurationRegister{
445 vn::math::vec3d{ 0, 0, 0 }
456 vn::sensors::VelocityCompensationControlRegister _velocityCompensationControlRegister{
457 vn::protocol::uart::VelocityCompensationMode::VELOCITYCOMPENSATIONMODE_BODYMEASUREMENT,
467 struct BinaryGroupData
470 const char* name =
nullptr;
474 void (*tooltip)() =
nullptr;
476 bool (*isEnabled)(VectorNavModel sensorModel,
const vn::sensors::BinaryOutputRegister& bor, uint32_t binaryField) =
477 [](VectorNavModel ,
const vn::sensors::BinaryOutputRegister& , uint32_t ) {
return true; };
479 void (*toggleFields)(
VectorNavSensor* sensor, vn::sensors::BinaryOutputRegister& bor, uint32_t& ) =
nullptr;
496 static const std::array<BinaryGroupData, 10> _binaryGroupTime;
500 static const std::array<BinaryGroupData, 11> _binaryGroupIMU;
510 static const std::array<BinaryGroupData, 16> _binaryGroupGNSS;
516 static const std::array<BinaryGroupData, 9> _binaryGroupAttitude;
521 static const std::array<BinaryGroupData, 11> _binaryGroupINS;