Skip to content

Commit

Permalink
moving some physical constants so they can be config dependants
Browse files Browse the repository at this point in the history
  • Loading branch information
LAMBERT des CILLEULS Charles committed Jan 4, 2024
1 parent 101de77 commit fc022b6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/modules/src/controller/controller_brescianini.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "num.h"
#include "math3d.h"
#include "physicalConstants.h"
#include "platform_defaults.h"

static struct mat33 CRAZYFLIE_INERTIA =
{{{16.6e-6f, 0.83e-6f, 0.72e-6f},
Expand Down
1 change: 1 addition & 0 deletions src/modules/src/controller/controller_mellinger.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ We added the following:
#include "position_controller.h"
#include "controller_mellinger.h"
#include "physicalConstants.h"
#include "platform_defaults.h"

// Global state variable used in the
// firmware as the only instance and in bindings
Expand Down
3 changes: 2 additions & 1 deletion src/modules/src/power_distribution_quadrotor.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "autoconf.h"
#include "config.h"
#include "math.h"
#include "platform_defaults.h"

#ifndef CONFIG_MOTORS_DEFAULT_IDLE_THRUST
# define DEFAULT_IDLE_THRUST 0
Expand All @@ -41,7 +42,7 @@
#endif

static uint32_t idleThrust = DEFAULT_IDLE_THRUST;
static float armLength = 0.046f; // m;
static float armLength = ARM_LENGTH; // m
static float thrustToTorque = 0.005964552f;

// thrust = a * pwm^2 + b * pwm
Expand Down
10 changes: 10 additions & 0 deletions src/platform/interface/platform_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
#include "platform_defaults_flapper.h"
#endif

// Drone physical constants
#ifndef ARM_LENGTH
// m
#define ARM_LENGTH 0.046f
#endif
#ifndef CF_MASS
// kg
#define CF_MASS 0.027f
#endif

// IMU alignment on the airframe
#ifndef IMU_PHI
#define IMU_PHI 0.0f
Expand Down
4 changes: 0 additions & 4 deletions src/utils/interface/physicalConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,3 @@
#ifndef ARCMINUTE
#define ARCMINUTE (M_PI_F / 10800.0f)
#endif

#ifndef CF_MASS
#define CF_MASS (0.027f) // in kg
#endif

0 comments on commit fc022b6

Please sign in to comment.