Skip to content

Commit

Permalink
thrust and acceleration clamping
Browse files Browse the repository at this point in the history
  • Loading branch information
friend0 committed Nov 18, 2024
1 parent c22bb6e commit f16a01c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use std::time::Instant;

mod liftoff_quad;

#[tokio::main]
/// Main function for the simulation
fn main() -> Result<(), SimulationError> {
async fn main() -> Result<(), SimulationError> {
let mut config_str = "config/liftoff_quad.yaml";
let args: Vec<String> = std::env::args().collect();
if args.len() != 2 {
Expand Down Expand Up @@ -166,6 +167,8 @@ fn main() -> Result<(), SimulationError> {
&quad_state.velocity,
time_step,
);
// Clamp thrust
let thrust = thrust.clamp(0.0, quad.max_thrust());
// Clamp angles for angle mode flight
if let Some(angle_limits) = config.angle_limits.clone() {
let angle_limits = Vector3::new(angle_limits[0], angle_limits[1], angle_limits[2]);
Expand Down

0 comments on commit f16a01c

Please sign in to comment.