Public Member Functions | |
| __init__ (self, BnrOneAPlus one, slip_factor=1.0, robot_params=RobotParams()) | |
| move_straight_at_speed (self, distance, speed=50, slow_down_distance=0) | |
| PoseSpeeds | rotate_angle_deg_at_speed (self, angle_deg, speed=50, radius_of_curvature_mm=0, slow_down_thresh_deg=0) |
Static Public Attributes | |
| int | STRAIGHT_MOTION = 32767 |
| int | TICKS_LEFT_LOW_SPEED = 4000 |
| int | MIN_SPEED_MMPS = 100 |
Protected Member Functions | |
| _reset_encoders (self) | |
| _compute_pose_speeds (self, speed, radius_of_curvature_mm, direction=1) | |
| _maybe_slow_down (self, pose_speeds, speed, pulses_remaining, slow_down_thresh, radius_of_curvature_mm, direction) | |
| _move_and_slow_down (self, total_pulses, speed=50, direction=1, radius_of_curvature_mm=0, slow_down_thresh=TICKS_LEFT_LOW_SPEED) | |
| _get_sign (self, value) | |
| _check_wheel_speed_limit (self, speed) | |
| _check_speed_limits (self, PoseSpeeds pose_speeds) | |
| _apply_slip (self, value) | |
Protected Attributes | |
| _slip_factor = slip_factor | |
| _axis_length_mm = robot_params.axis_length_mm | |
| _cut = ControlUtils(robot_params) | |
| _one = one | |
Class that enables moving in curved or straight lines by specifying the distance and or angle and speed of the desired motion
|
protected |
calculates the angular speed given the linear speed, the radius of curvature and the direction
|
protected |
Note: At the moment slowing down doesn't work for rotations only
|
protected |
@brief Moves and slows down when pulses remaining are less than slow_down_thresh If slow_down_thresh is set to zero (or negative number) it does not slow down. By default it starts slowing down when a full rotation (TICKS_LEFT_LOW_SPEED) remains. The slow down is a quadratic function of the form y = a * x^2 @param total_pulses number of pulses necessary from the encoders (average) to complete the manoeuvre @param speed @param direction of curve in case of a curved motion @param radius_of_curvature_mm (positive for CW and negative values for CCW rotations) @param slow_down_thresh number of ticks to when the robot should start reducing speed @param straight boolean specifying if this is a straight line or not
|
protected |
Resets both encoders
| onepi.utils.motion_generator.MotionGenerator.move_straight_at_speed | ( | self, | |
| distance, | |||
| speed = 50, | |||
| slow_down_distance = 0 ) |
moves the robot for the given distance at the given speed. If slow down distance is provided then it slows down once the remaining distance is less than the slow_down_distance
| PoseSpeeds onepi.utils.motion_generator.MotionGenerator.rotate_angle_deg_at_speed | ( | self, | |
| angle_deg, | |||
| speed = 50, | |||
| radius_of_curvature_mm = 0, | |||
| slow_down_thresh_deg = 0 ) |
rotate the robot the specified angle at the given speed and with the radius of curvature provided if radius_of_curvature_mm is set to STRAIGHT_MOTION then the robot moves in a straight line