mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
Public Member Functions | List of all members
mars::EmptySensorClass Class Reference

#include </home/runner/work/mars_lib/mars_lib/source/mars/include/mars/sensors/empty/empty_sensor_class.h>

+ Inheritance diagram for mars::EmptySensorClass:
+ Collaboration diagram for mars::EmptySensorClass:

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW EmptySensorClass (const std::string &name, std::shared_ptr< CoreState > core_states)
 
virtual ~EmptySensorClass ()=default
 
EmptySensorStateType get_state (const std::shared_ptr< void > &sensor_data)
 
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 sensor is responsible to cast its own data type More...
 
void set_initial_calib (std::shared_ptr< void > calibration)
 set_initial_calib Sets the calibration of an individual sensor More...
 
BufferDataType Initialize (const Time &timestamp, std::shared_ptr< void >, std::shared_ptr< CoreType > latest_core_data)
 Initialize the state of an individual sensor. More...
 
bool CalcUpdate (const Time &, std::shared_ptr< void >, 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. More...
 
EmptySensorStateType ApplyCorrection (const EmptySensorStateType &prior_sensor_state, const Eigen::MatrixXd &correction)
 
- Public Member Functions inherited from mars::SensorInterface
virtual EIGEN_MAKE_ALIGNED_OPERATOR_NEW ~SensorInterface ()=default
 

Additional Inherited Members

- Public Attributes inherited from mars::UpdateSensorAbsClass
EIGEN_MAKE_ALIGNED_OPERATOR_NEW int aux_states_
 
int aux_error_states_
 
int ref_to_nav_
 
Eigen::MatrixXd residual_
 
Eigen::VectorXd R_
 Measurement noise "squared". More...
 
Eigen::MatrixXd F_
 
Eigen::MatrixXd H_
 
Eigen::MatrixXd Q_
 
std::shared_ptr< void > initial_calib_ { nullptr }
 
bool initial_calib_provided_ { false }
 True if an initial calibration was provided. More...
 
Chi2 chi2_
 
std::shared_ptr< CoreStatecore_states_
 
- Public Attributes inherited from mars::SensorAbsClass
int id_ { -1 }
 
std::string name_
 Name of the individual sensor instance. More...
 
bool is_initialized_ { false }
 True if the sensor has been initialized. More...
 
bool do_update_ { true }
 True if updates should be performed with the sensor. More...
 
int type_ { -1 }
 Future feature, holds information such as position or orientation for highlevel decissions. More...
 
bool const_ref_to_nav_ { true }
 True if the reference should not be estimated. More...
 
bool ref_to_nav_given_ { false }
 True if the reference to the navigation frame is given by initial calibration. More...
 
bool use_dynamic_meas_noise_ { false }
 True if dynamic noise values from measurements should be used. More...
 

Constructor & Destructor Documentation

◆ EmptySensorClass()

EIGEN_MAKE_ALIGNED_OPERATOR_NEW mars::EmptySensorClass::EmptySensorClass ( const std::string &  name,
std::shared_ptr< CoreState core_states 
)
inline
39  {
40  name_ = name;
41  core_states_ = std::move(core_states);
42  const_ref_to_nav_ = false;
44 
45  std::cout << "Created: [" << this->name_ << "] Sensor" << std::endl;
46  }
std::string name_
Name of the individual sensor instance.
Definition: sensor_abs_class.h:23
bool const_ref_to_nav_
True if the reference should not be estimated.
Definition: sensor_abs_class.h:27
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

◆ ~EmptySensorClass()

virtual mars::EmptySensorClass::~EmptySensorClass ( )
virtualdefault

Member Function Documentation

◆ get_state()

EmptySensorStateType mars::EmptySensorClass::get_state ( const std::shared_ptr< void > &  sensor_data)
inline
51  {
52  EmptySensorData data = *static_cast<EmptySensorData*>(sensor_data.get());
53  return data.state_;
54  }
BindSensorData< EmptySensorStateType > EmptySensorData
Definition: empty_sensor_class.h:30

◆ get_covariance()

Eigen::MatrixXd mars::EmptySensorClass::get_covariance ( const std::shared_ptr< void > &  sensor_data)
inlinevirtual

get_covariance Resolves a void pointer to the covariance matrix of the corresponding sensor type Each sensor is responsible to cast its own data type

Parameters
sensor_data
Returns
Covariance matrix contained in the sensor data struct

Implements mars::SensorInterface.

57  {
58  EmptySensorData data = *static_cast<EmptySensorData*>(sensor_data.get());
59  return data.get_full_cov();
60  }
+ Here is the call graph for this function:

◆ set_initial_calib()

void mars::EmptySensorClass::set_initial_calib ( std::shared_ptr< void >  calibration)
inlinevirtual

set_initial_calib Sets the calibration of an individual sensor

Parameters
calibration

Implements mars::SensorInterface.

63  {
64  initial_calib_ = calibration;
66  }
std::shared_ptr< void > initial_calib_
Definition: update_sensor_abs_class.h:37

◆ Initialize()

BufferDataType mars::EmptySensorClass::Initialize ( const Time timestamp,
std::shared_ptr< void >  measurement,
std::shared_ptr< CoreType latest_core_data 
)
inlinevirtual

Initialize the state of an individual sensor.

Parameters
timestampcurrent timestamp
measurementcurrent sensor measurement
latest_core_data
Returns

Implements mars::SensorInterface.

70  {
71  // EmptyMeasurementType measurement = *static_cast<EmptyMeasurementType*>(sensor_data.get());
72 
73  EmptySensorData sensor_state;
74  std::string calibration_type;
75 
76  if (this->initial_calib_provided_)
77  {
78  calibration_type = "Given";
79 
80  EmptySensorData calib = *static_cast<EmptySensorData*>(initial_calib_.get());
81 
82  sensor_state.state_ = calib.state_;
83  sensor_state.sensor_cov_ = calib.sensor_cov_;
84  }
85  else
86  {
87  std::cout << "Empty calibration AUTO init not implemented yet" << std::endl;
88  exit(EXIT_FAILURE);
89  }
90 
91  // Bypass core state for the returned object
92  BufferDataType result(std::make_shared<CoreType>(*latest_core_data.get()),
93  std::make_shared<EmptySensorData>(sensor_state));
94 
95  is_initialized_ = true;
96 
97  std::cout << "Info: Initialized [" << name_ << "] with [" << calibration_type << "] Calibration at t=" << timestamp
98  << std::endl;
99 
100  std::cout << "Info: [" << name_ << "] Calibration(rounded):" << std::endl;
101  std::cout << "\tPosition[m]: [" << sensor_state.state_.value_.transpose() << " ]" << std::endl;
102 
103  return result;
104  }
bool is_initialized_
True if the sensor has been initialized.
Definition: sensor_abs_class.h:24

◆ CalcUpdate()

bool mars::EmptySensorClass::CalcUpdate ( const Time timestamp,
std::shared_ptr< void >  measurement,
const CoreStateType prior_core_state_data,
std::shared_ptr< void >  latest_sensor_data,
const Eigen::MatrixXd &  prior_cov,
BufferDataType new_state_data 
)
inlinevirtual

CalcUpdate Calculates the update for an individual sensor definition.

Parameters
timestampcurrent timestamp
measurementcurrent sensor measurement
prior_core_state_data
latest_sensor_data
prior_covPrior covariance containing core, sensor and sensor cross covariance
new_state_dataUpdated state data
Returns
True if the update was successful, false if the update was rejected

Implements mars::SensorInterface.

109  {
110  // Cast the sensor measurement and prior state information
111  // EmptyMeasurementType* meas = static_cast<EmptyMeasurementType*>(measurement.get());
112  EmptySensorData* prior_sensor_data = static_cast<EmptySensorData*>(latest_sensor_data.get());
113 
114  // Extract sensor state
115  EmptySensorStateType prior_sensor_state(prior_sensor_data->state_);
116 
117  // Return Results
118  // CoreState data
119  CoreType core_data;
120  core_data.cov_ = prior_cov.block(0, 0, CoreStateType::size_error_, CoreStateType::size_error_);
121  core_data.state_ = prior_core_state;
122 
123  // SensorState data
124  std::shared_ptr<EmptySensorData> sensor_data(std::make_shared<EmptySensorData>());
125  sensor_data->set_cov(prior_cov);
126  sensor_data->state_ = prior_sensor_state;
127 
128  BufferDataType state_entry(std::make_shared<CoreType>(core_data), sensor_data);
129 
130  *new_state_data = state_entry;
131 
132  return true;
133  }
static constexpr int size_error_
Definition: core_state_type.h:38

◆ ApplyCorrection()

EmptySensorStateType mars::EmptySensorClass::ApplyCorrection ( const EmptySensorStateType prior_sensor_state,
const Eigen::MatrixXd &  correction 
)
inline
137  {
138  // state + error state correction
139  // with quaternion from small angle approx -> new state
140 
141  EmptySensorStateType corrected_sensor_state;
142  corrected_sensor_state.value_ = prior_sensor_state.value_ + correction.block(0, 0, 3, 1);
143  return corrected_sensor_state;
144  }

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