RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::SimulationMotor Class Referencefinal

A first-order motor model: speed approaches (voltage / 12 V) × free speed with a time constant. More...

#include <SimulationMotor.hpp>

Inheritance diagram for rz::SimulationMotor:
rz::Motor

Classes

struct  Config

Public Member Functions

 SimulationMotor ()
 SimulationMotor (Config config)
void setVoltage (Voltage voltage) override
 Commands a voltage, clamped to the motor's range. Positive drives the mechanism forward.
bool connected () const override
Voltage appliedVoltage () const noexcept
 The voltage actually applied (after clamping); zero while disconnected.
void setConnected (bool connected)
 Simulates unplugging / replugging. A reconnected motor's encoder restarts from zero.
Sensor< Angle > & encoder () noexcept
Sensor< AngularVelocity > & velocity () noexcept
Public Member Functions inherited from rz::Motor
 Motor ()=default
 Motor (const Motor &)=delete
Motor & operator= (const Motor &)=delete
 Motor (Motor &&)=delete
Motor & operator= (Motor &&)=delete
virtual ~Motor ()=default

Detailed Description

A first-order motor model: speed approaches (voltage / 12 V) × free speed with a time constant.

State advances lazily to the runtime's current time whenever it is read or the voltage changes, so it needs no loop. Voltage is held constant between changes, which makes the integration exact.

Constructor & Destructor Documentation

◆ SimulationMotor() [1/2]

rz::SimulationMotor::SimulationMotor ( )
inline

◆ SimulationMotor() [2/2]

rz::SimulationMotor::SimulationMotor ( Config config)
explicit

Member Function Documentation

◆ appliedVoltage()

Voltage rz::SimulationMotor::appliedVoltage ( ) const
inlinenodiscardnoexcept

The voltage actually applied (after clamping); zero while disconnected.

◆ connected()

bool rz::SimulationMotor::connected ( ) const
inlinenodiscardoverridevirtual

Implements rz::Motor.

◆ encoder()

Sensor< Angle > & rz::SimulationMotor::encoder ( )
inlinenodiscardnoexcept

◆ setConnected()

void rz::SimulationMotor::setConnected ( bool connected)

Simulates unplugging / replugging. A reconnected motor's encoder restarts from zero.

◆ setVoltage()

void rz::SimulationMotor::setVoltage ( Voltage voltage)
overridevirtual

Commands a voltage, clamped to the motor's range. Positive drives the mechanism forward.

Implements rz::Motor.

◆ velocity()

Sensor< AngularVelocity > & rz::SimulationMotor::velocity ( )
inlinenodiscardnoexcept

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