Ravens Robotics FRC 2015
|
#include <MecanumDrive.h>
Public Member Functions | |
MecanumDrive () | |
virtual | ~MecanumDrive () |
virtual void | ComponentInit () |
virtual void | Sense () |
virtual void | DoWork () |
virtual void | SetSmoothAccel (bool enable) |
bool | isSmoothAccel () const |
void | setSmoothAccel (bool smoothAccel) |
bool | isGyroEnabled () const |
void | setGyroEnabled (bool gyroEnabled) |
![]() | |
RobotComponent () | |
virtual | ~RobotComponent () |
Private Attributes | |
Joystick * | m_DriveStick |
joystick controller More... | |
RobotDrive * | m_Drive |
drive instance More... | |
SmoothAxis * | m_ValueX |
left/right speed [-1.0..1.0] More... | |
SmoothAxis * | m_ValueY |
fwd/bkwd speed, inverted [-1.0..1.0] More... | |
SmoothAxis * | m_ValueRotate |
Rate of rotation [-1.0..1.0]. More... | |
Gyro * | m_Gyro |
Gyroscope instance to measure robot's heading. More... | |
JoystickButton * | m_GyroButton |
Button to dis/enable gyro. More... | |
bool | m_GyroButtonIsPressed |
Button state. More... | |
bool | m_gyroEnabled |
Gyroscope enablement. More... | |
float | m_gyroAngle |
Gyroscope angle measurement. More... | |
bool | m_SmoothAccel |
State of smooth acceleration capability. More... | |
The MecanumDrive RobotComponent provides control of 4 Talon motor control units for mecanum-equipped wheels.
Read more about mecanum wheels on wikipedia.
Definition at line 24 of file MecanumDrive.h.
MecanumDrive::MecanumDrive | ( | ) |
Definition at line 12 of file MecanumDrive.cpp.
References m_Drive, m_DriveStick, m_Gyro, m_gyroAngle, m_GyroButton, m_GyroButtonIsPressed, m_gyroEnabled, m_SmoothAccel, m_ValueRotate, m_ValueX, and m_ValueY.
|
virtual |
Definition at line 25 of file MecanumDrive.cpp.
References m_Drive, m_DriveStick, m_Gyro, m_GyroButton, m_ValueRotate, m_ValueX, and m_ValueY.
|
virtual |
Called once, to perform initialization that isn't appropriate for constructor.
Reimplemented from RobotComponent.
Definition at line 39 of file MecanumDrive.cpp.
References m_Drive, m_DriveStick, m_Gyro, m_GyroButton, m_GyroButtonIsPressed, m_SmoothAccel, m_ValueRotate, m_ValueX, m_ValueY, and SetSmoothAccel().
Referenced by Robot::RobotInit().
|
virtual |
Component-specific worker function. Operate the Drive, using values retrieved by Sense().
Cartesian motion drive method for Mecanum wheeled robots is used. There are 4 wheels on the robot, arranged so that the front and back wheels are toed in 45 degrees. By controlling the revolutions of each wheel independently, it is possible to translate the robot on a cartesian plane, and to rotate it separately.
This is designed to be directly driven by joystick axes.
Reimplemented from RobotComponent.
Definition at line 103 of file MecanumDrive.cpp.
References SmoothAxis::GetValue(), m_Drive, m_gyroAngle, m_ValueRotate, m_ValueX, and m_ValueY.
Referenced by Robot::TeleopPeriodic().
|
inline |
Check if Gyroscope is enabled.
true
if enabled. Definition at line 100 of file MecanumDrive.h.
References m_gyroEnabled.
Referenced by Sense().
|
inline |
Check if Smooth Acceleration is enabled.
true
if enabled. Definition at line 77 of file MecanumDrive.h.
References m_SmoothAccel.
|
virtual |
Component-specific sensory input collector. Read joystick positions and button states.
Reimplemented from RobotComponent.
Definition at line 68 of file MecanumDrive.cpp.
References isGyroEnabled(), m_DriveStick, m_Gyro, m_gyroAngle, m_GyroButton, m_GyroButtonIsPressed, m_gyroEnabled, m_ValueRotate, m_ValueX, m_ValueY, and SmoothAxis::SetTarget().
Referenced by Robot::TeleopPeriodic().
void MecanumDrive::setGyroEnabled | ( | bool | gyroEnabled | ) |
Set Gyroscope enablement. Usage:
[in] | gyroEnabled | Set true to enable. |
Definition at line 111 of file MecanumDrive.cpp.
References m_Gyro, and m_gyroEnabled.
|
virtual |
Enable / Disable smooth acceleration capability.
[in] | enable | Set true to enable. |
Usage:
Definition at line 125 of file MecanumDrive.cpp.
References m_SmoothAccel, m_ValueRotate, m_ValueX, m_ValueY, and SmoothAxis::setEnabled().
Referenced by ComponentInit().
|
inline |
Set Smooth Acceleration feature.
Usage:
[in] | smoothAccel | Set true to enable. |
Definition at line 91 of file MecanumDrive.h.
References m_SmoothAccel.
|
private |
drive instance
Definition at line 117 of file MecanumDrive.h.
Referenced by ComponentInit(), DoWork(), MecanumDrive(), and ~MecanumDrive().
|
private |
joystick controller
Definition at line 116 of file MecanumDrive.h.
Referenced by ComponentInit(), MecanumDrive(), Sense(), and ~MecanumDrive().
|
private |
Gyroscope instance to measure robot's heading.
Definition at line 121 of file MecanumDrive.h.
Referenced by ComponentInit(), MecanumDrive(), Sense(), setGyroEnabled(), and ~MecanumDrive().
|
private |
Gyroscope angle measurement.
Definition at line 125 of file MecanumDrive.h.
Referenced by DoWork(), MecanumDrive(), and Sense().
|
private |
Button to dis/enable gyro.
Definition at line 122 of file MecanumDrive.h.
Referenced by ComponentInit(), MecanumDrive(), Sense(), and ~MecanumDrive().
|
private |
Button state.
Definition at line 123 of file MecanumDrive.h.
Referenced by ComponentInit(), MecanumDrive(), and Sense().
|
private |
Gyroscope enablement.
Definition at line 124 of file MecanumDrive.h.
Referenced by isGyroEnabled(), MecanumDrive(), Sense(), and setGyroEnabled().
|
private |
State of smooth acceleration capability.
Definition at line 126 of file MecanumDrive.h.
Referenced by ComponentInit(), isSmoothAccel(), MecanumDrive(), SetSmoothAccel(), and setSmoothAccel().
|
private |
Rate of rotation [-1.0..1.0].
Definition at line 118 of file MecanumDrive.h.
Referenced by ComponentInit(), DoWork(), MecanumDrive(), Sense(), SetSmoothAccel(), and ~MecanumDrive().
|
private |
left/right speed [-1.0..1.0]
Definition at line 118 of file MecanumDrive.h.
Referenced by ComponentInit(), DoWork(), MecanumDrive(), Sense(), SetSmoothAccel(), and ~MecanumDrive().
|
private |
fwd/bkwd speed, inverted [-1.0..1.0]
Definition at line 118 of file MecanumDrive.h.
Referenced by ComponentInit(), DoWork(), MecanumDrive(), Sense(), SetSmoothAccel(), and ~MecanumDrive().