WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
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
 
using newton_meters_per_ampere_t
 

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.
 
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.
 
constexpr units::ampere_t Current (units::newton_meter_t torque) const
 Returns current drawn by motor for a given torque.
 
constexpr units::newton_meter_t Torque (units::ampere_t current) const
 Returns torque produced by the motor with a given current.
 
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.
 
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.
 
constexpr DCMotor WithReduction (double gearboxReduction)
 Returns a copy of this motor with the given gearbox reduction applied.
 

Static Public Member Functions

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

Public Attributes

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

Detailed Description

Holds the constants for a DC motor.

Member Typedef Documentation

◆ newton_meters_per_ampere_t

Initial value:
units::unit_t<units::compound_unit<units::newton_meters,
Container for values which represent quantities of a given unit.
Definition base.h:1930
typename units::detail::inverse_impl< U >::type inverse
represents the inverse unit type of class U.
Definition base.h:1138
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition base.h:1438

◆ radians_per_second_per_volt_t

Constructor & Destructor Documentation

◆ DCMotor()

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() [1/2]

units::ampere_t frc::DCMotor::Current ( units::newton_meter_t torque) const
inlineconstexpr

Returns current drawn by motor for a given torque.

Parameters
torqueThe torque produced by the motor.

◆ Current() [2/2]

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()

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()

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()

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()

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: