|
Thunderbots Project
|


Public Member Functions | |
| BangBangTrajectory2D ()=default | |
| BangBangTrajectory2D (const Point &initial_pos, const Point &final_pos, const Vector &initial_vel, const KinematicConstraints &constraints) | |
| void | generate (const Point &initial_pos, const Point &final_pos, const Vector &initial_vel, double max_vel, double max_accel, double max_decel) |
| Point | getPosition (double t_sec) const override |
| Vector | getVelocity (double t_sec) const override |
| Vector | getAcceleration (double t_sec) const override |
| double | getTotalTime () const override |
| std::vector< Rectangle > | getBoundingBoxes () const override |
Public Member Functions inherited from Trajectory< Point, Vector, Vector > | |
| Point | getDestination () const |
Static Public Member Functions | |
| static std::shared_ptr< Trajectory2D > | generator (const Point &initial_pos, const Point &final_pos, const Vector &initial_vel, const KinematicConstraints &constraints) |
|
default |
Default constructor. Creates an empty trajectory.
| BangBangTrajectory2D | ( | const Point & | initial_pos, |
| const Point & | final_pos, | ||
| const Vector & | initial_vel, | ||
| const KinematicConstraints & | constraints | ||
| ) |
Generate a 2D trajectory from the initial position to the final position with the given initial velocity and kinematic constraints.
| initial_pos | Starting position of the trajectory |
| final_pos | Destination. Where the trajectory should end at |
| initial_vel | The initial velocity of the trajectory |
| constraints | Kinematic constraints of the new generated trajectory |
| void generate | ( | const Point & | initial_pos, |
| const Point & | final_pos, | ||
| const Vector & | initial_vel, | ||
| double | max_vel, | ||
| double | max_accel, | ||
| double | max_decel | ||
| ) |
Generate a 2D trajectory from the initial position to the final position with the given initial velocity and kinematic constraints.
| initial_pos | Starting position of the trajectory |
| final_pos | Destination. Where the trajectory should end at |
| initial_vel | The initial velocity of the trajectory |
| max_vel | The max velocity (in 2D) that the trajectory can reach at any given point |
| max_accel | The max acceleration (in 2D) that the trajectory can reach at any given point |
| max_decel | The max deceleration (in 2D) that the trajectory can reach at any given point |
The following implementation is based on section IV of the paper "Trajectory generation for four wheeled omnidirectional vehicles"
A 2D trajectories is represented as 2x 1D trajectories (one for x and one for y) which take the same amount of time to reach the destination.
The max velocity, acceleration, and deceleration are assumed to be the kinematic constraints in 2D space, as opposed to the constraints for individual x and y components. To find the components of these constraints for each axis which will give us two trajectories with (almost) equal durations, we will use binary search over the components of the given kinematic constraints.
We will start with alpha = PI/4 (45 deg) which will have the x and y components equivalent to each other. Depending on which 1D trajectory takes longer to reach the destination, we will either increase or decrease alpha by increment (= PI/(8*2^i) where i is the iteration of binary search we're at). This will result in the component which is taking longer to reach the destination to get a larger component of the kinematic constraints relative to the other component which reaches the destination faster.
|
static |
Static function for generating a BangBangTrajectory2D pointer with Trajectory2D interface
| initial_pos | Where the trajectory should start at |
| final_pos | Where the trajectory should end at |
| initial_vel | The initial velocity of the trajectory |
| constraints | The kinematic constraints of the trajectory |
|
overridevirtual |
Get the acceleration at time t
| t_sec | The time elapsed since the start of the trajectory in seconds |
Implements Trajectory< Point, Vector, Vector >.
|
overridevirtual |
Get the bounding box of the trajectory
Implements Trajectory2D.
|
overridevirtual |
Get the position at time t
| t_sec | The time elapsed since the start of the trajectory in seconds |
Implements Trajectory< Point, Vector, Vector >.
|
overridevirtual |
Get the total duration of the trajectory until it reaches the destination
Implements Trajectory< Point, Vector, Vector >.
|
overridevirtual |
Get the velocity at time t
| t_sec | The time elapsed since the start of the trajectory in seconds |
Implements Trajectory< Point, Vector, Vector >.