Skip to content

Commit eedb84c

Browse files
authored
Clarify curvature drive comments, fix Java code example (#950)
* Add cpp example to using-speed-controllers It was previously a TODO which was left in and merged and went unnoticed. * Change indentation for cpp example to match java of using-speed-controllers * Clarify curvature drive docs * Fix spelling * Update wpi-drive-classes.rst * Update wpi-drive-classes.rst * Specify parameter * Update wpi-drive-classes.rst
1 parent 4f3083d commit eedb84c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

source/docs/software/actuators/wpi-drive-classes.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,29 +180,39 @@ Drive Modes
180180
- Arcade Drive, which controls a forward and turn speed
181181
- Curvature Drive, a subset of Arcade Drive, which makes your robot handle like a car with constant-curvature turns.
182182
183-
As stated above, the DifferentialDrive class contains three default methods for controlling skid-steer or WCD robots. Note that you can create your own methods of controlling the robot's driving and have them call tankDrive() with the derived inputs for left and right motors.
183+
The DifferentialDrive class contains three default methods for controlling skid-steer or WCD robots. Note that you can create your own methods of controlling the robot's driving and have them call tankDrive() with the derived inputs for left and right motors.
184184
185185
The Tank Drive mode is used to control each side of the drivetrain independently (usually with an individual joystick axis controlling each). This example shows how to use the Y-axis of two separate joysticks to run the drivetrain in Tank mode. Construction of the objects has been omitted, for above for drivetrain construction and here for Joystick construction.
186186
187187
The Arcade Drive mode is used to control the drivetrain using speed/throttle and rotation rate. This is typically used either with two axes from a single joystick, or split across joysticks (often on a single gamepad) with the throttle coming from one stick and the rotation from another. This example shows how to use a single joystick with the Arcade mode. Construction of the objects has been omitted, for above for drivetrain construction and here for Joystick construction.
188188
189-
Like Arcade Drive, the Curvature Drive mode is used to control the drivetrain using speed/throttle and rotation rate. The difference is that the rotation control is attempting to control radius of curvature instead of rate of heading change. This mode also has a quick-turn parameter that is used to engage a sub-mode that allows for turning in place. This example shows how to use a single joystick with the Curvature mode. Construction of the objects has been omitted, for above for drivetrain construction and here for Joystick construction.
189+
Like Arcade Drive, the Curvature Drive mode is used to control the drivetrain using speed/throttle and rotation rate. The difference is that the rotation control input controls the radius of curvature instead of rate of heading change, much like the steering wheel of a car. This mode also supports turning in place, which is enabled when the third :code:`boolean` parameter is true.
190190
191191
.. tabs::
192192
193193
.. code-tab:: java
194194
195195
public void teleopPeriodic() {
196+
// Tank drive with a given left and right rates
196197
myDrive.tankDrive(leftStick.getY(), rightStick.getY());
198+
199+
// Arcade drive with a given forward and turn rate
197200
myDrive.arcadeDrive(driveStick.getY(),driveStick.getX());
198-
myDrive.curvatureDrive(driveStick.getY(), driveStick.getX(), driveStick.GetButton(1));
201+
202+
// Curvature drive with a given forward and turn rate, as well as a quick-turn button
203+
myDrive.curvatureDrive(driveStick.getY(), driveStick.getX(), driveStick.getButton(1));
199204
}
200205
201206
.. code-tab:: c++
202207
203208
void TeleopPeriodic() override {
209+
// Tank drive with a given left and right rates
204210
myDrive.TankDrive(leftStick.GetY(), rightStick.GetY());
211+
212+
// Arcade drive with a given forward and turn rate
205213
myDrive.ArcadeDrive(driveStick.GetY(), driveStick.GetX());
214+
215+
// Curvature drive with a given forward and turn rate, as well as a quick-turn button
206216
myDrive.CurvatureDrive(driveStick.GetY(), driveStick.GetX(), driveStick.GetButton(1));
207217
}
208218

0 commit comments

Comments
 (0)