SmartDrive Class
- ID: smartdrive
- Name: SmartDrive Advanced Motor Controller
- Other Names: smartdrive
- Category: motor
- Manufacturer: openelectrons
- Connection: i2c
SmartDrive is a multiplexer to control high current DC motors
This module has been tested on the SmartDrive .
Item Index
Methods
SmartDrive
-
i2c_bus -
address
Initialize the class with the i2c address of your SmartDrive
Parameters:
-
i2c_busNumberI2C bus to use.
-
addressNumberAddress of your SmartDrive .
Returns:
command
-
cmd
Writes a specified command on the command register of the SmartDrive
Parameters:
-
cmdNumberThe command you wish the SmartDrive to execute.
GetBattVoltage
()
Number
Reads the battery voltage. Multiplier constant not yet verified
Returns:
ReadTachometerPosition
-
motor_id
Reads the tacheometer position of the specified motor
Parameters:
-
motor_idNumberNumber of the motor you wish to read.
Returns:
Run_Unlimited
-
motor_id -
direction -
speed
Turns the specified motor(s) forever
Parameters:
-
motor_idNumberNumber of the motor(s) you wish to turn.
-
directionNumberThe direction you wish to turn the motor(s).
-
speedNumberThe speed at which you wish to turn the motor(s).
StopMotor
-
motor_id -
next_action
Stops the specified motor(s)
Parameters:
-
motor_idNumberNumber of the motor(s) you wish to turn.
-
next_actionNumberHow you wish to stop the motor(s).
Run_Seconds
-
motor_id -
direction -
speed -
duration -
wait_for_completion -
next_action
Turns the specified motor(s) for a given amount of seconds
Parameters:
-
motor_idNumberNumber of the motor(s) you wish to turn.
-
directionNumberThe direction you wish to turn the motor(s).
-
speedNumberThe speed at which you wish to turn the motor(s).
-
durationNumberThe time in seconds you wish to turn the motor(s).
-
wait_for_completionBooleanTells the program when to handle the next line of code.
-
next_actionNumberHow you wish to stop the motor(s).
WaitUntilTimeDone
-
motor_id
Waits until the specified time for the motor(s) to run is completed
Parameters:
-
motor_idNumberNumber of the motor(s) to wait for.
IsTimeDone
-
motor_id
Checks to ensure the specified time for the motor(s) to run is completed.
Parameters:
-
motor_idNumberNumber of the motor(s) to check.
Returns:
Run_Degrees
-
motor_id -
direction -
speed -
degrees -
wait_for_completion -
next_action
Turns the specified motor(s) for given relative tacheometer count
Parameters:
-
motor_idNumberNumber of the motor(s) you wish to turn.
-
directionNumberThe direction you wish to turn the motor(s).
-
speedNumberThe speed at which you wish to turn the motor(s).
-
degreesNumberThe relative tacheometer count you wish to turn the motor(s).
-
wait_for_completionBooleanTells the program when to handle the next line of code.
-
next_actionNumberHow you wish to stop the motor(s).
Run_Rotations
-
motor_id -
direction -
speed -
rotations -
wait_for_completion -
next_action
Turns the specified motor(s) for given relative tacheometer count
Parameters:
-
motor_idNumberNumber of the motor(s) you wish to turn.
-
directionNumberThe direction you wish to turn the motor(s).
-
speedNumberThe speed at which you wish to turn the motor(s).
-
rotationsNumberThe relative amount of rotations you wish to turn the motor(s).
-
wait_for_completionBooleanTells the program when to handle the next line of code.
-
next_actionNumberHow you wish to stop the motor(s).
Run_Tacho
-
motor_id -
speed -
tacho_count -
wait_for_completion -
next_action
Turns the specified motor(s) for given absolute tacheometer count
Parameters:
-
motor_idNumberNumber of the motor(s) you wish to turn.
-
speedNumberThe speed at which you wish to turn the motor(s).
-
tacho_countNumberThe absolute tacheometer count you wish to turn the motor(s).
-
wait_for_completionBooleanTells the program when to handle the next line of code.
-
next_actionNumberHow you wish to stop the motor(s).
WaitUntilTachoDone
-
motor_id
Waits until the specified tacheomter count for the motor(s) to run is reached.
Parameters:
-
motor_idNumberNumber of the motor(s) to wait for.
IsTachoDone
-
motor_id
Checks to ensure the specified tacheomter count for the motor(s) to run is reached.
Parameters:
-
motor_idNumberNumber of the motor(s) to check.
Returns:
SetPerformanceParameters
-
Kp_tacho -
Ki_tacho -
Kd_tacho -
Kp_speed -
Ki_speed -
Kd_speed -
passcount -
tolerance
Writes user specified values to the PID control registers
Parameters:
-
Kp_tachoNumberProportional-gain of the tacheometer position of the motor.
-
Ki_tachoNumberIntegral-gain of the tacheometer position of the motor.
-
Kd_tachoNumberDerivative-gain of the tacheometer position of the motor.
-
Kp_speedNumberProportional-gain of the speed of the motor.
-
Ki_speedNumberIntegral-gain of the speed of the motor.
-
Kd_speedNumberDerivative-gain of the speed of the motor.
-
passcountNumberundefined
-
toleranceNumberundefined
ReadPerformanceParameters
()
Reads the values of the PID control registers
GetMotorStatus
-
motor_id
Read the status of a motor, and return it in a uint8_t param motor_id Number fo the motor to check
Parameters:
-
motor_idNumberundefined
Returns:
PrintMotorStatus
-
motor_id
Print the detailed status of the motor
Parameters:
-
motor_idNumberNumber fo the motor to check