shit going to be deleting. change up stacked structure
This commit is contained in:
parent
6f61d4ab43
commit
137a610ab9
|
|
@ -19,6 +19,13 @@ pub struct PositionInput {
|
||||||
pub alt: f32,
|
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)]
|
#[derive(Default, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum ModeInput {
|
pub enum ModeInput {
|
||||||
#[default]
|
#[default]
|
||||||
|
|
@ -30,6 +37,7 @@ pub enum ModeInput {
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub joystick: JoystickInput,
|
pub joystick: JoystickInput,
|
||||||
pub position: PositionInput,
|
pub position: PositionInput,
|
||||||
|
pub rotation: RotationInput,
|
||||||
pub mode: ModeInput,
|
pub mode: ModeInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,6 +112,7 @@ impl InputRecording {
|
||||||
let input = Input {
|
let input = Input {
|
||||||
joystick: JoystickInput::from_keyboard(),
|
joystick: JoystickInput::from_keyboard(),
|
||||||
position: Default::default(),
|
position: Default::default(),
|
||||||
|
rotation: Default::default(),
|
||||||
mode: ModeInput::Acro,
|
mode: ModeInput::Acro,
|
||||||
};
|
};
|
||||||
let last_input = self.records.last();
|
let last_input = self.records.last();
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ impl StackedController {
|
||||||
max_angle,
|
max_angle,
|
||||||
frequency,
|
frequency,
|
||||||
} => (
|
} => (
|
||||||
ControllerModule::Angle {
|
ControllerModule::Rotation {
|
||||||
processor: PidProcessor::new(pid),
|
processor: PidProcessor::new(pid),
|
||||||
max_angle: *max_angle,
|
max_angle: *max_angle,
|
||||||
},
|
},
|
||||||
|
|
@ -57,7 +57,7 @@ impl StackedController {
|
||||||
max_rate,
|
max_rate,
|
||||||
frequency,
|
frequency,
|
||||||
} => (
|
} => (
|
||||||
ControllerModule::Rate {
|
ControllerModule::AngularRate {
|
||||||
processor: PidProcessor::new(pid),
|
processor: PidProcessor::new(pid),
|
||||||
max_rate: *max_rate,
|
max_rate: *max_rate,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ use crate::drone::stacked::DroneState;
|
||||||
use nalgebra as na;
|
use nalgebra as na;
|
||||||
|
|
||||||
pub enum ControllerModule {
|
pub enum ControllerModule {
|
||||||
Rate {
|
AngularRate {
|
||||||
processor: PidProcessor,
|
processor: PidProcessor,
|
||||||
max_rate: f32,
|
max_rate: f32,
|
||||||
},
|
},
|
||||||
Angle {
|
Rotation {
|
||||||
processor: PidProcessor,
|
processor: PidProcessor,
|
||||||
max_angle: f32,
|
max_angle: f32,
|
||||||
},
|
},
|
||||||
|
|
@ -29,7 +29,7 @@ impl ControllerModule {
|
||||||
is_first_layer: bool,
|
is_first_layer: bool,
|
||||||
) -> na::Vector3<f32> {
|
) -> na::Vector3<f32> {
|
||||||
match self {
|
match self {
|
||||||
ControllerModule::Angle {
|
ControllerModule::Rotation {
|
||||||
processor,
|
processor,
|
||||||
max_angle,
|
max_angle,
|
||||||
} => {
|
} => {
|
||||||
|
|
@ -47,7 +47,7 @@ impl ControllerModule {
|
||||||
processor.update(target_angles, current_angles, dt)
|
processor.update(target_angles, current_angles, dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerModule::Rate {
|
ControllerModule::AngularRate {
|
||||||
processor,
|
processor,
|
||||||
max_rate,
|
max_rate,
|
||||||
} => {
|
} => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue