Skip to content

Commit

Permalink
add more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
makeecat committed Aug 31, 2024
1 parent 9a820fb commit 58c7c11
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub struct MeshConfig {
/// Spacing between the squares in meters
pub spacing: f32,
}

/// Implementation of the Config struct
impl Config {
/// Load configuration from a YAML file.
/// # Arguments
Expand Down
38 changes: 19 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct Quadrotor {
/// Inverse of the inertia matrix
pub inertia_matrix_inv: Matrix3<f32>,
}

/// Implementation of the Quadrotor struct
impl Quadrotor {
/// Creates a new Quadrotor with default parameters
/// # Arguments
Expand Down Expand Up @@ -142,7 +142,7 @@ pub struct Imu {
/// Standard deviation of gyroscope bias drift
pub gyro_bias_std: f32,
}

/// Implements the IMU
impl Imu {
/// Creates a new IMU with default parameters
/// # Arguments
Expand Down Expand Up @@ -222,7 +222,7 @@ pub struct PIDController {
/// Maximum allowed integral error for attitude
pub max_integral_att: Vector3<f32>,
}

/// Implementation of PIDController
impl PIDController {
/// Creates a new PIDController with default gains
/// gains are in the order of proportional, derivative, and integral
Expand Down Expand Up @@ -342,6 +342,7 @@ pub enum PlannerType {
/// Minimum snap waypoint planner
MinimumSnapWaypoint(MinimumSnapWaypointPlanner),
}
/// Implementation of the planner type
impl PlannerType {
/// Plans the trajectory based on the current planner type
/// # Arguments
Expand Down Expand Up @@ -403,7 +404,6 @@ pub trait Planner {
current_velocity: Vector3<f32>,
time: f32,
) -> (Vector3<f32>, Vector3<f32>, f32);

/// Checks if the current trajectory is finished
/// # Arguments
/// * `current_position` - The current position of the quadrotor
Expand All @@ -423,7 +423,7 @@ pub struct HoverPlanner {
/// Target yaw angle for hovering
pub target_yaw: f32,
}

/// Implementation of the `Planner` trait for the `HoverPlanner`
impl Planner for HoverPlanner {
fn plan(
&self,
Expand Down Expand Up @@ -457,7 +457,7 @@ pub struct MinimumJerkLinePlanner {
/// Duration of the trajectory
pub duration: f32,
}

/// Implementation of the planner trait for minimum jerk line planner
impl Planner for MinimumJerkLinePlanner {
fn plan(
&self,
Expand Down Expand Up @@ -506,7 +506,7 @@ pub struct LissajousPlanner {
/// Ramp-up time for smooth transitions
pub ramp_time: f32,
}

/// Implementation of the planner trait for Lissajous curve trajectories
impl Planner for LissajousPlanner {
fn plan(
&self,
Expand Down Expand Up @@ -578,7 +578,7 @@ pub struct CirclePlanner {
/// Ramp-up time for smooth transitions
pub ramp_time: f32,
}

/// Implementation of the Planner trait for CirclePlanner
impl Planner for CirclePlanner {
fn plan(
&self,
Expand Down Expand Up @@ -624,7 +624,6 @@ impl Planner for CirclePlanner {
Ok(time >= self.start_time + self.duration)
}
}

/// Planner for landing maneuvers
pub struct LandingPlanner {
/// Starting position of the landing maneuver
Expand All @@ -636,7 +635,7 @@ pub struct LandingPlanner {
/// Starting yaw angle
pub start_yaw: f32,
}

/// Implementation of the Planner trait for LandingPlanner
impl Planner for LandingPlanner {
fn plan(
&self,
Expand All @@ -661,9 +660,10 @@ impl Planner for LandingPlanner {
}
/// Manages different trajectory planners and switches between them
pub struct PlannerManager {
/// The current planner
pub current_planner: PlannerType,
}

/// Implementation of the PlannerManager
impl PlannerManager {
/// Creates a new PlannerManager with an initial hover planner
/// # Arguments
Expand Down Expand Up @@ -749,7 +749,7 @@ pub struct ObstacleAvoidancePlanner {
/// Maximum speed of the quadrotor
pub max_speed: f32,
}

/// Implementation of the Planner trait for ObstacleAvoidancePlanner
impl Planner for ObstacleAvoidancePlanner {
fn plan(
&self,
Expand Down Expand Up @@ -793,7 +793,7 @@ impl Planner for ObstacleAvoidancePlanner {
&& time >= self.start_time + self.duration)
}
}

/// Implementation of the ObstacleAvoidancePlanner
impl ObstacleAvoidancePlanner {
/// A smooth attractive force function that transitions from linear to exponential decay
/// When the distance to the target is less than the target distance, the force is linear
Expand Down Expand Up @@ -826,7 +826,7 @@ pub struct MinimumSnapWaypointPlanner {
/// Start time of the trajectory
pub start_time: f32,
}

/// Implementation of the MinimumSnapWaypointPlanner
impl MinimumSnapWaypointPlanner {
/// Generate a new minimum snap waypoint planner
/// # Arguments
Expand Down Expand Up @@ -964,7 +964,7 @@ impl MinimumSnapWaypointPlanner {
(position, velocity, yaw, yaw_rate)
}
}

/// Implement the `Planner` trait for `MinimumSnapWaypointPlanner`
impl Planner for MinimumSnapWaypointPlanner {
fn plan(
&self,
Expand Down Expand Up @@ -1186,7 +1186,6 @@ pub fn parse_vector3(
})
.ok_or_else(|| SimulationError::OtherError(format!("Invalid {} vector", key)))
}

// Helper function to parse f32 from YAML
// # Arguments
// * `value` - YAML value
Expand All @@ -1211,7 +1210,7 @@ pub struct Obstacle {
/// The radius of the obstacle
pub radius: f32,
}

/// Implementation of the Obstacle
impl Obstacle {
/// Creates a new obstacle with the given position, velocity, and radius
/// # Arguments
Expand Down Expand Up @@ -1241,6 +1240,7 @@ pub struct Maze {
/// The bounds of the obstacles' radius
pub obstacles_radius_bounds: [f32; 2],
}
/// Implementation of the maze
impl Maze {
/// Creates a new maze with the given bounds and number of obstacles
/// # Arguments
Expand Down Expand Up @@ -1321,7 +1321,7 @@ pub struct Camera {
/// The ray directions of each pixel in the camera
pub ray_directions: Vec<Vector3<f32>>,
}

/// Implementation of the camera
impl Camera {
/// Creates a new camera with the given resolution, field of view, near and far clipping planes
/// # Arguments
Expand Down Expand Up @@ -1556,7 +1556,7 @@ pub struct Trajectory {
/// The minimum distance between points to log
pub min_distance_threadhold: f32,
}

/// Implement the Trajectory struct
impl Trajectory {
/// Create a new Trajectory instance
/// # Arguments
Expand Down

0 comments on commit 58c7c11

Please sign in to comment.