OE - Pi  1.1
 All Classes Namespaces Functions
SmartDrive.SmartDrive Class Reference

SmartDrive: this class provides motor control functions. More...

Inheritance diagram for SmartDrive.SmartDrive:
OpenElectrons_i2c.OpenElectrons_i2c

Public Member Functions

def __init__
 Initialize the class with the i2c address of your SmartDrive. More...
 
def command
 Writes a specified command on the command register of the SmartDrive. More...
 
def GetBattVoltage
 Reads the battery voltage. More...
 
def ReadTachometerPosition
 Function not supported. More...
 
def SmartDrive_Run_Unlimited
 Turns the specified motor(s) forever. More...
 
def SmartDrive_Stop
 Stops the specified motor(s) More...
 
def SmartDrive_Run_Seconds
 Turns the specified motor(s) for a given amount of seconds. More...
 
def SmartDrive_WaitUntilTimeDone
 Waits until the specified time for the motor(s) to run is completed. More...
 
def SmartDrive_IsTimeDone
 Checks to ensure the specified time for the motor(s) to run is completed. More...
 
def SmartDrive_Run_Degrees
 Turns the specified motor(s) for given relative tacheometer count. More...
 
def SmartDrive_Run_Rotations
 Turns the specified motor(s) for given relative tacheometer count. More...
 
def SmartDrive_Run_Tacho
 Turns the specified motor(s) for given absolute tacheometer count. More...
 
def SmartDrive_WaitUntilTachoDone
 Waits until the specified tacheomter count for the motor(s) to run is reached. More...
 
def SmartDrive_IsTachoDone
 Checks to ensure the specified tacheomter count for the motor(s) to run is reached. More...
 
def SetPerformanceParameters
 Writes user specified values to the PID control registers. More...
 
def ReadPerformanceParameters
 Reads the values of the PID control registers. More...
 
- Public Member Functions inherited from OpenElectrons_i2c.OpenElectrons_i2c
def __init__
 Initialize the class with the i2c address of your device. More...
 
def errMsg
 Prints an error message if a read error is detected. More...
 
def writeByte
 Write a byte to your i2c device at a given location. More...
 
def readByte
 Read an unsigned byte from your i2c device at a given location. More...
 
def simpleWriteByte
 Write a byte to your i2c device at a given location. More...
 
def simpleReadByte
 Read an unsigned byte from your i2c device at a given location. More...
 
def readByteSigned
 Read a signed byte from your i2c device at a given location. More...
 
def readArray
 Read a byte array from your i2c device starting at a given location. More...
 
def writeArray
 Write a byte array from your i2c device starting at a given location. More...
 
def readString
 Read a string from your i2c device starting at a given location. More...
 
def readIntegerBE
 Read an unsigned 16 bit integer from your i2c device from a given location. More...
 
def readInteger
 Read an unsigned 16 bit integer from your i2c device from a given location. More...
 
def readIntegerSignedBE
 Read a signed 16 bit integer from your i2c device from a given location. More...
 
def readIntegerSigned
 Read a signed 16 bit integer from your i2c device from a given location. More...
 
def readLongBE
 Read an unsigned 32bit integer from your i2c device from a given location. More...
 
def readLong
 Read an unsigned 32bit integer from your i2c device from a given location. More...
 
def readLongSignedBE
 Read a signed 32bit integer from your i2c device from a given location. More...
 
def readLongSigned
 Read a signed 32bit integer from your i2c device from a given location. More...
 
def GetFirmwareVersion
 Read the firmware version of the i2c device. More...
 
def GetVendorName
 Read the vendor name of the i2c device. More...
 
def GetDeviceId
 Read the i2c device id. More...
 

Static Public Attributes

tuple SmartDrive_ADDRESS = (0x36)
 
float SmartDrive_VOLTAGE_MULTIPLIER = 212.7
 
int SmartDrive_Motor_1 = 0x01
 
int SmartDrive_Motor_2 = 0x02
 
int SmartDrive_Motor_Both = 0x03
 
int SmartDrive_Next_Action_Float = 0x00
 
int SmartDrive_Next_Action_Brake = 0x01
 
int SmartDrive_Next_Action_BrakeHold = 0x02
 
int SmartDrive_Direction_Forward = 0x01
 
int SmartDrive_Direction_Reverse = 0x00
 
int SmartDrive_Move_Relative = 0x01
 
int SmartDrive_Move_Absolute = 0x00
 
int SmartDrive_Completion_Wait_For = 0x01
 
int SmartDrive_Completion_Dont_Wait = 0x00
 
int SmartDrive_Speed_Full = 90
 
int SmartDrive_Speed_Medium = 60
 
int SmartDrive_Speed_Slow = 25
 
int SmartDrive_CONTROL_SPEED = 0x01
 
int SmartDrive_CONTROL_RAMP = 0x02
 
int SmartDrive_CONTROL_RELATIVE = 0x04
 
int SmartDrive_CONTROL_TACHO = 0x08
 
int SmartDrive_CONTROL_BRK = 0x10
 
int SmartDrive_CONTROL_ON = 0x20
 
int SmartDrive_CONTROL_TIME = 0x40
 
int SmartDrive_CONTROL_GO = 0x80
 
int SmartDrive_COMMAND = 0x41
 
int SmartDrive_SETPT_M1 = 0x42
 
int SmartDrive_SPEED_M1 = 0x46
 
int SmartDrive_TIME_M1 = 0x47
 
int SmartDrive_CMD_B_M1 = 0x48
 
int SmartDrive_CMD_A_M1 = 0x49
 
int SmartDrive_SETPT_M2 = 0x4A
 
int SmartDrive_SPEED_M2 = 0x4E
 
int SmartDrive_TIME_M2 = 0x4F
 
int SmartDrive_CMD_B_M2 = 0x50
 
int SmartDrive_CMD_A_M2 = 0x51
 
int SmartDrive_POSITION_M1 = 0x52
 
int SmartDrive_POSITION_M2 = 0x56
 
int SmartDrive_STATUS_M1 = 0x5A
 
int SmartDrive_STATUS_M2 = 0x5B
 
int SmartDrive_TASKS_M1 = 0x5C
 
int SmartDrive_TASKS_M2 = 0x5D
 
int SmartDrive_P_Kp = 0x5E
 
int SmartDrive_P_Ki = 0x60
 
int SmartDrive_P_Kd = 0x62
 
int SmartDrive_S_Kp = 0x64
 
int SmartDrive_S_Ki = 0x66
 
int SmartDrive_S_Kd = 0x68
 
int SmartDrive_PASSCOUNT = 0x6A
 
int SmartDrive_PASSTOLERANCE = 0x6B
 
int SmartDrive_CHKSUM = 0x6C
 
int SmartDrive_BATT_VOLTAGE = 0x6E
 
int SmartDrive_RESETSTATUS = 0x6F
 
int SmartDrive_CURRENT_M1 = 0x70
 
int SmartDrive_CURRENT_M2 = 0x72
 
int R = 0x52
 
int S = 0x53
 
int a = 0x61
 
int b = 0x62
 
int c = 0x63
 
int A = 0x41
 
int B = 0x42
 
int C = 0x43
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenElectrons_i2c.OpenElectrons_i2c
def pi_rev
 
def which_bus
 
- Public Attributes inherited from OpenElectrons_i2c.OpenElectrons_i2c
 address
 
 bus
 

Detailed Description

SmartDrive: this class provides motor control functions.

Constructor & Destructor Documentation

def SmartDrive.SmartDrive.__init__ (   self,
  SmartDrive_address = SmartDrive_ADDRESS 
)

Initialize the class with the i2c address of your SmartDrive.

Parameters
selfThe object pointer.
SmartDrive_addressAddress of your SmartDrive.

Member Function Documentation

def SmartDrive.SmartDrive.command (   self,
  cmd 
)

Writes a specified command on the command register of the SmartDrive.

Parameters
selfThe object pointer.
cmdThe command you wish the SmartDrive to execute.
def SmartDrive.SmartDrive.GetBattVoltage (   self)

Reads the battery voltage.

Multiplier constant not yet verified

Parameters
selfThe object pointer.
def SmartDrive.SmartDrive.ReadPerformanceParameters (   self)

Reads the values of the PID control registers.

Parameters
selfThe object pointer.
def SmartDrive.SmartDrive.ReadTachometerPosition (   self,
  motor_number 
)

Function not supported.

May support function in the future. def GetMotorCurrent(self, motor_number): try: Reads the tacheometer position of the specified motor

