44 #ifndef FASTRACK_DYNAMICS_PLANAR_DUBINS_DYNAMICS_3D_H 45 #define FASTRACK_DYNAMICS_PLANAR_DUBINS_DYNAMICS_3D_H 50 #include <fastrack_srvs/PlanarDubinsPlannerDynamics.h> 51 #include <fastrack_srvs/PlanarDubinsPlannerDynamicsResponse.h> 58 using state::PlanarDubins3D;
59 using control::ScalarBoundInterval;
62 :
public Dynamics<PlanarDubins3D, double, ScalarBoundInterval,
63 fastrack_srvs::PlanarDubinsPlannerDynamics::Response> {
67 :
Dynamics<PlanarDubins3D, double, ScalarBoundInterval,
68 fastrack_srvs::PlanarDubinsPlannerDynamics::Response>() {}
70 :
Dynamics<PlanarDubins3D, double, ScalarBoundInterval,
71 fastrack_srvs::PlanarDubinsPlannerDynamics::Response>(bound),
76 :
Dynamics<PlanarDubins3D, double, ScalarBoundInterval,
77 fastrack_srvs::PlanarDubinsPlannerDynamics::Response>() {
82 const double& u_upper)
83 :
Dynamics<PlanarDubins3D, double, ScalarBoundInterval,
84 fastrack_srvs::PlanarDubinsPlannerDynamics::Response>(
85 ScalarBoundInterval(u_lower, u_upper)),
88 constexpr
double kSmallNumber = 1e-8;
90 throw std::runtime_error(
"Non-symmetric control bound.");
94 double V()
const {
return v_; }
104 if (params.size() != 3) {
105 throw std::runtime_error(
"Incorrect number of parameters: " +
106 std::to_string(params.size()));
110 control_bound_.reset(
new ScalarBoundInterval(params[1], params[2]));
115 inline PlanarDubins3D
Evaluate(
const PlanarDubins3D& x,
116 const double& u)
const {
117 const PlanarDubins3D x_dot(
v_ * std::cos(x.Theta()),
118 v_ * std::sin(x.Theta()), u);
127 const PlanarDubins3D& value_gradient)
const {
128 throw std::runtime_error(
129 "PlanarDubinsDynamics3D: OptimalControl is unimplemented.");
130 return std::numeric_limits<double>::quiet_NaN();
134 inline fastrack_srvs::PlanarDubinsPlannerDynamics::Response
ToRos()
const {
136 throw std::runtime_error(
"PlanarDubinsDynamics3D was not initialized.");
138 fastrack_srvs::PlanarDubinsPlannerDynamics::Response res;
147 const fastrack_srvs::PlanarDubinsPlannerDynamics::Response& res) {
150 new ScalarBoundInterval(-res.max_yaw_rate, res.max_yaw_rate));
void FromRos(const fastrack_srvs::PlanarDubinsPlannerDynamics::Response &res)
double TurningRadius() const
double OptimalControl(const PlanarDubins3D &x, const PlanarDubins3D &value_gradient) const
PlanarDubinsDynamics3D(const std::vector< double > ¶ms)
void Initialize(const std::vector< double > ¶ms)
~PlanarDubinsDynamics3D()
PlanarDubinsDynamics3D(double v, const double &u_lower, const double &u_upper)
fastrack_srvs::PlanarDubinsPlannerDynamics::Response ToRos() const
PlanarDubinsDynamics3D(double v, const ScalarBoundInterval &bound)
std::unique_ptr< ScalarBoundInterval > control_bound_
PlanarDubins3D Evaluate(const PlanarDubins3D &x, const double &u) const