DC Motor abstraction.
More...
|
def | __init__ (self, index=None) |
|
def | resetData (self) |
|
def | reload (self) |
|
def | addCallback (self, name, func) |
|
def | removeCallback (self, name) |
|
def | hasCallback (self, name) |
|
def | doCallbacks (self) |
|
def | start (self) |
|
def | stop (self) |
|
def | save (self) |
|
def | setDriveState (self, driveState=0) |
|
def | updateDriveState (self) |
|
def | simulateKeyUp (self) |
|
def | updateShadowState (self) |
|
def | initControllers (self) |
|
def | hasControllers (self) |
|
def | newController (self, controllerType='joystick') |
|
def | updateController (self, controller, controllerType='joystick') |
|
def | hasController (self, controllerType, ident) |
|
def | removeController (self, controllerType, ident) |
|
def | joystickCallback (self, dev_num, signal, number, name, value, init) |
|
def | keyboardCallback (self, hex, ascii) |
|
def | __init__ (self, index=None, autoload=True) |
|
def | reload (self) |
|
def | save (self) |
|
def | delete (self) |
|
def | blobExists (self) |
|
def | getModulePath (self) |
|
def | getTypePath (self) |
|
def | getRowPath (self) |
|
def | getRowFileName (self) |
|
|
def | CleanupGpio () |
|
def | reindex (force=False) |
|
def | find (jbModule, jbType, jbIndex) |
|
def | all (jbModule=None, jbType=None) |
|
def | hydrate (jbModule=None, jbType=None, ids=[]) |
|
|
| jsonData |
|
| now |
|
| shadowState |
|
| driveTypes |
|
| pwm |
|
| scheduler |
|
| kbthread |
|
| last |
|
| running |
|
| controllersEnabled |
|
| driveType |
|
| pins |
|
| enabled |
|
| acceleration |
|
| controllers |
|
| driveState |
|
| joystickRegistry |
|
| jbModule |
|
| jbType |
|
| jbIndex |
|
| jsonData |
|
|
| basepath = os.path.join(AmsEnvironment.FilePath(), 'jsonblob') |
|
| indexpath = os.path.join(basepath, 'index.json') |
|
dictionary | constructors = {} |
|
bool | indexexists = False |
|
bool | indexed = False |
|
dictionary | index = {} |
|
§ __init__()
def Motors.DcMotor.__init__ |
( |
|
self, |
|
|
|
index = None |
|
) |
| |
Initializes the DcMotor object
@param index
§ addCallback()
def Motors.DcMotor.addCallback |
( |
|
self, |
|
|
|
name, |
|
|
|
func |
|
) |
| |
add a callback to this motor
§ CleanupGpio()
def Motors.DcMotor.CleanupGpio |
( |
| ) |
|
|
static |
calls GPIO.cleanup()
allows other modules to statically cleanup GPIO pins without importing RPi.GPIO
§ doCallbacks()
def Motors.DcMotor.doCallbacks |
( |
|
self | ) |
|
§ hasCallback()
def Motors.DcMotor.hasCallback |
( |
|
self, |
|
|
|
name |
|
) |
| |
check if a callback exists
§ hasController()
def Motors.DcMotor.hasController |
( |
|
self, |
|
|
|
controllerType, |
|
|
|
ident |
|
) |
| |
check if a controller exists
§ hasControllers()
def Motors.DcMotor.hasControllers |
( |
|
self | ) |
|
check if any controllers exist
§ initControllers()
def Motors.DcMotor.initControllers |
( |
|
self | ) |
|
register controllers with joystick or keyboard services
§ joystickCallback()
def Motors.DcMotor.joystickCallback |
( |
|
self, |
|
|
|
dev_num, |
|
|
|
signal, |
|
|
|
number, |
|
|
|
name, |
|
|
|
value, |
|
|
|
init |
|
) |
| |
perform joystick callback
§ keyboardCallback()
def Motors.DcMotor.keyboardCallback |
( |
|
self, |
|
|
|
hex, |
|
|
|
ascii |
|
) |
| |
perform keyboard callback
§ newController()
def Motors.DcMotor.newController |
( |
|
self, |
|
|
|
controllerType = 'joystick' |
|
) |
| |
get the default dict for a controller
§ reload()
def Motors.DcMotor.reload |
( |
|
self | ) |
|
override - sync object with saved data
§ removeCallback()
def Motors.DcMotor.removeCallback |
( |
|
self, |
|
|
|
name |
|
) |
| |
remove a callback from this motor
§ removeController()
def Motors.DcMotor.removeController |
( |
|
self, |
|
|
|
controllerType, |
|
|
|
ident |
|
) |
| |
remove controller from motor
§ resetData()
def Motors.DcMotor.resetData |
( |
|
self | ) |
|
sync motor with saved data
§ save()
def Motors.DcMotor.save |
( |
|
self | ) |
|
add a callback to this motor
§ setDriveState()
def Motors.DcMotor.setDriveState |
( |
|
self, |
|
|
|
driveState = 0 |
|
) |
| |
sets the drive state
start if enabled, sanitize, clip and apply drive state
§ simulateKeyUp()
def Motors.DcMotor.simulateKeyUp |
( |
|
self | ) |
|
simulate keyup event
the keyboard service provides repeated callbacks while a key is pressed.
this simulates a keyup event to stop the motor.
there is a gap between the first callback and subsequent callbacks so at a minimum the motor must run for 0.5 seconds.
§ start()
def Motors.DcMotor.start |
( |
|
self | ) |
|
start motor
setup gpio pins
§ stop()
def Motors.DcMotor.stop |
( |
|
self | ) |
|
stop motor
shutdown gpio pins
§ updateController()
def Motors.DcMotor.updateController |
( |
|
self, |
|
|
|
controller, |
|
|
|
controllerType = 'joystick' |
|
) |
| |
§ updateShadowState()
def Motors.DcMotor.updateShadowState |
( |
|
self | ) |
|
accelerate / decelerate shadow state
this allows the shadow state to lag behind the drive state to produce acceleration / deceleration effect
The documentation for this class was generated from the following file: