-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcarDynamicsSim.hpp
More file actions
84 lines (70 loc) · 2.33 KB
/
carDynamicsSim.hpp
File metadata and controls
84 lines (70 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @file carDynamicsSim.hpp
* @author Ezra Tal
* @brief Car dynamics simulator class header file
*
*/
#ifndef CARDYNAMICSSIM_H
#define CARDYNAMICSSIM_H
#include <random>
#include <Eigen/Dense>
#include <Eigen/Geometry>
/**
* @brief Car dynamics simulator class
*
*/
class CarDynamicsSim{
public:
CarDynamicsSim(
const double maxSteeringAngle,
const double minSpeed,
const double maxSpeed,
const Eigen::Vector2d & velProcNoiseAutoCorr);
void setNoiseSeed(
const unsigned seed);
void setVehicleProperties(
const double maxSteeringAngle,
const double minSpeed,
const double maxSpeed,
const Eigen::Vector2d & velProcNoiseAutoCorr);
void setVehicleState(
const Eigen::Vector2d & position,
const Eigen::Vector2d & velocity,
const Eigen::Rotation2Dd & heading);
void getVehicleState(
Eigen::Vector2d & position,
Eigen::Vector2d & velocity,
Eigen::Rotation2Dd & heading);
void setVehiclePosition(const Eigen::Vector2d & position);
void setVehicleVelocity(const Eigen::Vector2d & velocity);
void setVehicleHeading(const Eigen::Rotation2Dd & heading);
Eigen::Vector2d getVehiclePosition(void);
Eigen::Vector2d getVehicleVelocity(void);
Eigen::Rotation2Dd getVehicleHeading(void);
void proceedState_ExplicitEuler(
const double dt_secs,
const double speed,
const double steeringAngle);
private:
/// @name Vehicle properties
//@{
double maxSteeringAngle_;
double minSpeed_;
double maxSpeed_;
Eigen::Vector2d velocityProcessNoiseAutoCorrelation_;
//@}
/// @name Vehicle state
//@{
Eigen::Vector2d position_;
Eigen::Vector2d velocity_;
Eigen::Rotation2Dd heading_;
//@}
/// @name Std normal RNG
//@{
std::default_random_engine randomNumberGenerator_;
std::normal_distribution<double> standardNormalDistribution_ = std::normal_distribution<double>(0.0,1.0);
//@}
Eigen::Vector2d getPositionDerivative(void);
double getHeadingDerivative(const double steeringAngle);
};
#endif // CARDYNAMICSSIM_H