Trait Planner

Source
pub trait Planner {
    // Required methods
    fn plan(
        &self,
        current_position: Vector3<f32>,
        current_velocity: Vector3<f32>,
        time: f32,
    ) -> (Vector3<f32>, Vector3<f32>, f32);
    fn is_finished(
        &self,
        current_position: Vector3<f32>,
        time: f32,
    ) -> Result<bool, SimulationError>;
}
Expand description

Trait defining the interface for trajectory planners

§Example

use nalgebra::Vector3;
use peng_quad::{Planner, SimulationError};
struct TestPlanner;
impl Planner for TestPlanner {
   fn plan(
        &self,
        current_position: Vector3<f32>,
        current_velocity: Vector3<f32>,
        time: f32,
) -> (Vector3<f32>, Vector3<f32>, f32) {
        (Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 0.0, 0.0), 0.0)
    }
    fn is_finished(
        &self,
        current_position: Vector3<f32>,
        time: f32,
    ) -> Result<bool, SimulationError> {
        Ok(true)
    }
}

Required Methods§

Source

fn plan( &self, current_position: Vector3<f32>, current_velocity: Vector3<f32>, time: f32, ) -> (Vector3<f32>, Vector3<f32>, f32)

Plans the trajectory based on the current state and time

§Arguments
  • current_position - The current position of the quadrotor
  • current_velocity - The current velocity of the quadrotor
  • time - The current simulation time
§Returns
  • A tuple containing the desired position, velocity, and yaw angle
§Example
use nalgebra::Vector3;
use peng_quad::{Planner, SimulationError};
struct TestPlanner;
impl Planner for TestPlanner {
    fn plan(
        &self,
        current_position: Vector3<f32>,
        current_velocity: Vector3<f32>,
        time: f32,
) -> (Vector3<f32>, Vector3<f32>, f32) {
        (Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 0.0, 0.0), 0.0)
    }
    fn is_finished(
        &self,
        current_position: Vector3<f32>,
        time: f32,
    ) -> Result<bool, SimulationError> {
        Ok(true)
    }
}
Source

fn is_finished( &self, current_position: Vector3<f32>, time: f32, ) -> Result<bool, SimulationError>

Checks if the current trajectory is finished

§Arguments
  • current_position - The current position of the quadrotor
  • time - The current simulation time
§Returns
  • true if the trajectory is finished, false otherwise
§Example
use nalgebra::Vector3;
use peng_quad::{Planner, SimulationError};
struct TestPlanner;
impl Planner for TestPlanner {
    fn plan(
        &self,
        current_position: Vector3<f32>,
        current_velocity: Vector3<f32>,
        time: f32,
) -> (Vector3<f32>, Vector3<f32>, f32) {
        (Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 0.0, 0.0), 0.0)
    }
    fn is_finished(
        &self,
        current_position: Vector3<f32>,
        time: f32,
    ) -> Result<bool, SimulationError> {
        Ok(true)
    }
}

Implementors§

Source§

impl Planner for CirclePlanner

Implementation of the Planner trait for CirclePlanner

Source§

impl Planner for HoverPlanner

Implementation of the Planner trait for the HoverPlanner

Source§

impl Planner for LandingPlanner

Implementation of the Planner trait for ‘LandingPlanner’

Source§

impl Planner for LissajousPlanner

Implementation of the planner trait for Lissajous curve trajectories

Source§

impl Planner for MinimumJerkLinePlanner

Implementation of the planner trait for minimum jerk line planner

Source§

impl Planner for MinimumSnapWaypointPlanner

Implement the Planner trait for MinimumSnapWaypointPlanner

Source§

impl Planner for ObstacleAvoidancePlanner

Implementation of the Planner trait for ObstacleAvoidancePlanner

Source§

impl Planner for QPpolyTrajPlanner

Implement the Planner trait for QPpolyTrajPlanner