mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 17:49:33 +00:00
Print low pass filters parameters and current mode in cli
This commit is contained in:
parent
6d2518e635
commit
6dae4abaa2
13
flix/cli.ino
13
flix/cli.ino
@ -4,8 +4,10 @@
|
|||||||
// Implementation of command line interface
|
// Implementation of command line interface
|
||||||
|
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
|
#include "vector.h"
|
||||||
|
|
||||||
extern PID rollRatePID, pitchRatePID, yawRatePID, rollPID, pitchPID;
|
extern PID rollRatePID, pitchRatePID, yawRatePID, rollPID, pitchPID;
|
||||||
|
extern LowPassFilter<Vector> ratesFilter;
|
||||||
|
|
||||||
const char* motd =
|
const char* motd =
|
||||||
"\nWelcome to\n"
|
"\nWelcome to\n"
|
||||||
@ -47,7 +49,13 @@ const struct Param {
|
|||||||
{"yi", &yawRatePID.i, nullptr},
|
{"yi", &yawRatePID.i, nullptr},
|
||||||
{"yd", &yawRatePID.d, nullptr},
|
{"yd", &yawRatePID.d, nullptr},
|
||||||
|
|
||||||
|
{"lpr", &ratesFilter.alpha, nullptr},
|
||||||
|
{"lpd", &rollRatePID.lpf.alpha, &pitchRatePID.lpf.alpha},
|
||||||
|
|
||||||
{"ss", &loopFreq, nullptr},
|
{"ss", &loopFreq, nullptr},
|
||||||
|
{"dt", &dt, nullptr},
|
||||||
|
{"t", &t, nullptr},
|
||||||
|
|
||||||
// {"m", &mode, nullptr},
|
// {"m", &mode, nullptr},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,12 +75,13 @@ void doCommand(String& command, String& value)
|
|||||||
Serial.printf("acc: %f %f %f\n", acc.x, acc.y, acc.z);
|
Serial.printf("acc: %f %f %f\n", acc.x, acc.y, acc.z);
|
||||||
printIMUCal();
|
printIMUCal();
|
||||||
} else if (command == "rc") {
|
} else if (command == "rc") {
|
||||||
Serial.printf("RAW throttle %d yaw %d pitch %d roll %d aux %d mode %d\n",
|
Serial.printf("Raw: throttle %d yaw %d pitch %d roll %d aux %d mode %d\n",
|
||||||
channels[RC_CHANNEL_THROTTLE], channels[RC_CHANNEL_YAW], channels[RC_CHANNEL_PITCH],
|
channels[RC_CHANNEL_THROTTLE], channels[RC_CHANNEL_YAW], channels[RC_CHANNEL_PITCH],
|
||||||
channels[RC_CHANNEL_ROLL], channels[RC_CHANNEL_AUX], channels[RC_CHANNEL_MODE]);
|
channels[RC_CHANNEL_ROLL], channels[RC_CHANNEL_AUX], channels[RC_CHANNEL_MODE]);
|
||||||
Serial.printf("CONTROL throttle %f yaw %f pitch %f roll %f aux %f mode %f\n",
|
Serial.printf("Control: throttle %f yaw %f pitch %f roll %f aux %f mode %f\n",
|
||||||
controls[RC_CHANNEL_THROTTLE], controls[RC_CHANNEL_YAW], controls[RC_CHANNEL_PITCH],
|
controls[RC_CHANNEL_THROTTLE], controls[RC_CHANNEL_YAW], controls[RC_CHANNEL_PITCH],
|
||||||
controls[RC_CHANNEL_ROLL], controls[RC_CHANNEL_AUX], controls[RC_CHANNEL_MODE]);
|
controls[RC_CHANNEL_ROLL], controls[RC_CHANNEL_AUX], controls[RC_CHANNEL_MODE]);
|
||||||
|
Serial.printf("Mode: %s\n", getModeName());
|
||||||
} else if (command == "mot") {
|
} else if (command == "mot") {
|
||||||
Serial.printf("MOTOR front-right %f front-left %f rear-right %f rear-left %f\n",
|
Serial.printf("MOTOR front-right %f front-left %f rear-right %f rear-left %f\n",
|
||||||
motors[MOTOR_FRONT_RIGHT], motors[MOTOR_FRONT_LEFT], motors[MOTOR_REAR_RIGHT], motors[MOTOR_REAR_LEFT]);
|
motors[MOTOR_FRONT_RIGHT], motors[MOTOR_FRONT_LEFT], motors[MOTOR_REAR_RIGHT], motors[MOTOR_REAR_LEFT]);
|
||||||
|
@ -267,3 +267,13 @@ inline void indicateSaturation() {
|
|||||||
setLED(motorsSaturation);
|
setLED(motorsSaturation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* getModeName()
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
case MANUAL: return "MANUAL";
|
||||||
|
case ACRO: return "ACRO";
|
||||||
|
case STAB: return "STAB";
|
||||||
|
default: return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user