pyupm_smartdrive module

class pyupm_smartdrive.SmartDrive(i2c_bus, address=27)[source]

Bases: object

API for the SmartDrive advanced motor controller from OpenElectronis.

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.

C++ includes: smartdrive.hpp

GetBattVoltage()[source]

float GetBattVoltage()

Reads the battery voltage. Multiplier constant not yet verified

GetMotorStatus(motor_id)[source]

uint8_t GetMotorStatus(int motor_id)

Read the status of a motor, and return it in a uint8_t param motor_id Number fo the motor to check

IsTachoDone(motor_id)[source]

bool IsTachoDone(int motor_id)

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

motor_id: Number of the motor(s) to check.

IsTimeDone(motor_id)[source]

bool IsTimeDone(int motor_id)

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

motor_id: Number of the motor(s) to check.

PrintMotorStatus(motor_id)[source]

void PrintMotorStatus(int motor_id)

Print the detailed status of the motor

motor_id: Number fo the motor to check

ReadPerformanceParameters()[source]

void ReadPerformanceParameters()

Reads the values of the PID control registers

ReadTachometerPosition(motor_id)[source]

uint32_t ReadTachometerPosition(int motor_id)

Reads the tacheometer position of the specified motor

motor_id: Number of the motor you wish to read.

Run_Degrees(motor_id, direction, speed, degrees, wait_for_completion, next_action)[source]

void Run_Degrees(int motor_id, int direction, uint8_t speed, uint32_t degrees, bool wait_for_completion, int next_action)

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

motor_id: Number of the motor(s) you wish to turn.

direction: The direction you wish to turn the motor(s).

speed: The speed at which you wish to turn the motor(s).

degrees: The relative tacheometer count you wish to turn the motor(s).

wait_for_completion: Tells the program when to handle the next line of code.

next_action: How you wish to stop the motor(s).

Run_Rotations(motor_id, direction, speed, rotations, wait_for_completion, next_action)[source]

void Run_Rotations(int motor_id, int direction, uint8_t speed, uint32_t rotations, bool wait_for_completion, int next_action)

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

motor_id: Number of the motor(s) you wish to turn.

direction: The direction you wish to turn the motor(s).

speed: The speed at which you wish to turn the motor(s).

rotations: The relative amount of rotations you wish to turn the motor(s).

wait_for_completion: Tells the program when to handle the next line of code.

next_action: How you wish to stop the motor(s).

Run_Seconds(motor_id, direction, speed, duration, wait_for_completion, next_action)[source]

void Run_Seconds(int motor_id, int direction, uint8_t speed, uint8_t duration, bool wait_for_completion, int next_action)

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

motor_id: Number of the motor(s) you wish to turn.

direction: The direction you wish to turn the motor(s).

speed: The speed at which you wish to turn the motor(s).

duration: The time in seconds you wish to turn the motor(s).

wait_for_completion: Tells the program when to handle the next line of code.

next_action: How you wish to stop the motor(s).

Run_Tacho(motor_id, speed, tacho_count, wait_for_completion, next_action)[source]

void Run_Tacho(int motor_id, uint8_t speed, uint32_t tacho_count, bool wait_for_completion, int next_action)

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

motor_id: Number of the motor(s) you wish to turn.

speed: The speed at which you wish to turn the motor(s).

tacho_count: The absolute tacheometer count you wish to turn the motor(s).

wait_for_completion: Tells the program when to handle the next line of code.

next_action: How you wish to stop the motor(s).

Run_Unlimited(motor_id, direction, speed)[source]

void Run_Unlimited(int motor_id, int direction, uint8_t speed)

Turns the specified motor(s) forever

motor_id: Number of the motor(s) you wish to turn.

direction: The direction you wish to turn the motor(s).

speed: The speed at which you wish to turn the motor(s).

SetPerformanceParameters(Kp_tacho, Ki_tacho, Kd_tacho, Kp_speed, Ki_speed, Kd_speed, passcount, tolerance)[source]

void SetPerformanceParameters(uint16_t Kp_tacho, uint16_t Ki_tacho, uint16_t Kd_tacho, uint16_t Kp_speed, uint16_t Ki_speed, uint16_t Kd_speed, uint8_t passcount, uint8_t tolerance)

Writes user specified values to the PID control registers

Kp_tacho: Proportional-gain of the tacheometer position of the motor.

Ki_tacho: Integral-gain of the tacheometer position of the motor.

Kd_tacho: Derivative-gain of the tacheometer position of the motor.

Kp_speed: Proportional-gain of the speed of the motor.

Ki_speed: Integral-gain of the speed of the motor.

Kd_speed: Derivative-gain of the speed of the motor.

StopMotor(motor_id, next_action)[source]

void StopMotor(int motor_id, int next_action)

Stops the specified motor(s)

motor_id: Number of the motor(s) you wish to turn.

next_action: How you wish to stop the motor(s).

WaitUntilTachoDone(motor_id)[source]

void WaitUntilTachoDone(int motor_id)

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

motor_id: Number of the motor(s) to wait for.

WaitUntilTimeDone(motor_id)[source]

void WaitUntilTimeDone(int motor_id)

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

motor_id: Number of the motor(s) to wait for.

command(cmd)[source]

void command(uint8_t cmd)

Writes a specified command on the command register of the SmartDrive

cmd: The command you wish the SmartDrive to execute.