Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions source/docs/software/actuators/wpi-drive-classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,29 +180,39 @@ Drive Modes
- Arcade Drive, which controls a forward and turn speed
- Curvature Drive, a subset of Arcade Drive, which makes your robot handle like a car with constant-curvature turns.

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.
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.

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.

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.

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.
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.

.. tabs::

.. code-tab:: java

public void teleopPeriodic() {
// Tank drive with a given left and right rates
myDrive.tankDrive(leftStick.getY(), rightStick.getY());

// Arcade drive with a given forward and turn rate
myDrive.arcadeDrive(driveStick.getY(),driveStick.getX());
myDrive.curvatureDrive(driveStick.getY(), driveStick.getX(), driveStick.GetButton(1));

// Curvature drive with a given forward and turn rate, as well as a quick-turn button
myDrive.curvatureDrive(driveStick.getY(), driveStick.getX(), driveStick.getButton(1));
}

.. code-tab:: c++

void TeleopPeriodic() override {
// Tank drive with a given left and right rates
myDrive.TankDrive(leftStick.GetY(), rightStick.GetY());

// Arcade drive with a given forward and turn rate
myDrive.ArcadeDrive(driveStick.GetY(), driveStick.GetX());

// Curvature drive with a given forward and turn rate, as well as a quick-turn button
myDrive.CurvatureDrive(driveStick.GetY(), driveStick.GetX(), driveStick.GetButton(1));
}

Expand Down