45 #ifndef FASTRACK_DYNAMICS_QUADROTOR_DECOUPLED_6D_H 46 #define FASTRACK_DYNAMICS_QUADROTOR_DECOUPLED_6D_H 58 using control::QuadrotorControl;
59 using control::QuadrotorControlBoundBox;
60 using state::PositionVelocity;
62 template <
typename CB>
64 :
public Dynamics<PositionVelocity, QuadrotorControl, CB, Empty> {
68 :
Dynamics<PositionVelocity, QuadrotorControl, CB,
Empty>() {}
70 :
Dynamics<PositionVelocity, QuadrotorControl, CB,
Empty>(bound) {}
72 :
Dynamics<PositionVelocity, QuadrotorControl, CB,
Empty>(params) {}
76 inline PositionVelocity
Evaluate(
const PositionVelocity &x,
77 const QuadrotorControl &u)
const {
79 const Vector3d position_dot(x.Velocity());
84 const Vector3d velocity_dot(
constants::G * std::tan(u.pitch),
88 return PositionVelocity(position_dot, velocity_dot);
96 const PositionVelocity &x,
const PositionVelocity &value_gradient)
const {
99 throw std::runtime_error(
100 "QuadrotorDecoupled6D: uninitialized call to OptimalControl.");
104 QuadrotorControl negative_grad;
105 negative_grad.yaw_rate = 0.0;
106 negative_grad.pitch = -value_gradient.Vx();
107 negative_grad.roll = value_gradient.Vy();
108 negative_grad.thrust = -value_gradient.Vz();
111 QuadrotorControl c = this->
control_bound_->ProjectToSurface(negative_grad);
119 throw std::runtime_error(
"QuadrotorDecoupled6D: ToRos is unimplemented.");
125 throw std::runtime_error(
"QuadrotorDecoupled6D: FromRos is unimplemented.");
QuadrotorDecoupled6D(const CB &bound)
void FromRos(const Empty &res)
QuadrotorControl OptimalControl(const PositionVelocity &x, const PositionVelocity &value_gradient) const
PositionVelocity Evaluate(const PositionVelocity &x, const QuadrotorControl &u) const
QuadrotorDecoupled6D(const std::vector< double > ¶ms)
std::unique_ptr< CB > control_bound_
static constexpr double G