#include <aversive.h>
#include <vect2.h>
#include <robot_system.h>
Go to the source code of this file.
Data Structures | |
struct | trajectory |
Enumerations | |
enum | trajectory_state { READY, RUNNING_A, RUNNING_D, RUNNING_AD, RUNNING_XY_START, RUNNING_XY_ANGLE, RUNNING_XY_ANGLE_OK, RUNNING_XY_F_START, RUNNING_XY_F_ANGLE, RUNNING_XY_F_ANGLE_OK } |
Functions | |
void | trajectory_init (struct trajectory *traj) |
void | trajectory_set_cs (struct trajectory *traj, struct cs *cs_d, struct cs *cs_a) |
void | trajectory_set_robot_params (struct trajectory *traj, struct robot_system *rs, struct robot_position *pos) |
void | trajectory_set_speed (struct trajectory *traj, int16_t d_speed, int16_t a_speed) |
void | trajectory_set_windows (struct trajectory *traj, double d_win, double a_win_deg, double a_start_deg) |
uint8_t | trajectory_finished (struct trajectory *traj) |
uint8_t | trajectory_in_window (struct trajectory *traj, double d_win, double a_win_rad) |
void | trajectory_stop (struct trajectory *traj) |
void | trajectory_hardstop (struct trajectory *traj) |
void | trajectory_d_rel (struct trajectory *traj, double d_cm) |
void | trajectory_only_d_rel (struct trajectory *traj, double d_cm) |
void | trajectory_a_rel (struct trajectory *traj, double a_deg) |
void | trajectory_a_abs (struct trajectory *traj, double a_deg) |
void | trajectory_turnto_xy (struct trajectory *traj, double x_abs_cm, double y_abs_cm) |
void | trajectory_turnto_xy_behind (struct trajectory *traj, double x_abs_cm, double y_abs_cm) |
void | trajectory_only_a_rel (struct trajectory *traj, double a_deg) |
void | trajectory_d_a_rel (struct trajectory *traj, double d_cm, double a_deg) |
void | trajectory_goto_xy_abs (struct trajectory *traj, double x_abs_cm, double y_abs_cm) |
void | trajectory_goto_forward_xy_abs (struct trajectory *traj, double x_abs_cm, double y_abs_cm) |
void | trajectory_goto_d_a_rel (struct trajectory *traj, double d, double a) |
void | trajectory_goto_xy_rel (struct trajectory *traj, double x_rel_cm, double y_rel_cm) |
enum trajectory_state |
READY | |
RUNNING_A | |
RUNNING_D | |
RUNNING_AD | |
RUNNING_XY_START | |
RUNNING_XY_ANGLE | |
RUNNING_XY_ANGLE_OK | |
RUNNING_XY_F_START | |
RUNNING_XY_F_ANGLE | |
RUNNING_XY_F_ANGLE_OK |
Definition at line 29 of file trajectory_manager.h.
void trajectory_a_abs | ( | struct trajectory * | traj, | |
double | a_deg_abs | |||
) |
go to angle 'a' in degrees
turn by 'a' degrees
Definition at line 286 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), trajectory::position, position_get_a_rad_double(), RAD, RESET_D, RUNNING_A, trajectory::state, UPDATE_A, and UPDATE_D.
void trajectory_a_rel | ( | struct trajectory * | traj, | |
double | a_deg_rel | |||
) |
turn by 'a' degrees
Definition at line 279 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), RAD, RESET_D, RUNNING_A, trajectory::state, UPDATE_A, and UPDATE_D.
void trajectory_d_a_rel | ( | struct trajectory * | traj, | |
double | d_cm, | |||
double | a_deg | |||
) |
turn by 'a' degrees and go by 'd' cm
turn by 'a' degrees
Definition at line 333 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), RAD, RUNNING_AD, trajectory::state, UPDATE_A, and UPDATE_D.
void trajectory_d_rel | ( | struct trajectory * | traj, | |
double | d_cm | |||
) |
go straight forward (d is in cm)
Definition at line 265 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), RESET_A, RUNNING_D, trajectory::state, UPDATE_A, and UPDATE_D.
uint8_t trajectory_finished | ( | struct trajectory * | traj | ) |
return true if the position consign is equal to the filtered position consign (after quadramp filter), for angle and distance.
Definition at line 442 of file trajectory_manager.c.
References cs_get_consign(), cs_get_filtered_consign(), trajectory::csm_angle, and trajectory::csm_distance.
void trajectory_goto_d_a_rel | ( | struct trajectory * | traj, | |
double | d, | |||
double | a | |||
) |
go forward to a d,a point, using a trajectory event
Definition at line 391 of file trajectory_manager.c.
References trajectory::cart, DEBUG, E_TRAJECTORY, gen_regs::p, trajectory::position, position_get_a_rad_double(), position_get_x_double(), position_get_y_double(), _vect2_pol::r, RAD, RUNNING_XY_START, trajectory::state, trajectory::target, _vect2_pol::theta, vect2_pol2cart(), _vect2_cart::x, and _vect2_cart::y.
void trajectory_goto_forward_xy_abs | ( | struct trajectory * | traj, | |
double | x, | |||
double | y | |||
) |
go forward to a x,y point, using a trajectory event
Definition at line 379 of file trajectory_manager.c.
References trajectory::cart, DEBUG, E_TRAJECTORY, RUNNING_XY_F_START, trajectory::state, trajectory::target, _vect2_cart::x, and _vect2_cart::y.
void trajectory_goto_xy_abs | ( | struct trajectory * | traj, | |
double | x, | |||
double | y | |||
) |
goto a x,y point, using a trajectory event
Definition at line 367 of file trajectory_manager.c.
References trajectory::cart, DEBUG, E_TRAJECTORY, RUNNING_XY_START, trajectory::state, trajectory::target, _vect2_cart::x, and _vect2_cart::y.
void trajectory_goto_xy_rel | ( | struct trajectory * | traj, | |
double | x_rel_cm, | |||
double | y_rel_cm | |||
) |
go forward to a x,y relative point, using a trajectory event
Definition at line 412 of file trajectory_manager.c.
References trajectory::cart, DEBUG, E_TRAJECTORY, gen_regs::p, trajectory::position, position_get_a_rad_double(), position_get_x_double(), position_get_y_double(), RUNNING_XY_START, trajectory::state, trajectory::target, _vect2_pol::theta, vect2_cart2pol(), vect2_pol2cart(), _vect2_cart::x, and _vect2_cart::y.
void trajectory_hardstop | ( | struct trajectory * | traj | ) |
set relative angle and distance consign to 0, and break any deceleration ramp in quadramp filter
Definition at line 348 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), cs::consign_filter_params, trajectory::csm_angle, trajectory::csm_distance, quadramp_filter::previous_out, quadramp_filter::previous_var, READY, RESET_A, RESET_D, trajectory::robot, rs_get_angle(), rs_get_distance(), trajectory::state, UPDATE_A, and UPDATE_D.
uint8_t trajectory_in_window | ( | struct trajectory * | traj, | |
double | d_win, | |||
double | a_win_rad | |||
) |
return true if traj is nearly finished depending on specified parameters
return true if traj is nearly finished
Definition at line 449 of file trajectory_manager.c.
References RUNNING_A, RUNNING_AD, RUNNING_D, RUNNING_XY_ANGLE, RUNNING_XY_ANGLE_OK, RUNNING_XY_F_ANGLE, RUNNING_XY_F_ANGLE_OK, RUNNING_XY_F_START, RUNNING_XY_START, and trajectory::state.
void trajectory_init | ( | struct trajectory * | traj | ) |
structure initialization
Definition at line 50 of file trajectory_manager.c.
References IRQ_LOCK, IRQ_UNLOCK, READY, trajectory::scheduler_task, and trajectory::state.
void trajectory_only_a_rel | ( | struct trajectory * | traj, | |
double | a_deg | |||
) |
update angle consign without changing distance consign
Definition at line 326 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), RAD, RUNNING_A, trajectory::state, and UPDATE_A.
void trajectory_only_d_rel | ( | struct trajectory * | traj, | |
double | d_cm | |||
) |
update distance consign without changing angle consign
Definition at line 272 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), RUNNING_D, trajectory::state, and UPDATE_D.
void trajectory_set_cs | ( | struct trajectory * | traj, | |
struct cs * | cs_d, | |||
struct cs * | cs_a | |||
) |
structure initialization
Definition at line 62 of file trajectory_manager.c.
References trajectory::csm_angle, trajectory::csm_distance, IRQ_LOCK, and IRQ_UNLOCK.
void trajectory_set_robot_params | ( | struct trajectory * | traj, | |
struct robot_system * | rs, | |||
struct robot_position * | pos | |||
) |
structure initialization
Definition at line 74 of file trajectory_manager.c.
References IRQ_LOCK, IRQ_UNLOCK, trajectory::position, and trajectory::robot.
void trajectory_set_speed | ( | struct trajectory * | traj, | |
int16_t | d_speed, | |||
int16_t | a_speed | |||
) |
set speed consign
Definition at line 86 of file trajectory_manager.c.
References trajectory::a_speed, trajectory::d_speed, IRQ_LOCK, and IRQ_UNLOCK.
void trajectory_set_windows | ( | struct trajectory * | traj, | |
double | d_win, | |||
double | a_win_deg, | |||
double | a_start_deg | |||
) |
set windows for trajectory. params: distance window, angle window: we the robot enters this position window, we deletes the event and the last consign is used. a_start_deg used in xy consigns (start to move in distance when a_target < a_start)
set windows for trajectory
Definition at line 96 of file trajectory_manager.c.
References trajectory::a_start_rad, trajectory::a_win_rad, trajectory::d_win, IRQ_LOCK, IRQ_UNLOCK, and RAD.
void trajectory_stop | ( | struct trajectory * | traj | ) |
set relative angle and distance consign to 0
Definition at line 340 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), READY, RESET_A, RESET_D, trajectory::state, UPDATE_A, and UPDATE_D.
void trajectory_turnto_xy | ( | struct trajectory * | traj, | |
double | x_abs_cm, | |||
double | y_abs_cm | |||
) |
turn the robot until the point x,y is in front of us
Definition at line 298 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), DEBUG, E_TRAJECTORY, trajectory::position, position_get_a_rad_double(), position_get_x_double(), position_get_y_double(), RESET_D, RUNNING_A, trajectory::state, UPDATE_A, and UPDATE_D.
void trajectory_turnto_xy_behind | ( | struct trajectory * | traj, | |
double | x_abs_cm, | |||
double | y_abs_cm | |||
) |
turn the robot until the point x,y is behind us
Definition at line 312 of file trajectory_manager.c.
References __trajectory_goto_d_a_rel(), DEBUG, E_TRAJECTORY, trajectory::position, position_get_a_rad_double(), position_get_x_double(), position_get_y_double(), RESET_D, RUNNING_A, trajectory::state, UPDATE_A, and UPDATE_D.