Skip to content

Drivetrain

A way to use tankdrive in wombat.

Constructor

wom::TankDrive *tankDrive = new wom::TankDrive(config);

Config

TypeNameDescriptionSee Also
std::stringpathThe path in the networktables
wom::Gearboxleft1The first gearbox on the leftGearbox
wom::Gearboxleft2The second gearbox on the leftGearbox
wom::Gearboxleft3The third gearbox on the leftGearbox
wom::Gearboxright1The first gearbox on the rightGearbox
wom::Gearboxright2The second gearbox on the rightGearbox
wom::Gearboxright3The third gearbox on the rightGearbox

Example

// Rest of you code here
// left1, left2, left3, right1, right2, right3 are all Gearbox objects
wom::TankDriveConfig config = {
"drivetrain",
left1,
left2,
left3,
right1,
right2,
right3
};
wom::TankDrive *tankDrive = new wom::TankDrive(config);

TankDriveState

An enum of states for the tankdrive.

NameValueDescription
kIdle0The drivetrain is idle
kTank1The drivetrain is driving in tank mode

Example

wom::TankDriveState state = tankDrive->GetState();
wom::TankDriveState newState = wom::TankDriveState::kIdle;

TankSpeeds

A struct of speeds for the tankdrive.

TypeNameDescriptionSee Also
doubleleftThe speed of the left side
doublerightThe speed of the right side

Example

wom::TankSpeeds speeds = tankDrive->GetSpeeds();
wom::TankSpeeds newSpeeds = {0.5, 0.5};

Methods

GetConfig

Gets the config of the drivetrain.

Returns wom::TankDriveConfig (see above)

Usage

wom::TankDriveConfig config = tankDrive->GetConfig();

GetState

Gets the state of the drivetrain.

Returns wom::TankDriveState (see above)

Usage

wom::TankDriveState state = tankDrive->GetState();

SetState

Sets the state of the drivetrain.

Usage

tankDrive->SetState(wom::TankDriveState::kIdle);

SetSpeed

Sets the speed of the drivetrain.

Usage

tankDrive->SetSpeed(speeds);

GetSpeeds

Gets the speeds of the drivetrain.

Returns wom::TankSpeeds (see above)

Usage

wom::TankSpeeds speeds = tankDrive->GetSpeeds();