Slush Engine  1.0
Software to control a Slush Engine
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Slush.Motor.Motor Class Reference
Inheritance diagram for Slush.Motor.Motor:
Slush.Board.sBoard

Public Member Functions

def __init__
 
def init_chips (self)
 
def gpio_callback (self)
 
def initPeripherals (self)
 
def isBusy (self)
 
def waitMoveFinish (self)
 
def setMicroSteps
 
def setThresholdSpeed (self, thresholdSpeed)
 
def setCurrent (self, hold, run, acc, dec)
 
def setMaxSpeed (self, speed)
 
def setMinSpeed
 
def setAccel
 
def setDecel
 
def getPosition (self)
 
def getSpeed (self)
 
def setOverCurrent (self, ma_current)
 
def setStallCurrent (self, ma_current)
 
def setLowSpeedOpt
 
def setSlope (self, speed, start, acc, dec)
 
def run
 
def stepClock
 
def move
 
def goTo
 
def goToDir
 
def setLimitHardStop
 
def goUntilPress (self, act, dir, spd)
 
def getSwitch (self)
 
def goUntilRelease (self, act, dir)
 
def readSwitch (self)
 
def goHome (self)
 
def goMark (self)
 
def setMark (self, value)
 
def setAsHome (self)
 
def resetDev (self)
 
def softStop (self)
 
def hardStop (self)
 
def softFree (self)
 
def free (self)
 
def getStatus (self)
 
def accCalc
 
def decCalc
 
def maxSpdCalc
 
def minSpdCalc
 
def fsCalc
 
def intSpdCalc
 
def spdCalc
 
def param
 
def xfer (self, data)
 
def setParam (self, param, value)
 
def getParam
 
def convert (self, val)
 
def paramHandler
 
- Public Member Functions inherited from Slush.Board.sBoard
def __init__ (self, board='XLT', debug="LOW")
 
def set_debug_level
 
def initGPIOState (self)
 
def initSPI (self)
 
def initI2C (self)
 
def deinitBoard (self)
 
def setIOState (self, port, pinNumber, state)
 
def getIOState (self, port, pinNumber)
 
def readInput (self, inputNumber)
 
def setOutput (self, outputNumber, state)
 
def readAnalog (self, inputNumber)
 
def setPWMOutput (self, outputNumber, pwmVal)
 

Public Attributes

 chipSelect
 
 chip_select
 
 port
 
 debug
 
 boardInUse
 
- Public Attributes inherited from Slush.Board.sBoard
 board
 
 debug
 
 bus
 
 chip
 

Static Public Attributes

dictionary chip_assignments
 
int boardInUse = 0
 
- Static Public Attributes inherited from Slush.Board.sBoard
int chip = 0
 
int bus = 0
 

Detailed Description

Class to control a stepper motor
Dictionary holding all of the associated motor chip selects for a given port

Member Function Documentation

def Slush.Motor.Motor.init_chips (   self,
  None 
)
Initialize all of the stepper motor chips. Set each chips ALARM register to ignore UVLO events.

