shit going to be deleting. change up stacked structure

This commit is contained in:
franchioping 2026-02-24 12:31:52 +00:00
parent 6f61d4ab43
commit 137a610ab9
3 changed files with 15 additions and 6 deletions

View File

@ -19,6 +19,13 @@ pub struct PositionInput {
pub alt: f32,
}
#[derive(Default, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RotationInput {
pub roll: f32,
pub yaw: f32,
pub pitch: f32,
}
#[derive(Default, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum ModeInput {
#[default]
@ -30,6 +37,7 @@ pub enum ModeInput {
pub struct Input {
pub joystick: JoystickInput,
pub position: PositionInput,
pub rotation: RotationInput,
pub mode: ModeInput,
}
@ -104,6 +112,7 @@ impl InputRecording {
let input = Input {
joystick: JoystickInput::from_keyboard(),
position: Default::default(),
rotation: Default::default(),
mode: ModeInput::Acro,
};
let last_input = self.records.last();

View File

@ -46,7 +46,7 @@ impl StackedController {
max_angle,
frequency,
} => (
ControllerModule::Angle {
ControllerModule::Rotation {
processor: PidProcessor::new(pid),
max_angle: *max_angle,
},
@ -57,7 +57,7 @@ impl StackedController {
max_rate,
frequency,
} => (
ControllerModule::Rate {
ControllerModule::AngularRate {
processor: PidProcessor::new(pid),
max_rate: *max_rate,
},

View File

@ -3,11 +3,11 @@ use crate::drone::stacked::DroneState;
use nalgebra as na;
pub enum ControllerModule {
Rate {
AngularRate {
processor: PidProcessor,
max_rate: f32,
},
Angle {
Rotation {
processor: PidProcessor,
max_angle: f32,
},
@ -29,7 +29,7 @@ impl ControllerModule {
is_first_layer: bool,
) -> na::Vector3<f32> {
match self {
ControllerModule::Angle {
ControllerModule::Rotation {
processor,
max_angle,
} => {
@ -47,7 +47,7 @@ impl ControllerModule {
processor.update(target_angles, current_angles, dt)
}
ControllerModule::Rate {
ControllerModule::AngularRate {
processor,
max_rate,
} => {