Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
fang::chassis::BaseQuadDrive Class Reference

#include <base_quad_drive.hpp>

Inheritance diagram for fang::chassis::BaseQuadDrive:
Collaboration diagram for fang::chassis::BaseQuadDrive:

Public Types

using Motor = motor::ISpeedMotor
 
using Motors = QuadCollection< std::unique_ptr< Motor > >
 

Public Member Functions

 BaseQuadDrive (Drivers &drivers, std::unique_ptr< Motor > frontLeftMotor, std::unique_ptr< Motor > frontRightMotor, std::unique_ptr< Motor > rearLeftMotor, std::unique_ptr< Motor > rearRightMotor)
 
 BaseQuadDrive (Drivers &drivers, Motors &&motors)
 
virtual void setTargetWheelSpeeds (const QuadRPM &wheelSpeeds) override
 
virtual void initialize () override
 
virtual void update () override
 
virtual void refresh () override
 
virtual ~BaseQuadDrive ()
 
- Public Member Functions inherited from fang::chassis::QuadDriveSubsystem
 QuadDriveSubsystem (tap::Drivers &drivers)
 
virtual ~QuadDriveSubsystem ()=default
 
- Public Member Functions inherited from tap::control::Subsystem
 Subsystem (Drivers *drivers)
 
virtual ~Subsystem ()
 
void registerAndInitialize ()
 
mockable void setDefaultCommand (Command *defaultCommand)
 
mockable CommandgetDefaultCommand () const
 
virtual void refreshSafeDisconnect ()
 
mockable void setTestCommand (Command *testCommand)
 
mockable CommandgetTestCommand () const
 
virtual const char * getName () const
 
mockable int getGlobalIdentifier () const
 

Additional Inherited Members

- Protected Attributes inherited from tap::control::Subsystem
Driversdrivers
 

Detailed Description

This provides control for a set of 4 ISpeedMotors It manages the initialization and update functionality as well.

This is often passed into a holonomic drive or tank drive to delegate managing the wheel speeds and updating each of the motors

This can be managed by a taproot command (can be registered).

Member Typedef Documentation

◆ Motor

◆ Motors

Constructor & Destructor Documentation

◆ BaseQuadDrive() [1/2]

fang::chassis::BaseQuadDrive::BaseQuadDrive ( Drivers drivers,
std::unique_ptr< Motor frontLeftMotor,
std::unique_ptr< Motor frontRightMotor,
std::unique_ptr< Motor rearLeftMotor,
std::unique_ptr< Motor rearRightMotor 
)

◆ BaseQuadDrive() [2/2]

fang::chassis::BaseQuadDrive::BaseQuadDrive ( Drivers drivers,
Motors &&  motors 
)

Motors should be passed explicitly with move semantics to prevent memory errors. If you are unfamiliar with r-value references, since they have no name, they pop into existence the moment they are stated then pop out. This means that we do not have to worry about motors continuing to hold unto. If motors must be a named variable, cast it to an r-value reference with std::move()

◆ ~BaseQuadDrive()

virtual fang::chassis::BaseQuadDrive::~BaseQuadDrive ( )
inlinevirtual

Member Function Documentation

◆ initialize()

void fang::chassis::BaseQuadDrive::initialize ( )
overridevirtual

Called once when you add the Subsystem to the commandScheduler stored in the Drivers class.

Reimplemented from tap::control::Subsystem.

Reimplemented in fang::chassis::PowerQuadDrive.

◆ refresh()

void fang::chassis::BaseQuadDrive::refresh ( )
overridevirtual

Called in the scheduler's run function assuming this command has been registered with the scheduler. This function should contain code that must be periodically updated and is generic to the subsystem (i.e. updating a control loop generic to this subsystem). This function should not contain command specific control code. When you create a subclass of Subsystem, you should overwrite this virtual function.

Must be virtual otherwise scheduler will refer to this function rather than looking in child for this function.

Reimplemented from tap::control::Subsystem.

Reimplemented in fang::chassis::PowerQuadDrive.

◆ setTargetWheelSpeeds()

void fang::chassis::BaseQuadDrive::setTargetWheelSpeeds ( const QuadRPM wheelSpeeds)
overridevirtual

Reimplemented in fang::chassis::PowerQuadDrive.

◆ update()

void fang::chassis::BaseQuadDrive::update ( )
overridevirtual

Reimplemented in fang::chassis::PowerQuadDrive.


The documentation for this class was generated from the following files: