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_bus
NumberI2C bus to use.
-
address
NumberAddress of your SmartDrive .
Returns:
command
-
cmd
Writes a specified command on the command register of the SmartDrive
Parameters:
-
cmd
NumberThe 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_id
NumberNumber of the motor you wish to read.
Returns:
Run_Unlimited
-
motor_id
-
direction
-
speed
Turns the specified motor(s) forever
Parameters:
-
motor_id
NumberNumber of the motor(s) you wish to turn.
-
direction
NumberThe direction you wish to turn the motor(s).
-
speed
NumberThe speed at which you wish to turn the motor(s).
StopMotor
-
motor_id
-
next_action
Stops the specified motor(s)
Parameters:
-
motor_id
NumberNumber of the motor(s) you wish to turn.
-
next_action
NumberHow 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_id
NumberNumber of the motor(s) you wish to turn.
-
direction
NumberThe direction you wish to turn the motor(s).
-
speed
NumberThe speed at which you wish to turn the motor(s).
-
duration
NumberThe time in seconds you wish to turn the motor(s).
-
wait_for_completion
BooleanTells the program when to handle the next line of code.
-
next_action
NumberHow 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_id
NumberNumber 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_id
NumberNumber 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_id
NumberNumber of the motor(s) you wish to turn.
-
direction
NumberThe direction you wish to turn the motor(s).
-
speed
NumberThe speed at which you wish to turn the motor(s).
-
degrees
NumberThe relative tacheometer count you wish to turn the motor(s).
-
wait_for_completion
BooleanTells the program when to handle the next line of code.
-
next_action
NumberHow 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_id
NumberNumber of the motor(s) you wish to turn.
-
direction
NumberThe direction you wish to turn the motor(s).
-
speed
NumberThe speed at which you wish to turn the motor(s).
-
rotations
NumberThe relative amount of rotations you wish to turn the motor(s).
-
wait_for_completion
BooleanTells the program when to handle the next line of code.
-
next_action
NumberHow 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_id
NumberNumber of the motor(s) you wish to turn.
-
speed
NumberThe speed at which you wish to turn the motor(s).
-
tacho_count
NumberThe absolute tacheometer count you wish to turn the motor(s).
-
wait_for_completion
BooleanTells the program when to handle the next line of code.
-
next_action
NumberHow 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_id
NumberNumber 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_id
NumberNumber 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_tacho
NumberProportional-gain of the tacheometer position of the motor.
-
Ki_tacho
NumberIntegral-gain of the tacheometer position of the motor.
-
Kd_tacho
NumberDerivative-gain of the tacheometer position of the motor.
-
Kp_speed
NumberProportional-gain of the speed of the motor.
-
Ki_speed
NumberIntegral-gain of the speed of the motor.
-
Kd_speed
NumberDerivative-gain of the speed of the motor.
-
passcount
Numberundefined
-
tolerance
Numberundefined
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_id
Numberundefined
Returns:
PrintMotorStatus
-
motor_id
Print the detailed status of the motor
Parameters:
-
motor_id
NumberNumber fo the motor to check