#ifndef DRONE_H #define DRONE_H #include "../mathprimitives/mathprimitives.h" #include /* * Properties of the quadcopter */ struct QuadCopter { double mass_kg; struct Mat3 moment_of_inertia; double drag_coeff; }; enum PropSpinDir { CW = 1, CCW = -1 }; struct Propeller { struct Vec3 x_cg2p_b; double angular_velocity; double thrust_coefficient; double moment_coefficient; enum PropSpinDir direction; }; struct QuadCopterSim { double timestep; uint32_t iterations; struct QuadCopter quad_copter; struct Propeller props[4]; }; static inline struct Vec3 body_position_to_inertial(struct Vec3 x_o2cg_i, struct Quat attitude, struct Vec3 x_cg2point_b) { struct Vec3 x_cg2point_i = quat_apply(quat_conjugate(attitude), x_cg2point_b); return vec3_add(x_o2cg_i, x_cg2point_i); } #endif