WPILibC++ 2024.3.2
frc::DCMotor Class Reference

Holds the constants for a DC motor. More...

#include <frc/system/plant/DCMotor.h>

Public Types

using radians_per_second_per_volt_t = units::unit_t< units::compound_unit< units::radians_per_second, units::inverse< units::volt > > >
 
using newton_meters_per_ampere_t = units::unit_t< units::compound_unit< units::newton_meters, units::inverse< units::ampere > > >
 

Public Member Functions

constexpr DCMotor (units::volt_t nominalVoltage, units::newton_meter_t stallTorque, units::ampere_t stallCurrent, units::ampere_t freeCurrent, units::radians_per_second_t freeSpeed, int numMotors=1)
 Constructs a DC motor. More...
 
constexpr units::ampere_t Current (units::radians_per_second_t speed, units::volt_t inputVoltage) const
 Returns current drawn by motor with given speed and input voltage. More...
 
constexpr units::newton_meter_t Torque (units::ampere_t current) const
 Returns torque produced by the motor with a given current. More...
 
constexpr units::volt_t Voltage (units::newton_meter_t torque, units::radians_per_second_t speed) const
 Returns the voltage provided to the motor for a given torque and angular velocity. More...
 
constexpr units::radians_per_second_t Speed (units::newton_meter_t torque, units::volt_t inputVoltage) const
 Returns the angular speed produced by the motor at a given torque and input voltage. More...
 
constexpr DCMotor WithReduction (double gearboxReduction)
 Returns a copy of this motor with the given gearbox reduction applied. More...
 

Static Public Member Functions

static constexpr DCMotor CIM (int numMotors=1)
 Returns a gearbox of CIM motors. More...
 
static constexpr DCMotor MiniCIM (int numMotors=1)
 Returns a gearbox of MiniCIM motors. More...
 
static constexpr DCMotor Bag (int numMotors=1)
 Returns a gearbox of Bag motor motors. More...
 
static constexpr DCMotor Vex775Pro (int numMotors=1)
 Returns a gearbox of Vex 775 Pro motors. More...
 
static constexpr DCMotor RS775_125 (int numMotors=1)
 Returns a gearbox of Andymark RS 775-125 motors. More...
 
static constexpr DCMotor BanebotsRS775 (int numMotors=1)
 Returns a gearbox of Banebots RS 775 motors. More...
 
static constexpr DCMotor Andymark9015 (int numMotors=1)
 Returns a gearbox of Andymark 9015 motors. More...
 
static constexpr DCMotor BanebotsRS550 (int numMotors=1)
 Returns a gearbox of Banebots RS 550 motors. More...
 
static constexpr DCMotor NEO (int numMotors=1)
 Returns a gearbox of NEO brushless motors. More...
 
static constexpr DCMotor NEO550 (int numMotors=1)
 Returns a gearbox of NEO 550 brushless motors. More...
 
static constexpr DCMotor Falcon500 (int numMotors=1)
 Returns a gearbox of Falcon 500 brushless motors. More...
 
static constexpr DCMotor Falcon500FOC (int numMotors=1)
 Return a gearbox of Falcon 500 motors with FOC (Field-Oriented Control) enabled. More...
 
static constexpr DCMotor RomiBuiltIn (int numMotors=1)
 Return a gearbox of Romi/TI_RSLK MAX motors. More...
 
static constexpr DCMotor KrakenX60 (int numMotors=1)
 Return a gearbox of Kraken X60 brushless motors. More...
 
static constexpr DCMotor KrakenX60FOC (int numMotors=1)
 Return a gearbox of Kraken X60 brushless motors with FOC (Field-Oriented Control) enabled. More...
 
static constexpr DCMotor NeoVortex (int numMotors=1)
 Return a gearbox of Neo Vortex brushless motors. More...
 

Public Attributes

units::volt_t nominalVoltage
 Voltage at which the motor constants were measured. More...
 
units::newton_meter_t stallTorque
 Torque when stalled. More...
 
units::ampere_t stallCurrent
 Current draw when stalled. More...
 
units::ampere_t freeCurrent
 Current draw under no load. More...
 
units::radians_per_second_t freeSpeed
 Angular velocity under no load. More...
 
units::ohm_t R
 Motor internal resistance. More...
 
radians_per_second_per_volt_t Kv
 Motor velocity constant. More...
 
newton_meters_per_ampere_t Kt
 Motor torque constant. More...
 

Detailed Description

Holds the constants for a DC motor.

Member Typedef Documentation

◆ newton_meters_per_ampere_t

◆ radians_per_second_per_volt_t

Constructor & Destructor Documentation

◆ DCMotor()

constexpr frc::DCMotor::DCMotor ( units::volt_t  nominalVoltage,
units::newton_meter_t  stallTorque,
units::ampere_t  stallCurrent,
units::ampere_t  freeCurrent,
units::radians_per_second_t  freeSpeed,
int  numMotors = 1 
)
inlineconstexpr

Constructs a DC motor.

