#include <math.h>
#include <robot_system.h>
Go to the source code of this file.
Data Structures | |
struct | robot_physical_params |
struct | xya_position |
struct | xya_position_s16 |
struct | robot_position |
Functions | |
void | position_init (struct robot_position *pos) |
void | position_set (struct robot_position *pos, int16_t x, int16_t y, int16_t a) |
void | position_use_ext (struct robot_position *pos) |
void | position_use_mot (struct robot_position *pos) |
void | position_set_physical_params (struct robot_position *pos, double track_cm, double distance_imp_per_cm) |
void | position_set_related_robot_system (struct robot_position *pos, struct robot_system *rs) |
void | position_manage (struct robot_position *pos) |
int16_t | position_get_x_s16 (struct robot_position *pos) |
int16_t | position_get_y_s16 (struct robot_position *pos) |
int16_t | position_get_a_deg_s16 (struct robot_position *pos) |
double | position_get_x_double (struct robot_position *pos) |
double | position_get_y_double (struct robot_position *pos) |
double | position_get_a_rad_double (struct robot_position *pos) |
int16_t position_get_a_deg_s16 | ( | struct robot_position * | pos | ) |
returns current alpha
Definition at line 214 of file position_manager.c.
References xya_position_s16::a, and robot_position::pos_s16.
double position_get_a_rad_double | ( | struct robot_position * | pos | ) |
returns current alpha
Definition at line 240 of file position_manager.c.
References xya_position::a, and robot_position::pos_d.
Referenced by __trajectory_goto_d_a_rel(), trajectory_a_abs(), trajectory_goto_d_a_rel(), trajectory_goto_xy_rel(), trajectory_turnto_xy(), and trajectory_turnto_xy_behind().
double position_get_x_double | ( | struct robot_position * | pos | ) |
returns current x
Definition at line 224 of file position_manager.c.
References robot_position::pos_d, and xya_position::x.
Referenced by __trajectory_goto_d_a_rel(), trajectory_goto_d_a_rel(), trajectory_goto_xy_rel(), trajectory_turnto_xy(), and trajectory_turnto_xy_behind().
int16_t position_get_x_s16 | ( | struct robot_position * | pos | ) |
returns current x
Definition at line 198 of file position_manager.c.
References robot_position::pos_s16, and xya_position_s16::x.
double position_get_y_double | ( | struct robot_position * | pos | ) |
returns current y
Definition at line 232 of file position_manager.c.
References robot_position::pos_d, and xya_position::y.
Referenced by __trajectory_goto_d_a_rel(), trajectory_goto_d_a_rel(), trajectory_goto_xy_rel(), trajectory_turnto_xy(), and trajectory_turnto_xy_behind().
int16_t position_get_y_s16 | ( | struct robot_position * | pos | ) |
returns current y
Definition at line 206 of file position_manager.c.
References robot_position::pos_s16, and xya_position_s16::y.
void position_init | ( | struct robot_position * | pos | ) |
initialization of the robot_position pos, everthing is set to 0
Definition at line 29 of file position_manager.c.
References IRQ_LOCK, and IRQ_UNLOCK.
void position_manage | ( | struct robot_position * | pos | ) |
Process the absolute position (x,y,a) depending on the delta on virtual encoders since last read, and depending on physical parameters.
Process the absolute position (x,y,a) depending on the delta on virtual encoders since last read, and depending on physical parameters. The processed position is in cm.
Definition at line 112 of file position_manager.c.
References a, xya_position_s16::a, xya_position::a, rs_polar::angle, rs_polar::distance, robot_physical_params::distance_imp_per_cm, robot_system::flags, IRQ_LOCK, IRQ_UNLOCK, robot_position::phys, robot_position::pos_d, robot_position::pos_s16, robot_position::prev_encoders, robot_position::rs, rs_get_ext_angle(), rs_get_ext_distance(), robot_physical_params::track_cm, robot_position::use_ext, xya_position::x, xya_position_s16::x, xya_position::y, and xya_position_s16::y.
void position_set | ( | struct robot_position * | pos, | |
int16_t | x, | |||
int16_t | y, | |||
int16_t | a | |||
) |
Set a new robot position
Definition at line 38 of file position_manager.c.
References xya_position_s16::a, xya_position::a, IRQ_LOCK, IRQ_UNLOCK, robot_position::pos_d, robot_position::pos_s16, xya_position::x, xya_position_s16::x, xya_position::y, and xya_position_s16::y.
void position_set_physical_params | ( | struct robot_position * | pos, | |
double | track_cm, | |||
double | distance_imp_per_cm | |||
) |
Set the physical parameters of the robot :
Set the physical parameters of the robot :
Definition at line 69 of file position_manager.c.
References robot_physical_params::distance_imp_per_cm, IRQ_LOCK, IRQ_UNLOCK, robot_position::phys, and robot_physical_params::track_cm.
void position_set_related_robot_system | ( | struct robot_position * | pos, | |
struct robot_system * | rs | |||
) |
Save in pos structure the pointer to the associated robot_system. The robot_system structure is used to get values from virtual encoders that return angle and distance.
Definition at line 56 of file position_manager.c.
References IRQ_LOCK, IRQ_UNLOCK, and robot_position::rs.
void position_use_ext | ( | struct robot_position * | pos | ) |
Definition at line 79 of file position_manager.c.
References rs_polar::angle, rs_polar::distance, IRQ_LOCK, IRQ_UNLOCK, robot_position::prev_encoders, robot_position::rs, rs_get_ext_angle(), rs_get_ext_distance(), and robot_position::use_ext.
void position_use_mot | ( | struct robot_position * | pos | ) |