49 #ifndef ILQGAMES_DYNAMICS_SINGLE_PLAYER_DELAYED_DUBINS_CAR_H 50 #define ILQGAMES_DYNAMICS_SINGLE_PLAYER_DELAYED_DUBINS_CAR_H 52 #include <ilqgames/dynamics/single_player_dynamical_system.h> 53 #include <ilqgames/utils/types.h> 55 #include <glog/logging.h> 68 VectorXf Evaluate(Time t,
const VectorXf& x,
const VectorXf& u)
const;
71 void Linearize(Time t,
const VectorXf& x,
const VectorXf& u,
72 Eigen::Ref<MatrixXf> A, Eigen::Ref<MatrixXf> B)
const;
75 std::vector<Dimension> PositionDimensions()
const {
return {kPxIdx, kPyIdx}; }
78 static const Dimension kNumXDims;
79 static const Dimension kPxIdx;
80 static const Dimension kPyIdx;
81 static const Dimension kThetaIdx;
82 static const Dimension kOmegaIdx;
85 static const Dimension kNumUDims;
86 static const Dimension kAlphaIdx;
95 inline VectorXf SinglePlayerDelayedDubinsCar::Evaluate(
96 Time t,
const VectorXf& x,
const VectorXf& u)
const {
98 xdot(kPxIdx) = v_ * std::cos(x(kThetaIdx));
99 xdot(kPyIdx) = v_ * std::sin(x(kThetaIdx));
100 xdot(kThetaIdx) = x(kOmegaIdx);
101 xdot(kOmegaIdx) = u(kAlphaIdx);
106 inline void SinglePlayerDelayedDubinsCar::Linearize(
107 Time t,
const VectorXf& x,
const VectorXf& u, Eigen::Ref<MatrixXf> A,
108 Eigen::Ref<MatrixXf> B)
const {
109 const float ctheta = std::cos(x(kThetaIdx)) * time::kTimeStep;
110 const float stheta = std::sin(x(kThetaIdx)) * time::kTimeStep;
112 A(kPxIdx, kThetaIdx) += -v_ * stheta;
113 A(kPyIdx, kThetaIdx) += v_ * ctheta;
114 A(kThetaIdx, kOmegaIdx) += time::kTimeStep;
116 B(kOmegaIdx, kAlphaIdx) = time::kTimeStep;