Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moving some physical constants so they can be config dependants #1338

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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