mirror of
https://github.com/okalachev/flix.git
synced 2025-07-29 20:38:59 +00:00
Make motor indexes definition const int and move them to motors.ino
Remove motor indexes definitions from flix.ino Add motors.ino to simulation code and implement required mocks
This commit is contained in:
parent
e3873c99c5
commit
8c9bff0813
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
extern PID rollRatePID, pitchRatePID, yawRatePID, rollPID, pitchPID;
|
extern PID rollRatePID, pitchRatePID, yawRatePID, rollPID, pitchPID;
|
||||||
extern LowPassFilter<Vector> ratesFilter;
|
extern LowPassFilter<Vector> ratesFilter;
|
||||||
|
extern const int MOTOR_REAR_LEFT, MOTOR_REAR_RIGHT, MOTOR_FRONT_RIGHT, MOTOR_FRONT_LEFT;
|
||||||
|
|
||||||
const char* motd =
|
const char* motd =
|
||||||
"\nWelcome to\n"
|
"\nWelcome to\n"
|
||||||
|
@ -50,6 +50,8 @@ Vector ratesTarget;
|
|||||||
Vector torqueTarget;
|
Vector torqueTarget;
|
||||||
float thrustTarget;
|
float thrustTarget;
|
||||||
|
|
||||||
|
extern const int MOTOR_REAR_LEFT, MOTOR_REAR_RIGHT, MOTOR_FRONT_RIGHT, MOTOR_FRONT_LEFT;
|
||||||
|
|
||||||
void control() {
|
void control() {
|
||||||
interpretRC();
|
interpretRC();
|
||||||
failsafe();
|
failsafe();
|
||||||
|
@ -18,11 +18,6 @@
|
|||||||
#define RC_CHANNEL_ARMED 4
|
#define RC_CHANNEL_ARMED 4
|
||||||
#define RC_CHANNEL_MODE 5
|
#define RC_CHANNEL_MODE 5
|
||||||
|
|
||||||
#define MOTOR_REAR_LEFT 0
|
|
||||||
#define MOTOR_REAR_RIGHT 1
|
|
||||||
#define MOTOR_FRONT_RIGHT 2
|
|
||||||
#define MOTOR_FRONT_LEFT 3
|
|
||||||
|
|
||||||
#define ONE_G 9.80665
|
#define ONE_G 9.80665
|
||||||
|
|
||||||
float t = NAN; // current step time, s
|
float t = NAN; // current step time, s
|
||||||
|
@ -13,6 +13,12 @@
|
|||||||
#define PWM_FREQUENCY 500
|
#define PWM_FREQUENCY 500
|
||||||
#define PWM_RESOLUTION 8
|
#define PWM_RESOLUTION 8
|
||||||
|
|
||||||
|
// Motors array indexes:
|
||||||
|
const int MOTOR_REAR_LEFT = 0;
|
||||||
|
const int MOTOR_REAR_RIGHT = 1;
|
||||||
|
const int MOTOR_FRONT_RIGHT = 2;
|
||||||
|
const int MOTOR_FRONT_LEFT = 3;
|
||||||
|
|
||||||
void setupMotors() {
|
void setupMotors() {
|
||||||
Serial.println("Setup Motors");
|
Serial.println("Setup Motors");
|
||||||
|
|
||||||
|
@ -133,6 +133,9 @@ void delay(uint32_t ms) {
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) { return true; }
|
||||||
|
bool ledcWrite(uint8_t pin, uint32_t duty) { return true; }
|
||||||
|
|
||||||
unsigned long __micros;
|
unsigned long __micros;
|
||||||
unsigned long __resetTime = 0;
|
unsigned long __resetTime = 0;
|
||||||
|
|
||||||
|
@ -12,11 +12,6 @@
|
|||||||
|
|
||||||
#define RC_CHANNELS 16
|
#define RC_CHANNELS 16
|
||||||
|
|
||||||
#define MOTOR_REAR_LEFT 0
|
|
||||||
#define MOTOR_FRONT_LEFT 3
|
|
||||||
#define MOTOR_FRONT_RIGHT 2
|
|
||||||
#define MOTOR_REAR_RIGHT 1
|
|
||||||
|
|
||||||
#define WIFI_ENABLED 1
|
#define WIFI_ENABLED 1
|
||||||
|
|
||||||
#define ONE_G 9.80665
|
#define ONE_G 9.80665
|
||||||
@ -43,6 +38,7 @@ void controlAttitude();
|
|||||||
void controlRate();
|
void controlRate();
|
||||||
void controlTorque();
|
void controlTorque();
|
||||||
void showTable();
|
void showTable();
|
||||||
|
void sendMotors();
|
||||||
bool motorsActive();
|
bool motorsActive();
|
||||||
void cliTestMotor(uint8_t n);
|
void cliTestMotor(uint8_t n);
|
||||||
void printRCCal();
|
void printRCCal();
|
||||||
@ -59,6 +55,5 @@ inline Quaternion FLU2FRD(const Quaternion &q);
|
|||||||
void setLED(bool on) {};
|
void setLED(bool on) {};
|
||||||
void calibrateGyro() { printf("Skip gyro calibrating\n"); };
|
void calibrateGyro() { printf("Skip gyro calibrating\n"); };
|
||||||
void calibrateAccel() { printf("Skip accel calibrating\n"); };
|
void calibrateAccel() { printf("Skip accel calibrating\n"); };
|
||||||
void sendMotors() {};
|
|
||||||
void printIMUCal() { printf("cal: N/A\n"); };
|
void printIMUCal() { printf("cal: N/A\n"); };
|
||||||
void printIMUInfo() {};
|
void printIMUInfo() {};
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "util.ino"
|
#include "util.ino"
|
||||||
#include "rc.ino"
|
#include "rc.ino"
|
||||||
#include "time.ino"
|
#include "time.ino"
|
||||||
|
#include "motors.ino"
|
||||||
#include "estimate.ino"
|
#include "estimate.ino"
|
||||||
#include "control.ino"
|
#include "control.ino"
|
||||||
#include "log.ino"
|
#include "log.ino"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user