Skip to content

Commit

Permalink
sd and controller updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-goddard committed Dec 2, 2024
1 parent d7671b6 commit ff922fe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Control Tasks/MotorControlTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ void MotorControlTask::control() {

if (duty_cycle < 1180.00) {
duty_cycle = 1180.00;
} else if (duty_cycle > 1920.00) {
duty_cycle = 1920.00;
} else if (duty_cycle > 2000.00) {
duty_cycle = 2000.00;
}
// convert duty cycle to angle for esc
angle = map(duty_cycle, 1000, 2000, 0, 180);
Expand Down
4 changes: 2 additions & 2 deletions src/Control Tasks/MotorControlTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class MotorControlTask {
double time_curr = 0.0;
double time_prev = 0.0;

double Kd = 5;
double Kp = 5;
double Kd = 50;
double Kp = 100;
double proportional = 0.0;
double derivative = 0.0;
double pulse_width = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/Control Tasks/SDControlTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void SDControlTask::execute() {
file = SD.open(sfr::sd::log_filename, FILE_WRITE);

String data = String(millis()) + "," +
String(sfr::motor::pulse_width) + "," +
String(sfr::controller::record_duty_cycle) + "," +
String(sfr::imu::accel_x) + "," +
String(sfr::imu::accel_y) + "," +
String(sfr::imu::accel_z) + "," +
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ void loop() {
vlogln(F("-------------------- START LOOP --------------------"));

imu_monitor.execute();
if (!sfr::flight::automated) {
ir_control_task.execute();
}
// if (!sfr::flight::automated) {
ir_control_task.execute();
// }
motor_control_task.execute();
sd_control_task.execute();

Expand Down

0 comments on commit ff922fe

Please sign in to comment.