Setup the gpio flag pin to be an input and setup event detection.
:return: None
def Slush.Motor.Motor.gpio_callback (   self,
  None 
)
Function called when the trigger pin has been activated. References self.debug which is inherited from Slush.Board
If the debug level is "OFF" nothing will happen
If the debug level is "LOW" there will be a console print notifying of the trigger
If the debug level is "HIGH" all motors will be freed and the program will exit
:return: None
def Slush.Motor.Motor.initPeripherals (   self,
  None 
)
Initialize the appropriate pins and busses
:return: None
def Slush.Motor.Motor.isBusy (   self,
  bool 
)
Check to see if the motion engine is busy
:return: Bool representing whether the motion engine is busy
def Slush.Motor.Motor.waitMoveFinish (   self,
  None 
)
Wait for the motor to finish moving.
NOTE: This method is blocking
:return: None
def Slush.Motor.Motor.setThresholdSpeed (   self,
  thresholdSpeed,
  None 
)
Set the threshold speed of the motor
:param thresholdSpeed: Threshold speed the motor is allowed to run at
:return: None
def Slush.Motor.Motor.setCurrent (   self,
  hold,
  run,
  acc,
  dec,
  None 
)
Set the motors current values
:param hold: Amount of hold current
:param run: Amount of run current
:param acc: Amount of acceleration current
:param dec: Amount of decceleration current
:return: None
def Slush.Motor.Motor.setMaxSpeed (   self,
  speed,
  None 
)
Set the maximum speed the motor will run at
:param speed: Motor's maximum speed
:return: None
def Slush.Motor.Motor.getPosition (   self,
  float 
)
Get the current position of the stepper motor, based upon it's home value
:rtype:float
:return: The current position of the stepper motor, based upon it's home value
def Slush.Motor.Motor.getSpeed (   self,
  int 
)
Get the speed of the motor
:rtype: int
:return: The speed of the motor
def Slush.Motor.Motor.setOverCurrent (   self,
  ma_current,
  None 
)
Set the over current threshold.
:param ma_current: The over current threshold amount in milliamps
:return: None
def Slush.Motor.Motor.setStallCurrent (   self,
  ma_current 
)
Set the stall current
:param ma_current: Stall current amount in milliamps
:return: None
def Slush.Motor.Motor.goUntilRelease (   self,
  act,
  dir,
  None 
)
Move the stepper motor until the attached switch has been released
:param act:
:param dir: Direction to move the motor (0 or 1)
:return: None
def Slush.Motor.Motor.readSwitch (   self,
  bool 
)
Read the value of the attached switch to the stepper motor
:rtype: bool
:return: Boolean whether the switch is depressed
def Slush.Motor.Motor.goHome (   self,
  None 
)
Move the stepper motor to it's home position
:return: None
def Slush.Motor.Motor.goMark (   self,
  None 
)
Move the stepper motor to it's mark position
:return: None
def Slush.Motor.Motor.setMark (   self,
  value,
  None 
)
Set the stepper motor's mark value
:param value: Value to set mark at
:return: None
def Slush.Motor.Motor.setAsHome (   self,
  None 
)
Set the stepper motor's current position to be it's new home position
:return: None
def Slush.Motor.Motor.resetDev (   self)
NOTE: This method has been deprecated as it interferes with GPIO chip monitoring
Reset the device to initial conditions.
:return:
def Slush.Motor.Motor.softStop (   self,
  None 
)
Stop the stepper motor by decelerating
:return: None
def Slush.Motor.Motor.hardStop (   self,
  None 
)
Immediately stop the stepper motor without deceleration
:return: None
def Slush.Motor.Motor.softFree (   self,
  None 
)
Decelerate the stepper motor and disable hold
:return: None
def Slush.Motor.Motor.free (   self,
  None 
)
Disable the stepper motor, allow it to move freely
:return: None
def Slush.Motor.Motor.getStatus (   self,
  int 
)
Get the status of the stepper motor.
:rtype: int
:return: Decimal representation of the stepper motors status register
def Slush.Motor.Motor.xfer (   self,
  data 
)
Transfer data to the spi bus
:param data: data to transfer
:return: Response from the spi bus
def Slush.Motor.Motor.convert (   self,
  val,
  int 
)
Convert twos compliment
:param val: value to convert
:return: Values two compliment

Member Data Documentation

dictionary Slush.Motor.Motor.chip_assignments
static
Initial value:
1 = {0: SLX.MTR0_ChipSelect, 1: SLX.MTR1_ChipSelect, 2: SLX.MTR2_ChipSelect, 3: SLX.MTR3_ChipSelect,
2  4: SLX.MTR4_ChipSelect, 5: SLX.MTR5_ChipSelect, 6: SLX.MTR6_ChipSelect}

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