The new drive controller (located in src/subsystem) is set up to calculate motor speeds from two input parameters: steering angle and forward velocity. Since we started simple, it doesn't yet enforce any safety limits or restrict the input to allowed values. This issue will make sure that appropriate limits (maximum speed, maximum angle, etc.) are obeyed. We also want to add two drive modes, NEUTRAL and DRIVE. This way, we will have to explicitly enable driving mode before the rover can move.
Requirements
In DriveController::set_steering_angle, enforce that angle is within range [-180, 180]. If it exceeds the range, set it to the appropriate maximum (-180 or 180).
In DriveController::set_forward_speed, enforce that mps is within range [-6.1, 6.1]. Again, if mps exceeds the range, limit it. Instead of hard-coding 6.1 in the function, define a static constant expression constexpr in the header for max speed (there are examples near the top of DriveController).
Implement the new drive modes. You can define a public enum inside DriveController to represent the mode types. Have a local variable with a getter and setter for mode.
In the setter, verify that the new mode is valid. This may be set over the network, so it is possible that the new mode won't actually fall within the enum. If the mode was valid, call update_motor_acceleration() after setting to apply the new mode.
In DriveController::update_motor_acceleration, if the mode is neutral, then set left_speed and right_speed to 0. If the mode is drive, then run the current update code
At the end of the DriveController::halt() function, set the mode to neutral
Objective
The new drive controller (located in
src/subsystem
) is set up to calculate motor speeds from two input parameters: steering angle and forward velocity. Since we started simple, it doesn't yet enforce any safety limits or restrict the input to allowed values. This issue will make sure that appropriate limits (maximum speed, maximum angle, etc.) are obeyed. We also want to add two drive modes, NEUTRAL and DRIVE. This way, we will have to explicitly enable driving mode before the rover can move.Requirements
DriveController::set_steering_angle
, enforce thatangle
is within range [-180, 180]. If it exceeds the range, set it to the appropriate maximum (-180 or 180).DriveController::set_forward_speed
, enforce thatmps
is within range [-6.1, 6.1]. Again, ifmps
exceeds the range, limit it. Instead of hard-coding 6.1 in the function, define a static constant expressionconstexpr
in the header for max speed (there are examples near the top of DriveController).update_motor_acceleration()
after setting to apply the new mode.DriveController::update_motor_acceleration
, if the mode is neutral, then set left_speed and right_speed to 0. If the mode is drive, then run the current update codeDriveController::halt()
function, set the mode to neutral