48 #ifndef ILQGAMES_DYNAMICS_SINGLE_PLAYER_DUBINS_CAR_H 49 #define ILQGAMES_DYNAMICS_SINGLE_PLAYER_DUBINS_CAR_H 51 #include <ilqgames/dynamics/single_player_dynamical_system.h> 52 #include <ilqgames/utils/types.h> 54 #include <glog/logging.h> 67 VectorXf Evaluate(Time t,
const VectorXf& x,
const VectorXf& u)
const;
70 void Linearize(Time t,
const VectorXf& x,
const VectorXf& u,
71 Eigen::Ref<MatrixXf> A, Eigen::Ref<MatrixXf> B)
const;
74 std::vector<Dimension> PositionDimensions()
const {
return {kPxIdx, kPyIdx}; }
77 static const Dimension kNumXDims;
78 static const Dimension kPxIdx;
79 static const Dimension kPyIdx;
80 static const Dimension kThetaIdx;
83 static const Dimension kNumUDims;
84 static const Dimension kOmegaIdx;
93 inline VectorXf SinglePlayerDubinsCar::Evaluate(Time t,
const VectorXf& x,
94 const VectorXf& u)
const {
96 xdot(kPxIdx) = v_ * std::cos(x(kThetaIdx));
97 xdot(kPyIdx) = v_ * std::sin(x(kThetaIdx));
98 xdot(kThetaIdx) = u(kOmegaIdx);
103 inline void SinglePlayerDubinsCar::Linearize(Time t,
106 Eigen::Ref<MatrixXf> A,
107 Eigen::Ref<MatrixXf> B)
const {
108 const float ctheta = std::cos(x(kThetaIdx)) * time::kTimeStep;
109 const float stheta = std::sin(x(kThetaIdx)) * time::kTimeStep;
111 A(kPxIdx, kThetaIdx) += -v_ * stheta;
112 A(kPyIdx, kThetaIdx) += v_ * ctheta;
114 B(kThetaIdx, kOmegaIdx) = time::kTimeStep;