X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=modules%2Fdevices%2Frobot%2Ftrajectory_manager%2Ftrajectory_manager.h;h=f18e27296fe12b61ef0807c3f3c40d00ba4455b9;hp=e2f80349e5aa23d4e2b30354b1be5a7fb8a6981c;hb=e0908eab4d4b00cf19083f91a9921b3e8d0cae63;hpb=ccc6954bb046671b9e28c5806db5121c1eef49c0 diff --git a/modules/devices/robot/trajectory_manager/trajectory_manager.h b/modules/devices/robot/trajectory_manager/trajectory_manager.h index e2f8034..f18e272 100644 --- a/modules/devices/robot/trajectory_manager/trajectory_manager.h +++ b/modules/devices/robot/trajectory_manager/trajectory_manager.h @@ -44,8 +44,18 @@ enum trajectory_state { RUNNING_XY_B_START, RUNNING_XY_B_ANGLE, RUNNING_XY_B_ANGLE_OK, + RUNNING_CIRCLE, }; +struct circle_target { + vect2_cart center; /**< center of the circle */ + double radius; /**< radius of the circle */ + int32_t dest_angle; /**< dst angle in inc */ + +#define TRIGO 1 /* rotation is counterclockwise */ +#define FORWARD 2 /* go forward or backward */ + uint8_t flags; /**< flags for this trajectory */ +}; struct trajectory { enum trajectory_state state; /*<< describe the type of target, and if we reached the target */ @@ -53,13 +63,15 @@ struct trajectory { union { vect2_cart cart; /**<< target, if it is a x,y vector */ struct rs_polar pol; /**<< target, if it is a d,a vector */ + struct circle_target circle; /**<< target, if it is a circle */ } target; double d_win; /**<< distance window (for END_NEAR) */ double a_win_rad; /**<< angle window (for END_NEAR) */ double a_start_rad;/**<< in xy consigns, start to move in distance * when a_target < a_start */ - + double circle_coef;/**<< corrective circle coef */ + uint16_t d_speed; /**<< distance speed consign */ uint16_t a_speed; /**<< angle speed consign */ @@ -67,7 +79,7 @@ struct trajectory { struct robot_system *robot; /**<< associated robot_system */ struct cs *csm_angle; /**<< associated control system (angle) */ struct cs *csm_distance; /**<< associated control system (distance) */ - + int8_t scheduler_task; /**<< id of current task (-1 if no running task) */ }; @@ -97,6 +109,12 @@ void trajectory_set_speed(struct trajectory *traj, int16_t d_speed, int16_t a_sp void trajectory_set_windows(struct trajectory *traj, double d_win, double a_win_deg, double a_start_deg); +/** + * Set coef for circle trajectory. The objective of this value is to + * fix the radius of the circle which is not correctly what we asked. + */ +void trajectory_set_circle_coef(struct trajectory *traj, double coef); + /** return true if the position consign is equal to the filtered * position consign (after quadramp filter), for angle and * distance. */ @@ -159,4 +177,10 @@ void trajectory_goto_d_a_rel(struct trajectory *traj, double d, double a); /** go forward to a x,y relative point, using a trajectory event */ void trajectory_goto_xy_rel(struct trajectory *traj, double x_rel_mm, double y_rel_mm); +/** make the robot orbiting around (x,y) on a circle whose radius is + * radius_mm, and exit when relative destination angle is reached. The + * flags set if we go forward or backwards, and CW/CCW. */ +void trajectory_circle_rel(struct trajectory *traj, double x, double y, + double radius_mm, double rel_a_deg, uint8_t flags); + #endif //TRAJECTORY_MANAGER