Parameters
nominalVoltageVoltage at which the motor constants were measured.
stallTorqueTorque when stalled.
stallCurrentCurrent draw when stalled.
freeCurrentCurrent draw under no load.
freeSpeedAngular velocity under no load.
numMotorsNumber of motors in a gearbox.

Member Function Documentation

◆ Andymark9015()

static constexpr DCMotor frc::DCMotor::Andymark9015 ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Andymark 9015 motors.

◆ Bag()

static constexpr DCMotor frc::DCMotor::Bag ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Bag motor motors.

◆ BanebotsRS550()

static constexpr DCMotor frc::DCMotor::BanebotsRS550 ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Banebots RS 550 motors.

◆ BanebotsRS775()

static constexpr DCMotor frc::DCMotor::BanebotsRS775 ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Banebots RS 775 motors.

◆ CIM()

static constexpr DCMotor frc::DCMotor::CIM ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of CIM motors.

◆ Current()

constexpr units::ampere_t frc::DCMotor::Current ( units::radians_per_second_t  speed,
units::volt_t  inputVoltage 
) const
inlineconstexpr

Returns current drawn by motor with given speed and input voltage.

Parameters
speedThe current angular velocity of the motor.
inputVoltageThe voltage being applied to the motor.

◆ Falcon500()

static constexpr DCMotor frc::DCMotor::Falcon500 ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Falcon 500 brushless motors.

◆ Falcon500FOC()

static constexpr DCMotor frc::DCMotor::Falcon500FOC ( int  numMotors = 1)
inlinestaticconstexpr

Return a gearbox of Falcon 500 motors with FOC (Field-Oriented Control) enabled.

◆ KrakenX60()

static constexpr DCMotor frc::DCMotor::KrakenX60 ( int  numMotors = 1)
inlinestaticconstexpr

Return a gearbox of Kraken X60 brushless motors.

◆ KrakenX60FOC()

static constexpr DCMotor frc::DCMotor::KrakenX60FOC ( int  numMotors = 1)
inlinestaticconstexpr

Return a gearbox of Kraken X60 brushless motors with FOC (Field-Oriented Control) enabled.

◆ MiniCIM()

static constexpr DCMotor frc::DCMotor::MiniCIM ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of MiniCIM motors.

◆ NEO()

static constexpr DCMotor frc::DCMotor::NEO ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of NEO brushless motors.

◆ NEO550()

static constexpr DCMotor frc::DCMotor::NEO550 ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of NEO 550 brushless motors.

◆ NeoVortex()

static constexpr DCMotor frc::DCMotor::NeoVortex ( int  numMotors = 1)
inlinestaticconstexpr

Return a gearbox of Neo Vortex brushless motors.

◆ RomiBuiltIn()

static constexpr DCMotor frc::DCMotor::RomiBuiltIn ( int  numMotors = 1)
inlinestaticconstexpr

Return a gearbox of Romi/TI_RSLK MAX motors.

◆ RS775_125()

static constexpr DCMotor frc::DCMotor::RS775_125 ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Andymark RS 775-125 motors.

◆ Speed()

constexpr units::radians_per_second_t frc::DCMotor::Speed ( units::newton_meter_t  torque,
units::volt_t  inputVoltage 
) const
inlineconstexpr

Returns the angular speed produced by the motor at a given torque and input voltage.

Parameters
torqueThe torque produced by the motor.
inputVoltageThe input voltage provided to the motor.

◆ Torque()

constexpr units::newton_meter_t frc::DCMotor::Torque ( units::ampere_t  current) const
inlineconstexpr

Returns torque produced by the motor with a given current.

Parameters
currentThe current drawn by the motor.

◆ Vex775Pro()

static constexpr DCMotor frc::DCMotor::Vex775Pro ( int  numMotors = 1)
inlinestaticconstexpr

Returns a gearbox of Vex 775 Pro motors.

◆ Voltage()

constexpr units::volt_t frc::DCMotor::Voltage ( units::newton_meter_t  torque,
units::radians_per_second_t  speed 
) const
inlineconstexpr

Returns the voltage provided to the motor for a given torque and angular velocity.

Parameters
torqueThe torque produced by the motor.
speedThe current angular velocity of the motor.

◆ WithReduction()

constexpr DCMotor frc::DCMotor::WithReduction ( double  gearboxReduction)
inlineconstexpr

Returns a copy of this motor with the given gearbox reduction applied.

Parameters
gearboxReductionThe gearbox reduction.

Member Data Documentation

◆ freeCurrent

units::ampere_t frc::DCMotor::freeCurrent

Current draw under no load.

◆ freeSpeed

units::radians_per_second_t frc::DCMotor::freeSpeed

Angular velocity under no load.

◆ Kt

newton_meters_per_ampere_t frc::DCMotor::Kt

Motor torque constant.

◆ Kv

Motor velocity constant.

◆ nominalVoltage

units::volt_t frc::DCMotor::nominalVoltage

Voltage at which the motor constants were measured.

◆ R

units::ohm_t frc::DCMotor::R

Motor internal resistance.

◆ stallCurrent

units::ampere_t frc::DCMotor::stallCurrent

Current draw when stalled.

◆ stallTorque

units::newton_meter_t frc::DCMotor::stallTorque

Torque when stalled.


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