botlib.motor
index
/home/witling/dev/botlib/botlib/motor.py

 
Modules
       
array
spidev
subprocess

 
Classes
       
builtins.object
Motor
CalibratedMotor

 
class CalibratedMotor(Motor)
    A `Motor` that can be positioned. Due to positions being different on every bot,
such `Motor`s need to be `calibrated` first.
 
 
Method resolution order:
CalibratedMotor
Motor
builtins.object

Methods defined here:
__init__(self, port, pmin=None, pmax=None, calpow=20)
Create a `CalibratedMotor` instance. If 
 
:param port: which BrickPi motor to address.
:param pmin: the minimum position (if known).
:param pmax: the maximum position (if known).
:param calpow: the power with which the motor will be calibrated.
calibrate(self)
Determine minimum, maximum and initial position. This sets the motor power to `calpow`
and waits until the position does not change anymore giving minimum position. Repeat
process in the opposite direction afterwards. The initial position is the median between both values.
 
Hacky, but works in most cases.
change_position(self, pnew)
Set the new position of the motor.
 
:param pnew: If minimum and maximum are known, this value must be between both.
position_from_factor(self, factor)
Determines the position from a factor. Minimum, maximum and initial position must be known.
 
:param factor: number between -1.0 and 1.0.
to_init_position(self)
Reset the motor to its initial position. Throws exception if value is not known.

Methods inherited from Motor:
change_power(self, pnew)
Set the new power of the motor. This function gracefully transitions the current power 
to parameter `pnew`.
 
:param pnew: a value between -100 and 100. if value is not in range, nothing will be changed.
status(self)
Retrieve information about the motor e.g. position, power.
stop(self)
Turn motor power to zero.

Data descriptors inherited from Motor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Motor:
STATUS_POWER = 1

 
class Motor(builtins.object)
    Wrapper for BrickPi3 motor control.
 
  Methods defined here:
__init__(self, port)
Create a `Motor` instance.
 
:param port: which BrickPi motor to address.
change_power(self, pnew)
Set the new power of the motor. This function gracefully transitions the current power 
to parameter `pnew`.
 
:param pnew: a value between -100 and 100. if value is not in range, nothing will be changed.
status(self)
Retrieve information about the motor e.g. position, power.
stop(self)
Turn motor power to zero.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
STATUS_POWER = 1

 
Data
        BP_SPI = <SpiDev object>
FIRMWARE_VERSION_REQUIRED = '1.4.x'
division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
print_function = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 65536)