Parameters
selfThe object pointer.
motor_numberNumber of the motor you wish to read.
def SmartDrive.SmartDrive.SetPerformanceParameters (   self,
  Kp_tacho,
  Ki_tacho,
  Kd_tacho,
  Kp_speed,
  Ki_speed,
  Kd_speed,
  passcount,
  tolerance 
)

Writes user specified values to the PID control registers.

Parameters
selfThe object pointer.
Kp_tachoProportional-gain of the tacheometer position of the motor.
Ki_tachoIntegral-gain of the tacheometer position of the motor.
Kd_tachoDerivative-gain of the tacheometer position of the motor.
Kp_speedProportional-gain of the speed of the motor.
Ki_speedIntegral-gain of the speed of the motor.
Kd_speedDerivative-gain of the speed of the motor.
def SmartDrive.SmartDrive.SmartDrive_IsTachoDone (   self,
  motor_number 
)

Checks to ensure the specified tacheomter count for the motor(s) to run is reached.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) to check.
def SmartDrive.SmartDrive.SmartDrive_IsTimeDone (   self,
  motor_number 
)

Checks to ensure the specified time for the motor(s) to run is completed.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) to check.
def SmartDrive.SmartDrive.SmartDrive_Run_Degrees (   self,
  motor_number,
  direction,
  speed,
  degrees,
  wait_for_completion,
  next_action 
)

Turns the specified motor(s) for given relative tacheometer count.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) you wish to turn.
directionThe direction you wish to turn the motor(s).
speedThe speed at which you wish to turn the motor(s).
degreesThe relative tacheometer count you wish to turn the motor(s).
wait_for_completionTells the program when to handle the next line of code.
next_actionHow you wish to stop the motor(s).
def SmartDrive.SmartDrive.SmartDrive_Run_Rotations (   self,
  motor_number,
  direction,
  speed,
  rotations,
  wait_for_completion,
  next_action 
)

Turns the specified motor(s) for given relative tacheometer count.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) you wish to turn.
directionThe direction you wish to turn the motor(s).
speedThe speed at which you wish to turn the motor(s).
rotationsThe relative amount of rotations you wish to turn the motor(s).
wait_for_completionTells the program when to handle the next line of code.
next_actionHow you wish to stop the motor(s).
def SmartDrive.SmartDrive.SmartDrive_Run_Seconds (   self,
  motor_number,
  direction,
  speed,
  duration,
  wait_for_completion,
  next_action 
)

Turns the specified motor(s) for a given amount of seconds.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) you wish to turn.
directionThe direction you wish to turn the motor(s).
speedThe speed at which you wish to turn the motor(s).
durationThe time in seconds you wish to turn the motor(s).
wait_for_completionTells the program when to handle the next line of code.
next_actionHow you wish to stop the motor(s).
def SmartDrive.SmartDrive.SmartDrive_Run_Tacho (   self,
  motor_number,
  speed,
  tacho_count,
  wait_for_completion,
  next_action 
)

Turns the specified motor(s) for given absolute tacheometer count.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) you wish to turn.
directionThe direction you wish to turn the motor(s).
speedThe speed at which you wish to turn the motor(s).
tacho_countThe absolute tacheometer count you wish to turn the motor(s).
wait_for_completionTells the program when to handle the next line of code.
next_actionHow you wish to stop the motor(s).
def SmartDrive.SmartDrive.SmartDrive_Run_Unlimited (   self,
  motor_number,
  direction,
  speed 
)

Turns the specified motor(s) forever.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) you wish to turn.
directionThe direction you wish to turn the motor(s).
speedThe speed at which you wish to turn the motor(s).
def SmartDrive.SmartDrive.SmartDrive_Stop (   self,
  motor_number,
  next_action 
)

Stops the specified motor(s)

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) you wish to turn.
next_actionHow you wish to stop the motor(s).
def SmartDrive.SmartDrive.SmartDrive_WaitUntilTachoDone (   self,
  motor_number 
)

Waits until the specified tacheomter count for the motor(s) to run is reached.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) to wait for.
def SmartDrive.SmartDrive.SmartDrive_WaitUntilTimeDone (   self,
  motor_number 
)

Waits until the specified time for the motor(s) to run is completed.

Parameters
selfThe object pointer.
motor_numberNumber of the motor(s) to wait for.

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