-
Notifications
You must be signed in to change notification settings - Fork 1
Chassis Drive Controller
This page is dedicated to a description of the controller used for chassis control. This includes controller design for the chassis autorotate command, chassis wiggle drive command, and chassis subsystem. This page assumes you have previously read Command Subsystem Framework.
Before running any chassis controller, initial filtering and normalization is done on the remote
data in the ControlOperatorInterface
class. The DR16 receiver receives data at roughly 70 Hz and the
chassis controller is run at 500 Hz. As a result, it was noticed that with a simple PID controller
using raw remote input, chassis current spiked each time new remote data was received as the desired
RPM spiked. To remedy this, linear interpolation is performed on the remote input, which removes
current spikes due to the lower frequency remote input.
This command serves as a way to have the chassis automatically rotate the direction that the turret is pointing. When the turret is in world relative mode the command is used to allow for automatic chassis rotation such that the turret is always attempting to be centered, allowing the pilot to focus on aiming the turret and not worrying about rotating the chassis.
At the top level, in the command's execute
function, a position PD controller uses the yaw gimbal
error from the center of the chassis to calculate a desired rotational speed. This speed, along with
the user's desired desired X and Y velocity is fed into the chassis subsystem's
mecanumDriveCalculate
function, where the chassis subsystem takes over.
When the the chassis subsystem receives desired X, Y, and rotational velocity, a simple mecanum drive algorithm is
used to translate these values into wheel speed. As part of this calculation, the chassis rotational
velocity is adjusted per-wheel if the turret is not in the center of the chassis to ensure that rotation
occurs around the center of the turret rather than the center of the chassis. In the subsystem's
refresh
function, PD controllers are applied using desired and actual velocity to calculate
desired current for each motor, which is then current limited based on motor and referee feedback.
The chassis wiggle command is quite similar to the chassis autorotate command. For the command to work, the turret must be running a world relative controller. A desired turret angle from center is calculated using a sine wave (whose x axis is time and y axis is in degrees) and a PD controller is applied to the error between this desired angle and the actual turret angle, which is interpreted as the desired rotational velocity.
The raw X and Y chassis relative velocity vector received from the control operator interface is
then rotated such that the X and Y velocity are turret relative. The desired X, Y, and rotational
velocity are then passed in to the chassis subsystem's mecanumDriveCalculate
function.
Below are block diagrams that show the logic necessary for one iteration of the wiggle command's execute
function and below that the chassis subsystem's refresh
function.
This wiki is specific to the RoboMaster robotics competition open source software award. Refer to our GitLab wiki instead if you would like to contribute.
Compilation and Installation
Block Diagrams
Theoretical Support Analysis
Software Architecture or Hierarchy Diagram
Embedded Debugging Tools
Miscellaneous