Skip to content

brian.motors.motor_types

brian.motors

DeviceClass class objects

class DeviceClass(Enum)

NONE

ERROR

EV3_ANALOG_MOTOR

EV3_UART_DEVICE

DeviceType class objects

class DeviceType(Enum)

UNKNOWN

NXT_EV3_LARGE_MOTOR

EV3_MEDIUM_MOTOR

MotorType class objects

class MotorType()

name

@property
def name() -> str

Returns:

Human-readable name of the motor

identification

@property
def identification() -> 'Identification'

Returns:

What will Brian report as the ID when this motor is connected

default_constants

@property
def default_constants() -> 'DefaultConstants'

Returns:

Default controller configuration

default_acceleration_limit

@property
def default_acceleration_limit() -> int

Identification class objects

class Identification()

Results of auto-detection

device_type

@property
def device_type() -> 'DeviceClass'

Returns:

Detected device class (portMode must not be POWER_OFF)

device_class

@property
def device_class() -> 'DeviceType'

Returns:

More detailed device type

DefaultConstants class objects

class DefaultConstants()

Control loop parameters that are typically not changed much

Motor class objects

class Motor()

Linear dynamic model of the connected motor. This model can be used for estimating various internal states of the motor.

Kt_NmPerA

@property
def Kt_NmPerA() -> float

Returns:

Torque constant, in N*m/A

Kb_VPerRadPerSec

@property
def Kb_VPerRadPerSec() -> float

Returns:

Torque constant in V/(rad/sec)

B_NmPerRadPerSec

@property
def B_NmPerRadPerSec() -> float

Returns:

Friction constant, in N*m/(rad/sec)

Udeadzone_Volts

@property
def Udeadzone_Volts() -> float

Returns:

Voltage needed to make the motor moves

R_Ohm

@property
def R_Ohm() -> float

Returns:

Armature resistance, in ohms

L_Henry

@property
def L_Henry() -> float

Returns:

Armature inductance, in henry

Cp_Farad

@property
def Cp_Farad() -> float

Returns:

Capacity of a EMI-eliminating capacitor across motor terminals, in farads

ticksPerRevolution

@property
def ticksPerRevolution() -> float

Returns:

Number of encoder ticks per one revolution.

Controller class objects

class Controller()

Constants of the position/speed controller Brian implements these two controllers: - a parallel-form 2-degrees-of-freedom PI controller for motor speed 1, and - a cascaded P controller for motor position.

speedKp

@property
def speedKp() -> float

Returns:

Proportional constant of the speed PI controller

speedKi

@property
def speedKi() -> float

Returns:

Integral constant of the speed PI controller

speedBeta

@property
def speedBeta() -> float

Returns:

Setpoint weight in the proportional branch of the PI controller (see 1)

positionKp

@property
def positionKp() -> float

Returns:

Proportional constant of the cascaded position P controller (its output is target speed in ticks/s)

positionToleranceTicks

@property
def positionToleranceTicks() -> int

Returns:

Tolerate up to this deviation with zero output (needed for EV3 medium motor)

Observer class objects

class Observer()

Additional configuration of state observer.

current

@property
def current() -> 'Current'

Current

speed

@property
def speed() -> 'Speed'

Speed

Current class objects

class Current()

Current observer parameters. Brian has to estimate motor winding current from H-bridge current measurements. These are not equal (PWM=0 makes the winding current impossible to directly measure). The way it does so is by simulating the current response using the provided model and then correcting the predicted value using real measurements (when they're available).

measurementWeight_pct

@property
def measurementWeight_pct() -> int

Returns:

Correction step: How much weight to give to measurements vs. model prediction

minimumPwmOnTime_pct

@property
def minimumPwmOnTime_pct() -> int

Returns:

Only trust measurements if the PWM has at least this duty cycle

Speed class objects

class Speed()

Speed tracking loop parameters Brian estimates motor speed using a tracking loop/observer inspired by figure 3 and equations (6) in 2. These constants specify the parameters of the loop.

Kp

@property
def Kp() -> int

Ki

@property
def Ki() -> int