Chassis Drive Controller - MatthewMArnold/taproot GitHub Wiki
Taproot provides a variety of tools to support designing a chassis subsystem. The chassis is a critical feature of any robot. The chassis must be manuverable and be efficient with power limiting. In aruw-mcb ARUW utilizes taproot primitives when designing the chassis subsystem and associated commands. The commands are executed based on remote state managed by the command mapper.
This page is dedicated to a description of the controller used for chassis control. This includes controller design for the chassis autorotate command, chassis beyblade command, and chassis subsystem. This page assumes you have previously read Command Subsystem Framework.
Initial I/O interaction, filtering user desired RPM
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.
Chassis Autorotate Command
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.
Chassis Subsystem
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, current sensor, and referee feedback.
Chassis Beyblade Command
This command automatically spins the chasis to make the armor plates harder to
hit. The chassis rotation speed is a function of the current max power limit.
The rotation speed ramps linearly from 0 to avoid damaging power spikes. The X
and Y user input are queried from the control operator interface and are
transformed into the turret frame of reference. The desired X, Y, and rotational
velocity are then passed in to the chassis subsystem's mecanumDriveCalculate
function.
Chassis Wiggle Command
The chassis wiggle command is used when a slip ring is not mounted on the yaw axis of the turret and the turet cannot spin 360 degrees. Wiggling the chassis back and forth makes the robot harder to hit. 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.
wiggle command / chassis subsystem block diagrams
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.