Skip to content

Commit

Permalink
Global variables cleanups
Browse files Browse the repository at this point in the history
Remove unused PID objects for cli
Move loopRate to time.ino
  • Loading branch information
okalachev committed Jan 10, 2025
1 parent 85172cd commit 698cc3d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions flix/cli.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
#include "pid.h"
#include "vector.h"

extern PID rollRatePID, pitchRatePID, yawRatePID, rollPID, pitchPID;
extern LowPassFilter<Vector> ratesFilter;
extern const int MOTOR_REAR_LEFT, MOTOR_REAR_RIGHT, MOTOR_FRONT_RIGHT, MOTOR_FRONT_LEFT;
extern float loopRate;

const char* motd =
"\nWelcome to\n"
Expand Down
1 change: 0 additions & 1 deletion flix/flix.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

float t = NAN; // current step time, s
float dt; // time delta from previous step, s
float loopRate; // loop rate, Hz
int16_t channels[RC_CHANNELS]; // raw rc channels
float controls[RC_CHANNELS]; // normalized controls in range [-1..1] ([0..1] for throttle)
float controlsTime; // time of the last controls update
Expand Down
2 changes: 2 additions & 0 deletions flix/time.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// Time related functions

float loopRate; // Hz

void step() {
float now = micros() / 1000000.0;
dt = now - t;
Expand Down
1 change: 0 additions & 1 deletion gazebo/flix.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

float t = NAN;
float dt;
float loopRate;
float motors[4];
int16_t channels[16]; // raw rc channels
float controls[RC_CHANNELS];
Expand Down

0 comments on commit 698cc3d

Please sign in to comment.