mars_lib 0.1.0.2abe2576fe7f
Modular and Robust Sensor-Fusion
Loading...
Searching...
No Matches
attitude_sensor_class.h
Go to the documentation of this file.
1// Copyright (C) 2021 Martin Scheiber and Christian Brommer, Control of Networked Systems, University of Klagenfurt,
2// Austria.
3//
4// All rights reserved.
5//
6// This software is licensed under the terms of the BSD-2-Clause-License with
7// no commercial use allowed, the full terms of which are made available
8// in the LICENSE file. No license in patents is granted.
9//
10// You can contact the authors at <martin.scheiber@ieee.org>
11// and <christian.brommer@ieee.org>.
12
13#ifndef ATTITUDE_SENSOR_CLASS_H
14#define ATTITUDE_SENSOR_CLASS_H
15
16#include <mars/core_state.h>
17#include <mars/ekf.h>
23#include <mars/time.h>
26#include <cmath>
27#include <iostream>
28#include <memory>
29#include <string>
30#include <utility>
31
32namespace mars
33{
35
37{
38 RP_TYPE,
39 RPY_TYPE,
40};
41
42inline std::ostream& operator<<(std::ostream& os, AttitudeSensorType type)
43{
44 switch (type)
45 {
47 os << "ROLL/PITCH";
48 break;
50 os << "ROLL/PITCH/YAW";
51 break;
52 default:
53 os << "UNKNOWN";
54 break;
55 }
56 return os;
57}
58
60{
61public:
62private:
64
65public:
66 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
67
68 AttitudeSensorClass(const std::string& name, std::shared_ptr<CoreState> core_states,
70 {
71 name_ = name;
72 core_states_ = std::move(core_states);
73 const_ref_to_nav_ = false;
75
76 // set sensor type
77 attitude_type_ = type;
78
79 // chi2
80 switch (attitude_type_)
81 {
83 chi2_.set_dof(2);
84 break;
86 chi2_.set_dof(3);
87 break;
88 default:
89 std::cout << "Warning: [" << this->name_
90 << "] Unexpected type for AttitudeSensorClass.\n"
91 "Assuming roll-pitch-yaw measurement."
92 << std::endl;
94 chi2_.set_dof(3);
95 break;
96 }
97
98 // Sensor specific information
99 // setup_sensor_properties();
100 std::cout << "Created: [" << this->name_ << "] Sensor (type: " << attitude_type_ << ")" << std::endl;
101 }
102
103 virtual ~AttitudeSensorClass() = default;
104
105 AttitudeSensorStateType get_state(const std::shared_ptr<void>& sensor_data)
106 {
107 AttitudeSensorData data = *static_cast<AttitudeSensorData*>(sensor_data.get());
108 return data.state_;
109 }
110
111 Eigen::MatrixXd get_covariance(const std::shared_ptr<void>& sensor_data)
112 {
113 AttitudeSensorData data = *static_cast<AttitudeSensorData*>(sensor_data.get());
114 return data.get_full_cov();
115 }
116
117 void set_initial_calib(std::shared_ptr<void> calibration)
118 {
119 initial_calib_ = calibration;
121 }
122
123 BufferDataType Initialize(const Time& timestamp, std::shared_ptr<void> /*sensor_data*/,
124 std::shared_ptr<CoreType> latest_core_data)
125 {
126 // AttitudeMeasurementType measurement = *static_cast<AttitudeMeasurementType*>(sensor_data.get());
127
128 AttitudeSensorData sensor_state;
129 std::string calibration_type;
130
131 if (this->initial_calib_provided_)
132 {
133 calibration_type = "Given";
134
135 AttitudeSensorData calib = *static_cast<AttitudeSensorData*>(initial_calib_.get());
136
137 sensor_state.state_ = calib.state_;
138 sensor_state.sensor_cov_ = calib.sensor_cov_;
139 }
140 else
141 {
142 // calibration_type = "Auto";
143
144 // Eigen::Vector3d p_wp(measurement.position_);
145 // Eigen::Quaterniond q_wp(measurement.orientation_);
146
147 // Eigen::Vector3d p_wi(latest_core_data->state_.p_wi_);
148 // Eigen::Quaterniond q_wi(latest_core_data->state_.q_wi_);
149 // Eigen::Matrix3d r_wi(q_wi.toRotationMatrix());
150
151 // Eigen::Vector3d p_ip = r_wi.transpose() * (p_wp - p_wi);
152 // Eigen::Quaterniond q_ip = q_wi.conjugate() * q_wp;
153
154 // // Calibration, position / rotation imu-pose
155 // sensor_state.state_.p_ip_ = p_ip;
156 // sensor_state.state_.q_ip_ = q_ip;
157
158 // // The covariance should enclose the initialization with a 3 Sigma bound
159 // Eigen::Matrix<double, 6, 1> std;
160 // std << 1, 1, 1, (35 * M_PI / 180), (35 * M_PI / 180), (35 * M_PI / 180);
161 // sensor_state.sensor_cov_ = std.cwiseProduct(std).asDiagonal();
162 }
163
164 // Bypass core state for the returned object
165 BufferDataType result(std::make_shared<CoreType>(*latest_core_data.get()),
166 std::make_shared<AttitudeSensorData>(sensor_state));
167
168 // TODO
169 // sensor_data.ref_to_nav = 0; //obj.calc_ref_to_nav(measurement, latest_core_state);
170
171 is_initialized_ = true;
172
173 std::cout << "Info: Initialized [" << name_ << "] with [" << calibration_type << "] Calibration at t=" << timestamp
174 << std::endl;
175
177 {
178 std::cout << "Info: [" << name_ << "] Calibration(rounded):" << std::endl;
179 std::cout << "\tOrientation[deg]: ["
180 << sensor_state.state_.q_aw_.toRotationMatrix().eulerAngles(0, 1, 2).transpose() * (180 / M_PI) << " ]"
181 << std::endl;
182 }
183
184 return result;
185 }
186
187 bool CalcUpdate(const Time& timestamp, std::shared_ptr<void> measurement, const CoreStateType& prior_core_state,
188 std::shared_ptr<void> latest_sensor_data, const Eigen::MatrixXd& prior_cov,
189 BufferDataType* new_state_data)
190 {
191 switch (attitude_type_)
192 {
194 return CalcUpdateRP(timestamp, measurement, prior_core_state, latest_sensor_data, prior_cov, new_state_data);
196 return CalcUpdateRPY(timestamp, measurement, prior_core_state, latest_sensor_data, prior_cov, new_state_data);
197 default:
198 std::cout << "Error: [" << this->name_ << "] Cannot perform update (unknown type)" << std::endl;
199 return false;
200 }
201
202 return false;
203 }
204
205 bool CalcUpdateRP(const Time& /*timestamp*/, const std::shared_ptr<void>& measurement,
206 const CoreStateType& prior_core_state, const std::shared_ptr<void>& latest_sensor_data,
207 const Eigen::MatrixXd& prior_cov, BufferDataType* new_state_data)
208 {
209 // Cast the sensor measurement and prior state information
210 AttitudeMeasurementType* meas = static_cast<AttitudeMeasurementType*>(measurement.get());
211 AttitudeSensorData* prior_sensor_data = static_cast<AttitudeSensorData*>(latest_sensor_data.get());
212
213 // Decompose sensor measurement
214 Eigen::Vector2d rp_meas = meas->attitude_.get_rp();
215
216 // Extract sensor state
217 AttitudeSensorStateType prior_sensor_state(prior_sensor_data->state_);
218
219 // Generate measurement noise matrix and check
220 // if noisevalues from the measurement object should be used
221 Eigen::MatrixXd R_meas_dyn;
223 {
224 meas->get_meas_noise(&R_meas_dyn);
225 }
226 else
227 {
228 R_meas_dyn = this->R_.asDiagonal();
229 }
230 const Eigen::Matrix<double, 2, 2> R_meas = R_meas_dyn;
231
232 const int size_of_core_state = CoreStateType::size_error_;
233 const int size_of_sensor_state = prior_sensor_state.cov_size_;
234 const int size_of_full_error_state = size_of_core_state + size_of_sensor_state;
235 const Eigen::MatrixXd P = prior_cov;
236 assert(P.size() == size_of_full_error_state * size_of_full_error_state);
237
238 // Calculate the measurement jacobian H
239 typedef Eigen::Matrix<double, 2, 3> Matrix23d_t;
240 Matrix23d_t I_23;
241 I_23 << 1., 0., 0., 0., 1., 0.;
242 const Matrix23d_t Z_23 = Matrix23d_t::Zero();
243 const Eigen::Matrix3d R_wi = prior_core_state.q_wi_.toRotationMatrix();
244 const Eigen::Matrix3d R_aw = prior_sensor_state.q_aw_.toRotationMatrix();
245 const Eigen::Matrix3d R_ib = prior_sensor_state.q_ib_.toRotationMatrix();
246
247 // Orientation
248 const Matrix23d_t Hr_pwi = Z_23;
249 const Matrix23d_t Hr_vwi = Z_23;
250 const Matrix23d_t Hr_rwi = R_ib.transpose().block(0, 0, 2, 3);
251 const Matrix23d_t Hr_bw = Z_23;
252 const Matrix23d_t Hr_ba = Z_23;
253
254 const Matrix23d_t Hr_raw = (R_ib.transpose() * R_wi.transpose()).block(0, 0, 2, 3);
255 const Matrix23d_t Hr_rib = I_23;
256
257 // Assemble the jacobian for the orientation (horizontal)
258 // H_r = [Hr_pwi Hr_vwi Hr_rwi Hr_bw Hr_ba Hr_mag Hr_rim];
259 Eigen::MatrixXd H(2, Hr_pwi.cols() + Hr_vwi.cols() + Hr_rwi.cols() + Hr_bw.cols() + Hr_ba.cols() + Hr_raw.cols() +
260 Hr_rib.cols());
261 H << Hr_pwi, Hr_vwi, Hr_rwi, Hr_bw, Hr_ba, Hr_raw, Hr_rib;
262
263 // Calculate the residual z = z~ - (estimate)
264 // Orientation
265 const Eigen::Vector3d rpy_est = mars::Utils::RPYFromRotMat(R_aw * R_wi * R_ib);
266 const Eigen::Vector2d rp_est(rpy_est(0), rpy_est(1));
267 residual_ = Eigen::MatrixXd(rp_est.rows(), 1);
268 residual_ = rp_meas - rp_est;
269
270 // Perform EKF calculations
271 mars::Ekf ekf(H, R_meas, residual_, P);
272 const Eigen::MatrixXd correction = ekf.CalculateCorrection(&chi2_);
273 assert(correction.size() == size_of_full_error_state * 1);
274
275 // Perform Chi2 test
276 if (!chi2_.passed_ && chi2_.do_test_)
277 {
279 return false;
280 }
281
282 Eigen::MatrixXd P_updated = ekf.CalculateCovUpdate();
283 assert(P_updated.size() == size_of_full_error_state * size_of_full_error_state);
284 P_updated = Utils::EnforceMatrixSymmetry(P_updated);
285
286 // Apply Core Correction
287 CoreStateVector core_correction = correction.block(0, 0, CoreStateType::size_error_, 1);
288 CoreStateType corrected_core_state = CoreStateType::ApplyCorrection(prior_core_state, core_correction);
289
290 // Apply Sensor Correction
291 const Eigen::MatrixXd sensor_correction = correction.block(size_of_core_state, 0, size_of_sensor_state, 1);
292 const AttitudeSensorStateType corrected_sensor_state = ApplyCorrection(prior_sensor_state, sensor_correction);
293
294 // Return Results
295 // CoreState data
296 CoreType core_data;
297 core_data.cov_ = P_updated.block(0, 0, CoreStateType::size_error_, CoreStateType::size_error_);
298 core_data.state_ = corrected_core_state;
299
300 // SensorState data
301 std::shared_ptr<AttitudeSensorData> sensor_data(std::make_shared<AttitudeSensorData>());
302 sensor_data->set_cov(P_updated);
303 sensor_data->state_ = corrected_sensor_state;
304
305 BufferDataType state_entry(std::make_shared<CoreType>(core_data), sensor_data);
306
308 {
309 // corrected_sensor_data.ref_to_nav = prior_ref_to_nav;
310 }
311 else
312 {
313 // TODO also estimate ref to nav
314 }
315
316 *new_state_data = state_entry;
317
318 return true;
319 }
320
321 bool CalcUpdateRPY(const Time& /*timestamp*/, const std::shared_ptr<void>& measurement,
322 const CoreStateType& prior_core_state, const std::shared_ptr<void>& latest_sensor_data,
323 const Eigen::MatrixXd& prior_cov, BufferDataType* new_state_data)
324 {
325 // Cast the sensor measurement and prior state information
326 AttitudeMeasurementType* meas = static_cast<AttitudeMeasurementType*>(measurement.get());
327 AttitudeSensorData* prior_sensor_data = static_cast<AttitudeSensorData*>(latest_sensor_data.get());
328
329 // Decompose sensor measurement
330 Eigen::Quaterniond q_meas = meas->attitude_.quaternion_;
331
332 // Extract sensor state
333 AttitudeSensorStateType prior_sensor_state(prior_sensor_data->state_);
334
335 // Generate measurement noise matrix
336 Eigen::MatrixXd R_meas_dyn;
338 {
339 meas->get_meas_noise(&R_meas_dyn);
340 }
341 else
342 {
343 R_meas_dyn = this->R_.asDiagonal();
344 }
345 const Eigen::Matrix<double, 3, 3> R_meas = R_meas_dyn;
346
347 const int size_of_core_state = CoreStateType::size_error_;
348 const int size_of_sensor_state = prior_sensor_state.cov_size_;
349 const int size_of_full_error_state = size_of_core_state + size_of_sensor_state;
350 const Eigen::MatrixXd P = prior_cov;
351 assert(P.size() == size_of_full_error_state * size_of_full_error_state);
352
353 // Calculate the measurement jacobian H
354 const Eigen::Matrix3d I_3 = Eigen::Matrix3d::Identity();
355 const Eigen::Matrix3d Z_3 = Eigen::Matrix3d::Zero();
356 const Eigen::Matrix3d R_wi = prior_core_state.q_wi_.toRotationMatrix();
357 // const Eigen::Matrix3d R_aw = prior_sensor_state.q_aw_.toRotationMatrix();
358 const Eigen::Matrix3d R_ib = prior_sensor_state.q_ib_.toRotationMatrix();
359
360 // Orientation
361 const Eigen::Matrix3d Hr_pwi = Z_3;
362 const Eigen::Matrix3d Hr_vwi = Z_3;
363 const Eigen::Matrix3d Hr_rwi = R_ib.transpose();
364 const Eigen::Matrix3d Hr_bw = Z_3;
365 const Eigen::Matrix3d Hr_ba = Z_3;
366
367 const Eigen::Matrix3d Hr_raw = R_ib.transpose() * R_wi.transpose();
368 const Eigen::Matrix3d Hr_rib = I_3;
369
370 // Assemble the jacobian for the orientation (horizontal)
371 // H_r = [Hr_pwi Hr_vwi Hr_rwi Hr_bw Hr_ba Hr_raw];
372 Eigen::MatrixXd H(3, Hr_pwi.cols() + Hr_vwi.cols() + Hr_rwi.cols() + Hr_bw.cols() + Hr_ba.cols() + Hr_raw.cols() +
373 Hr_rib.cols());
374 H << Hr_pwi, Hr_vwi, Hr_rwi, Hr_bw, Hr_ba, Hr_raw, Hr_rib;
375
376 // Calculate the residual z = z~ - (estimate)
377 // Orientation
378 const Eigen::Quaternion<double> q_est =
379 prior_sensor_state.q_aw_ * prior_core_state.q_wi_ * prior_sensor_state.q_ib_;
380 const Eigen::Quaternion<double> res_q = q_est.inverse() * q_meas;
381 residual_ = Eigen::MatrixXd(res_q.vec().rows(), 1);
382 residual_ << (2 * res_q.vec() / res_q.w());
383
384 // Perform EKF calculations
385 mars::Ekf ekf(H, R_meas, residual_, P);
386 const Eigen::MatrixXd correction = ekf.CalculateCorrection(&chi2_);
387 assert(correction.size() == size_of_full_error_state * 1);
388
389 // Perform Chi2 test
390 if (!chi2_.passed_ && chi2_.do_test_)
391 {
393 return false;
394 }
395
396 Eigen::MatrixXd P_updated = ekf.CalculateCovUpdate();
397 assert(P_updated.size() == size_of_full_error_state * size_of_full_error_state);
398 P_updated = Utils::EnforceMatrixSymmetry(P_updated);
399 // Apply Core Correction
400 CoreStateVector core_correction = correction.block(0, 0, CoreStateType::size_error_, 1);
401 CoreStateType corrected_core_state = CoreStateType::ApplyCorrection(prior_core_state, core_correction);
402
403 // Apply Sensor Correction
404 const Eigen::MatrixXd sensor_correction = correction.block(size_of_core_state, 0, size_of_sensor_state, 1);
405 const AttitudeSensorStateType corrected_sensor_state = ApplyCorrection(prior_sensor_state, sensor_correction);
406
407 // Return Results
408 // CoreState data
409 CoreType core_data;
410 core_data.cov_ = P_updated.block(0, 0, CoreStateType::size_error_, CoreStateType::size_error_);
411 core_data.state_ = corrected_core_state;
412
413 // SensorState data
414 std::shared_ptr<AttitudeSensorData> sensor_data(std::make_shared<AttitudeSensorData>());
415 sensor_data->set_cov(P_updated);
416 sensor_data->state_ = corrected_sensor_state;
417
418 BufferDataType state_entry(std::make_shared<CoreType>(core_data), sensor_data);
419
421 {
422 // corrected_sensor_data.ref_to_nav = prior_ref_to_nav;
423 }
424 else
425 {
426 // TODO also estimate ref to nav
427 }
428
429 *new_state_data = state_entry;
430
431 return true;
432 }
433
435 const Eigen::MatrixXd& correction)
436 {
437 // state + error state correction
438 // with quaternion from small angle approx -> new state
439
440 // q_aw [0,1,2] 0:2
441 // q_ib [3,4,5] 3:5
442
443 AttitudeSensorStateType corrected_sensor_state;
444
445 // select correct correction block
446 Eigen::Vector3d q_aw_correction, q_ib_correction;
447 switch (attitude_type_)
448 {
450 q_aw_correction << correction(0), correction(1), 0;
451 q_ib_correction << correction(2), correction(3), 0;
452 break;
454 q_aw_correction = correction.block(0, 0, 3, 1);
455 q_ib_correction = correction.block(3, 0, 3, 1);
456 break;
457 default:
458 std::cout << "Error: [" << this->name_ << "] Cannot perform correction (unknown type)" << std::endl;
459 q_aw_correction = Eigen::Vector3d::Zero();
460 q_ib_correction = Eigen::Vector3d::Zero();
461 break;
462 }
463
464 corrected_sensor_state.q_aw_ = Utils::ApplySmallAngleQuatCorr(prior_sensor_state.q_aw_, q_aw_correction);
465 corrected_sensor_state.q_ib_ = Utils::ApplySmallAngleQuatCorr(prior_sensor_state.q_ib_, q_ib_correction);
466
467 return corrected_sensor_state;
468 }
469};
470} // namespace mars
471
472#endif // ATTITUDE_SENSOR_CLASS_H
Definition attitude_measurement_type.h:26
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Attitude attitude_
Definition attitude_measurement_type.h:31
Definition attitude_sensor_class.h:60
AttitudeSensorStateType ApplyCorrection(const AttitudeSensorStateType &prior_sensor_state, const Eigen::MatrixXd &correction)
Definition attitude_sensor_class.h:434
AttitudeSensorStateType get_state(const std::shared_ptr< void > &sensor_data)
Definition attitude_sensor_class.h:105
BufferDataType Initialize(const Time &timestamp, std::shared_ptr< void >, std::shared_ptr< CoreType > latest_core_data)
Initialize the state of an individual sensor.
Definition attitude_sensor_class.h:123
bool CalcUpdateRP(const Time &, const std::shared_ptr< void > &measurement, const CoreStateType &prior_core_state, const std::shared_ptr< void > &latest_sensor_data, const Eigen::MatrixXd &prior_cov, BufferDataType *new_state_data)
Definition attitude_sensor_class.h:205
EIGEN_MAKE_ALIGNED_OPERATOR_NEW AttitudeSensorClass(const std::string &name, std::shared_ptr< CoreState > core_states, AttitudeSensorType type=AttitudeSensorType::RPY_TYPE)
Definition attitude_sensor_class.h:68
bool CalcUpdateRPY(const Time &, const std::shared_ptr< void > &measurement, const CoreStateType &prior_core_state, const std::shared_ptr< void > &latest_sensor_data, const Eigen::MatrixXd &prior_cov, BufferDataType *new_state_data)
Definition attitude_sensor_class.h:321
void set_initial_calib(std::shared_ptr< void > calibration)
set_initial_calib Sets the calibration of an individual sensor
Definition attitude_sensor_class.h:117
Eigen::MatrixXd get_covariance(const std::shared_ptr< void > &sensor_data)
get_covariance Resolves a void pointer to the covariance matrix of the corresponding sensor type Each...
Definition attitude_sensor_class.h:111
bool CalcUpdate(const Time &timestamp, std::shared_ptr< void > measurement, const CoreStateType &prior_core_state, std::shared_ptr< void > latest_sensor_data, const Eigen::MatrixXd &prior_cov, BufferDataType *new_state_data)
CalcUpdate Calculates the update for an individual sensor definition.
Definition attitude_sensor_class.h:187
virtual ~AttitudeSensorClass()=default
AttitudeSensorType attitude_type_
Definition attitude_sensor_class.h:63
Definition attitude_sensor_state_type.h:22
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Quaternion< double > q_aw_
Definition attitude_sensor_state_type.h:26
Eigen::Quaternion< double > q_ib_
Definition attitude_sensor_state_type.h:27
bool has_meas_noise
Definition measurement_base_class.h:23
bool get_meas_noise(Eigen::MatrixXd *meas_noise)
get the measurement noise associated with the current sensor measurement
Definition measurement_base_class.h:25
int cov_size_
Definition base_states.h:25
The BaseSensorData class binds the sensor state and covariance matrix.
Definition bind_sensor_data.h:29
EIGEN_MAKE_ALIGNED_OPERATOR_NEW T state_
Definition bind_sensor_data.h:35
Eigen::MatrixXd get_full_cov() const
get_full_cov builds the full covariance matrix
Definition bind_sensor_data.h:63
Eigen::MatrixXd sensor_cov_
covariance of the sensor states
Definition bind_sensor_data.h:37
The BufferDataType binds the core and sensor state in form of a shared void pointer.
Definition buffer_data_type.h:36
bool passed_
Determine if the test is performed or not.
Definition ekf.h:84
bool do_test_
Upper critival value.
Definition ekf.h:83
void set_dof(const int &value)
set_dof Set degree of freedom for the X2 distribution
void PrintReport(const std::string &name)
PrintReport Print a formated report e.g. if the test did not pass.
Definition core_state_type.h:21
static constexpr int size_error_
Definition core_state_type.h:38
Eigen::Quaternion< double > q_wi_
Definition core_state_type.h:29
static CoreStateType ApplyCorrection(CoreStateType state_prior, Eigen::Matrix< double, CoreStateType::size_error_, 1 > correction)
ApplyCorrection.
Definition core_state_type.h:46
Definition core_type.h:19
CoreStateMatrix cov_
Definition core_type.h:22
CoreStateType state_
Definition core_type.h:21
Definition ekf.h:92
Eigen::MatrixXd CalculateCovUpdate()
CalculateCovUpdate Updating the state covariance after the state update.
Eigen::MatrixXd CalculateCorrection()
Kalman gain.
std::string name_
Name of the individual sensor instance.
Definition sensor_abs_class.h:23
bool is_initialized_
True if the sensor has been initialized.
Definition sensor_abs_class.h:24
bool const_ref_to_nav_
True if the reference should not be estimated.
Definition sensor_abs_class.h:27
bool use_dynamic_meas_noise_
True if dynamic noise values from measurements should be used.
Definition sensor_abs_class.h:29
Definition time.h:20
Definition update_sensor_abs_class.h:24
bool initial_calib_provided_
True if an initial calibration was provided.
Definition update_sensor_abs_class.h:38
std::shared_ptr< CoreState > core_states_
Definition update_sensor_abs_class.h:42
Eigen::VectorXd R_
Measurement noise "squared".
Definition update_sensor_abs_class.h:32
std::shared_ptr< void > initial_calib_
Definition update_sensor_abs_class.h:37
Chi2 chi2_
Definition update_sensor_abs_class.h:40
Eigen::MatrixXd residual_
Definition update_sensor_abs_class.h:31
static Eigen::MatrixXd EnforceMatrixSymmetry(const Eigen::Ref< const Eigen::MatrixXd > &mat_in)
EnforceMatrixSymmetry.
static Eigen::Vector3d RPYFromRotMat(const Eigen::Matrix3d &rot_mat)
RPYFromRotMat derives the roll pitch and yaw angle from a rotation matrix (in that order)
static Eigen::Quaterniond ApplySmallAngleQuatCorr(const Eigen::Quaterniond &q_prior, const Eigen::Vector3d &correction)
ApplySmallAngleQuatCorr.
Definition buffer.h:27
AttitudeSensorType
Definition attitude_sensor_class.h:37
@ RPY_TYPE
full orientation, roll, pitch, and yaw
@ RP_TYPE
aviation attitude, roll and pitch only
Eigen::Matrix< double, CoreStateType::size_error_, 1 > CoreStateVector
Definition core_state_type.h:135
std::ostream & operator<<(std::ostream &os, AttitudeSensorType type)
Definition attitude_sensor_class.h:42
Eigen::Quaterniond quaternion_
Definition attitude_conversion.h:48
Eigen::Vector2d get_rp()
Definition attitude_conversion.h:55