ME 405 Romi
Loading...
Searching...
No Matches
motor.Motor Class Reference

The Motor Diver Class. More...

Public Member Functions

 __init__ (self, PWM, DIR, nSLP, timer, ch)
 Motor Initialization.
 set_effort (self, effort)
 Set Effort Sets the present effort requested from the motor based on an input value between -100 and 100.
 enable (self)
 Enable Enables the motor driver by taking it out of sleep mode into brake mode.
 disable (self)
 Disable Disables the motor driver by taking it into sleep mode.

Public Attributes

 nSLP = Pin(nSLP, mode=Pin.OUT_PP, value=0)
 dir = Pin(DIR, mode=Pin.OUT_PP, value=0)
 timCH = timer.channel(ch, pin=PWM, mode=Timer.PWM, pulse_width_percent=0)

Detailed Description

The Motor Diver Class.

A motor driver interface encapsulated in a Python class. Works with motor drivers using separate PWM and direction inputs such as the DRV8838 drivers present on the Romi chassis from Pololu.

Definition at line 8 of file motor.py.

Constructor & Destructor Documentation

◆ __init__()

motor.Motor.__init__ ( self,
PWM,
DIR,
nSLP,
timer,
ch )

Motor Initialization.

Parameters
P1Motor Effort Pin
P2Motor Direction Pin
P3Motor Enable pin
P4Motor timer channel

Definition at line 14 of file motor.py.

Member Function Documentation

◆ disable()

motor.Motor.disable ( self)

Disable Disables the motor driver by taking it into sleep mode.

Definition at line 37 of file motor.py.

◆ enable()

motor.Motor.enable ( self)

Enable Enables the motor driver by taking it out of sleep mode into brake mode.

Definition at line 32 of file motor.py.

◆ set_effort()

motor.Motor.set_effort ( self,
effort )

Set Effort Sets the present effort requested from the motor based on an input value between -100 and 100.

Definition at line 22 of file motor.py.

Member Data Documentation

◆ dir

motor.Motor.dir = Pin(DIR, mode=Pin.OUT_PP, value=0)

Definition at line 17 of file motor.py.

◆ nSLP

motor.Motor.nSLP = Pin(nSLP, mode=Pin.OUT_PP, value=0)

Definition at line 16 of file motor.py.

◆ timCH

motor.Motor.timCH = timer.channel(ch, pin=PWM, mode=Timer.PWM, pulse_width_percent=0)

Definition at line 18 of file motor.py.


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