Create basic data structs

This commit is contained in:
Alex Selimov 2026-10-31 23:12:53 -04:00
parent c9b25ea88e
commit 8f4d61f820
4 changed files with 137 additions and 0 deletions

38
cixdof/drone.h Normal file
View file

@ -0,0 +1,38 @@
#ifndef DRONE_H
#define DRONE_H
#include "../mathprimitives/mathprimitives.h"
#include <stdint.h>
struct QuadCopter {
double mass_kg;
struct Mat3 moment_of_intertia;
double drag_coeff;
};
enum PropSpinDir { CW, CCW };
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