brian.motors.motor_types package¶
Module contents¶
- class brian.motors.motor_types.DeviceClass(*values)¶
Bases:
Enum- NONE = 0¶
- ERROR = 1¶
- EV3_ANALOG_MOTOR = 2¶
- EV3_UART_DEVICE = 3¶
- class brian.motors.motor_types.DeviceType(*values)¶
Bases:
Enum- UNKNOWN = 0¶
- NXT_EV3_LARGE_MOTOR = 7¶
- EV3_MEDIUM_MOTOR = 8¶
- class brian.motors.motor_types.MotorType¶
Bases:
object- property name: str¶
Human-readable name of the motor
- Type:
return
- property identification: Identification¶
What will Brian report as the ID when this motor is connected
- Type:
return
- property default_constants: DefaultConstants¶
Default controller configuration
- Type:
return
- property default_acceleration_limit: int¶
- class Identification¶
Bases:
objectResults of auto-detection
- property device_type: DeviceClass¶
Detected device class (portMode must not be POWER_OFF)
- Type:
return
- property device_class: DeviceType¶
More detailed device type
- Type:
return
- class DefaultConstants¶
Bases:
objectControl loop parameters that are typically not changed much
- property controller: Controller¶
- class Motor¶
Bases:
objectLinear dynamic model of the connected motor. This model can be used for estimating various internal states of the motor.
- property Kt_NmPerA: float¶
Torque constant, in N*m/A
- Type:
return
- property Kb_VPerRadPerSec: float¶
Torque constant in V/(rad/sec)
- Type:
return
- property B_NmPerRadPerSec: float¶
Friction constant, in N*m/(rad/sec)
- Type:
return
- property Udeadzone_Volts: float¶
Voltage needed to make the motor moves
- Type:
return
- property R_Ohm: float¶
Armature resistance, in ohms
- Type:
return
- property L_Henry: float¶
Armature inductance, in henry
- Type:
return
- property Cp_Farad: float¶
Capacity of a EMI-eliminating capacitor across motor terminals, in farads
- Type:
return
- property ticksPerRevolution: float¶
Number of encoder ticks per one revolution.
- Type:
return
- class Controller¶
Bases:
objectConstants 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. [1]: https://www.mathworks.com/help/control/ug/two-degree-of-freedom-2-dof-pid-controllers.html
- property speedKp: float¶
Proportional constant of the speed PI controller
- Type:
return
- property speedKi: float¶
Integral constant of the speed PI controller
- Type:
return
- property speedBeta: float¶
Setpoint weight in the proportional branch of the PI controller (see [1])
- Type:
return
- property positionKp: float¶
Proportional constant of the cascaded position P controller (its output is target speed in ticks/s)
- Type:
return
- property positionToleranceTicks: int¶
Tolerate up to this deviation with zero output (needed for EV3 medium motor)
- Type:
return
- class Observer¶
Bases:
objectAdditional configuration of state observer.
- class Current¶
Bases:
objectCurrent 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).
- property measurementWeight_pct: int¶
Correction step: How much weight to give to measurements vs. model prediction
- Type:
return
- property minimumPwmOnTime_pct: int¶
Only trust measurements if the PWM has at least this duty cycle
- Type:
return
- class Speed¶
Bases:
objectSpeed 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. [2]: https://www.sciencedirect.com/science/article/pii/S2405896319326618
- property Kp: int¶
- property Ki: int¶