1#ifndef BITSIM_DYNAMICS_QUADROTOR_DYNAMICS_H
2#define BITSIM_DYNAMICS_QUADROTOR_DYNAMICS_H
218 real_t phi() const noexcept {
return get_euler_angles_from_state_()[0]; }
223 real_t theta() const noexcept {
return get_euler_angles_from_state_()[1]; }
228 real_t psi() const noexcept {
return get_euler_angles_from_state_()[2]; }
266 void update_position_();
271 void update_rotation_matrix_();
273 void update_euler_angles_();
281inline RealColVec3d QuadrotorDynamics::get_velocity_from_state_()
const
291inline RealColVec3d QuadrotorDynamics::get_position_from_state_()
const
301inline RealColVec3d QuadrotorDynamics::get_angular_velocity_from_state_()
const
311inline RealColVec3d QuadrotorDynamics::get_euler_angles_from_state_()
const
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
The DynamicsMatrixDescriptor class. Helper class to model the matrix representon of dynamical systems...
Definition dynamics_matrix_descriptor.h:19
MotionModelDynamicsBase(bool update_description_matrices_on_evaluate=true)
RealVec input_type
Definition motion_model_base.h:31
real_t get_state_property(const std::string &name) const
Definition motion_model_base.h:114
SysState< 12 > state_type
Definition motion_model_base.h:29
typename matrix_descriptor_type::vector_type vector_type
Definition motion_model_base.h:34
typename matrix_descriptor_type::matrix_type matrix_type
Definition motion_model_base.h:33
RealColVec3d get_velocity() const
Returns the current linear velocity (body frame).
Definition quadrotor_dynamics.h:203
base_type::vector_type vector_type
vector_t
Definition quadrotor_dynamics.h:156
virtual state_type & evaluate(const input_type &input) override
Evaluate the new state using the given input it also updates the various matrices if needed.
Definition quadrotor_dynamics.cpp:26
QuadrotorDynamics(QuadrotorDynamicsConfig config, SysState< 12 > &state)
QuadrotorDynamics Constructor. Specify the configuration parameters of the simulated quadrotor....
Definition quadrotor_dynamics.cpp:13
real_t phi() const noexcept
The phi Euler angle in rad.
Definition quadrotor_dynamics.h:218
RealColVec3d get_position() const
Returns the current position in the NED world frame. The height above the start is -z.
Definition quadrotor_dynamics.h:198
base_type::input_type input_type
input_t The type of the input for solving the dynamics
Definition quadrotor_dynamics.h:146
real_t psi() const noexcept
The psi Euler angle in rad.
Definition quadrotor_dynamics.h:228
RealColVec3d get_angular_velocity() const
Returns the current angular velocity (body frame).
Definition quadrotor_dynamics.h:208
RealColVec3d get_euler_angles() const
Returns the Euler angles (0: phi, 1: theta, 2:psi).
Definition quadrotor_dynamics.h:213
void rotational_dynamics(const RealVec &motor_w)
Implements the translational dynamics. It accepts the motors angular velocities. Notice that this mod...
Definition quadrotor_dynamics.cpp:116
void translational_dynamics(const RealVec &motor_w)
Implements the translational dynamics. It accepts the motors angular velocities. Notice that this mod...
Definition quadrotor_dynamics.cpp:166
real_t theta() const noexcept
The theta Euler angle in rad.
Definition quadrotor_dynamics.h:223
base_type::state_type state_type
The type of the state handled by this dynamics object.
Definition quadrotor_dynamics.h:141
base_type::matrix_type matrix_type
matrix_t Matrix type that describes the dynamics
Definition quadrotor_dynamics.h:151
void integrate(const RealVec &motor_w)
Integrate the new state. It also uses error terms.
Definition quadrotor_dynamics.cpp:32
MotionModelDynamicsBase< SysState< 12 >, DynamicsMatrixDescriptor, RealVec > base_type
Definition quadrotor_dynamics.h:136
SysState utility class describing the state of a system.
Definition system_state.h:25
Models of how things move: wheeled robots, a bicycle, a quadrotor and a fixed wing aircraft,...
Definition bicycle_vehicle_model_dynamics.cpp:10
DynVec< real_t > RealVec
double precision floating point vector
Definition bitsim_types.h:111
Eigen::Matrix3< real_t > RealMat3d
3×3 matrix of type double.
Definition bitsim_types.h:86
double real_t
real_t
Definition bitsim_types.h:20
Eigen::Vector3d RealColVec3d
3D column vector
Definition bitsim_types.h:137
Definition quadrotor_dynamics.h:13
real_t mass
mass
Definition quadrotor_dynamics.h:27
real_t k_2
Proportionality constant to scale the morot velocity used when calculating torques.
Definition quadrotor_dynamics.h:45
real_t Jy
Definition quadrotor_dynamics.h:66
real_t Jz
Definition quadrotor_dynamics.h:71
real_t k_1
Proportionality constant to scale the morot velocity.
Definition quadrotor_dynamics.h:38
bool use_description_matrices
Definition quadrotor_dynamics.h:22
real_t drag
Linear air drag [kg/s]: a force of -drag * v on the body. 0, the default, leaves it out....
Definition quadrotor_dynamics.h:51
real_t dt
The time step to use.
Definition quadrotor_dynamics.h:56
real_t l
the arm length
Definition quadrotor_dynamics.h:32
real_t Jx
Definition quadrotor_dynamics.h:61
bool use_gravity
flag indicating if gravity is used
Definition quadrotor_dynamics.h:17