Life of a movement
Game strategy says
What happens next?
- The strategy uses the
obstacle_avoidanceto compute a path that intersect no obstacles.
- The strategy gives the first point to
trajectory_manager, which computes an angle and a distance to reach that point. To do so, it asks the
position_managerwhat the current position of the robot is.
- The angle and distance are used as setpoint for the
base_controllercontrol systems. They are first filtered through a quadramp to limit angular/linear velocities & accelerations. Then,
robot_systemcomputes the current angular and linear positions by reading encoders position from hardware and summing/subtracting them. Those current positions and desired filtered position are used as inputs for the PIDs, who give back angular & linear speeds.
robot_systemis used again, to convert those to left and right wheel speeds. The left and right wheel are sent to
motor_managersends to the left and right motor boards the new speed setpoints. It must first convert the names of the board to CAN IDs by reading the mapping stored by the
bus_enumeratoron the boot of the robot.
- The motor boards apply this new speed setpoints to the wheels using their internal control, which causes the robot to move. This moves the external encoders wheels, which send their positions to the master board using standard AB quadrature channels.
position_managerreads the new encoders positions and computes the new (XY, angle) position of the robot.
- The process starts over at step 2, until the path is complete.
For intermediate points, the strategy decides if it can move to the next waypoint by computing distance to the current point and comparing to a threshold.
For the final point,
trajectory_managerdecides if he arrived by looking at whether the filtered angle and distance speeds are zero (meaning we are stopped).