Cheetah Software  1.0
ImuSimulator.h
Go to the documentation of this file.
1 
5 #ifndef PROJECT_IMUSIMULATOR_H
6 #define PROJECT_IMUSIMULATOR_H
7 
10 #include "SimUtilities/IMUTypes.h"
11 #include "cppTypes.h"
12 
13 #include <random>
14 
15 template <typename T>
16 class ImuSimulator {
17  public:
18  explicit ImuSimulator(SimulatorControlParameters& simSettings, u64 seed = 0)
19  : _simSettings(simSettings),
20  _mt(seed),
21  _vectornavGyroDistribution(-simSettings.vectornav_imu_gyro_noise,
22  simSettings.vectornav_imu_gyro_noise),
24  -simSettings.vectornav_imu_accelerometer_noise,
25  simSettings.vectornav_imu_accelerometer_noise),
26  _vectornavQuatDistribution(-simSettings.vectornav_imu_quat_noise,
27  simSettings.vectornav_imu_quat_noise) {
28  if (simSettings.vectornav_imu_quat_noise != 0) {
30  }
31  }
32 
33  void updateVectornav(const FBModelState<T>& robotState,
34  const FBModelStateDerivative<T>& robotStateD,
35  VectorNavData* data);
36 
37 
38  void computeAcceleration(const FBModelState<T>& robotState,
39  const FBModelStateDerivative<T>& robotStateD,
40  Vec3<float>& acc,
41  std::uniform_real_distribution<float>& dist,
42  const RotMat<float>& R_body);
43 
44  void updateCheaterState(const FBModelState<T>& robotState,
45  const FBModelStateDerivative<T>& robotStateD,
46  CheaterState<T>& state);
47 
48  private:
50  std::mt19937 _mt;
51  std::uniform_real_distribution<float> _vectornavGyroDistribution;
52  std::uniform_real_distribution<float> _vectornavAccelerometerDistribution;
53  std::uniform_real_distribution<float> _vectornavQuatDistribution;
55 };
56 #endif // PROJECT_IMUSIMULATOR_H
std::uniform_real_distribution< float > _vectornavQuatDistribution
Definition: ImuSimulator.h:53
void updateCheaterState(const FBModelState< T > &robotState, const FBModelStateDerivative< T > &robotStateD, CheaterState< T > &state)
ImuSimulator(SimulatorControlParameters &simSettings, u64 seed=0)
Definition: ImuSimulator.h:18
SimulatorControlParameters & _simSettings
Definition: ImuSimulator.h:49
bool _vectorNavOrientationNoise
Definition: ImuSimulator.h:54
typename Eigen::Matrix< T, 3, 1 > Vec3
Definition: cppTypes.h:26
void updateVectornav(const FBModelState< T > &robotState, const FBModelStateDerivative< T > &robotStateD, VectorNavData *data)
std::uniform_real_distribution< float > _vectornavGyroDistribution
Definition: ImuSimulator.h:51
std::uniform_real_distribution< float > _vectornavAccelerometerDistribution
Definition: ImuSimulator.h:52
std::mt19937 _mt
Definition: ImuSimulator.h:50
uint64_t u64
Definition: cTypes.h:17
void computeAcceleration(const FBModelState< T > &robotState, const FBModelStateDerivative< T > &robotStateD, Vec3< float > &acc, std::uniform_real_distribution< float > &dist, const RotMat< float > &R_body)
Data from IMUs.
typename Eigen::Matrix< T, 3, 3 > RotMat
Definition: cppTypes.h:18
Implementation of Rigid Body Floating Base model data structure.