Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
constant_velocity_model.cpp
Go to the documentation of this file.
1
3
5
6
7Eigen::Vector3d ConstantVelocityModel::get_pose_difference(const Eigen::Vector3d &previous_pose,
8 const Eigen::VectorXd &motion_data,
9 const double delta_t) {
10 Eigen::Vector3d pose_difference;
11 pose_difference(0) =
12 (motion_data(0) * ::cos(previous_pose(2)) - motion_data(1) * ::sin(previous_pose(2))) *
13 delta_t;
14 pose_difference(1) =
15 (motion_data(0) * ::sin(previous_pose(2)) + motion_data(1) * ::cos(previous_pose(2))) *
16 delta_t;
17 pose_difference(2) = common_lib::maths::normalize_angle(motion_data(2) * delta_t);
18 return pose_difference;
19}
20
21Eigen::Matrix3d ConstantVelocityModel::get_jacobian_pose(const Eigen::Vector3d &previous_pose,
22 const Eigen::VectorXd &motion_data,
23 const double delta_t) {
24 Eigen::Matrix3d jacobian = Eigen::Matrix3d::Identity();
25 jacobian(0, 2) =
26 -(motion_data(0) * ::sin(previous_pose(2)) + motion_data(1) * ::cos(previous_pose(2))) *
27 delta_t;
28 jacobian(1, 2) =
29 (motion_data(0) * ::cos(previous_pose(2)) - motion_data(1) * ::sin(previous_pose(2))) *
30 delta_t;
31 return jacobian;
32}
33
35 const Eigen::Vector3d &previous_pose, [[maybe_unused]] const Eigen::VectorXd &motion_data,
36 const double delta_t) {
37 Eigen::MatrixXd jacobian = Eigen::MatrixXd::Zero(3, 4);
38 jacobian(0, 0) = ::cos(previous_pose(2)) * delta_t;
39 jacobian(0, 1) = -::sin(previous_pose(2)) * delta_t;
40 jacobian(1, 0) = ::sin(previous_pose(2)) * delta_t;
41 jacobian(1, 1) = ::cos(previous_pose(2)) * delta_t;
42 jacobian(2, 2) = delta_t;
43 return jacobian;
44}
Eigen::Matrix3d get_jacobian_pose(const Eigen::Vector3d &previous_pose, const Eigen::VectorXd &motion_data, const double delta_t) override
Get the Jacobian matrix of the motion model in relation to the pose (state)
Eigen::Vector3d get_pose_difference(const Eigen::Vector3d &previous_pose, const Eigen::VectorXd &motion_data, const double delta_t) override
Gives the increments to the pose instead of the next pose.
Eigen::MatrixXd get_jacobian_motion_data(const Eigen::Vector3d &previous_pose, const Eigen::VectorXd &motion_data, const double delta_t) override
Get the Jacobian matrix of the motion model in relation to motion data (commands)
double normalize_angle(double angle)
Function to keep angle in [-Pi, Pi[ radians.