Drive.cpp#
Description#
This file, which contains the functions of the Drive class, controls several parameters related to the driving of the robots. The purpose of this code is to ensure that the robots respond appropriately to controller input. Based on stick inputs from a controller, this code will alter the speed of a robot’s motors. The code also incorporates ramping to ensure that the robots don’t lose control due to the motors starting up too quickly.
This code is intended to be used with robots featuring the standard lineman configuration, with the back left wheel connected to a left motor, the back right wheel connected to a right motor, and the front wheel(s) not connected to any motor.
Functions#
Name |
Description |
|---|---|
|
The constructor for the Drive class. Parameters include robot type, drive parameters, whether the robot has encoders, and which turn function to use. |
|
Performs setup for the motors, initializing the Motor objects and calling |
|
Sets the drive motor type. Presently unused. |
|
Used to retrieve the values from the joysticks of the PS5 controller. These are normalized and constrained to [-1, 1] before using them for drive control. The left stick Y-axis is used for speed ( |
|
Returns |
|
Returns |
|
Adjusts the |
|
Directly adjusts the speed scalar to a non-predefined value, constrained to [-1, 1]. |
|
Returns the current speed scalar. |
|
Called during the drive loop, i.e., in |
|
Called in |
|
Immediately write zero power to both motors. |
|
Debug function to print all relevant parameters. |
|
The primary drive function to be called in the main |
|
Used to retrieve the motor power for transmission between Quarterback V3 base and turret for stabilization. |
Included Headers#
Arduino.h