From 79f2ac5450a9570c30ed15609fcc4e081d6d2835 Mon Sep 17 00:00:00 2001 From: franchioping Date: Mon, 20 Apr 2026 03:13:52 +0100 Subject: [PATCH] before sim --- main/drone.cpp | 11 ++++++----- main/drone.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/main/drone.cpp b/main/drone.cpp index dc30826..52c58b9 100644 --- a/main/drone.cpp +++ b/main/drone.cpp @@ -2,7 +2,8 @@ #include "DShotRMT.h" #include "Eigen/Core" -#include "Eigen/Geometry" #include "driver/rmt_tx.h" +#include "Eigen/Geometry" +#include "driver/rmt_tx.h" #include "drone_comms.h" #include "drone_controller.h" @@ -49,16 +50,16 @@ dcont::ControllerConfig default_config() { // Rotation Loop (Rotation/Accel -> Angular Rate) config.stack.rotation_pid = { - .kp = {1.0f, 1.0f, 2.0f}, - .ki = {0.01f, 0.01f, 0.02f}, - .kd = {0.1f, 0.1f, 0.0f}, + .kp = {1.0f, 10.0f, 2.0f}, + .ki = {0.01f, 1.0f, 0.02f}, + .kd = {0.1f, 0.0f, 0.0f}, .integral_cap = {4.0f, 4.0f, 4.0f}, .frequency = 200.0f, }; // Rate Loop (Angular Rate -> Torque) - The "Inner" Loop config.stack.rate_pid = { - .kp = {0.0f, 0.0f, 1.0f}, + .kp = {0.0f, 0.5f, 0.0f}, .ki = {0.00f, 0.00f, 0.0f}, .kd = {0.000f, 0.000f, 0.0f}, .integral_cap = {1.0f, 1.0f, 1.0f}, diff --git a/main/drone.h b/main/drone.h index 913ab3a..696b9a8 100644 --- a/main/drone.h +++ b/main/drone.h @@ -88,7 +88,7 @@ struct drone_cont_state { .yaw_input = 0.0, .pitch_input = 0.0}, .acceleration = {0.0, 0.0, 0.0}, - .rotation = {0.0, 0.05 * M_PI, 0.0}, + .rotation = {0.0, 0.0, M_PI}, .velocity = {0.0, 0.0, 0.0}, .position = {0.0, 0.0, 0.0}, .mode = dcont::ModeInput::Rotation});