PiStorms  4.015
PiStorms Library Reference by mindsensors.com
 All Classes Namespaces Files Functions Variables
PiStorms_GRX.RCServoEncoder Class Reference

This class provides functions for controlling a servo and encoder connected to the PiStorms-GRX. More...

Inheritance diagram for PiStorms_GRX.RCServoEncoder:
PiStorms_GRX.RCServo PiStorms_GRX.GrovePort

Public Member Functions

def __init__
 Initialize an RC servo object with an associated encoder. More...
 
def setTarget
 Set the position which this servo should target. More...
 
def readEncoder
 Read the current position of this servo according to the encoder. More...
 
- Public Member Functions inherited from PiStorms_GRX.RCServo
def __init__
 Initialize an RC servo object. More...
 
def setPulse
 Sets the pulse being send to this servo. More...
 
def setPos
 Use this method to set the position of regular servos. More...
 
def setSpeed
 Use this method to set the speed of continuous rotation servos. More...
 
def setNeutralPoint
 Update the neutral point of this servo. More...
 
def setNeutral
 Return this servo to the neutral position. More...
 
def stop
 Stop sending a signal altogether to this servo. More...
 
- Public Member Functions inherited from PiStorms_GRX.GrovePort
def __init__
 

Additional Inherited Members

- Public Attributes inherited from PiStorms_GRX.RCServo
 sendDataArray
 
 speed
 
 bankAddr
 
 pinNum
 
 pos
 
 neutralPoint
 
 range
 
- Public Attributes inherited from PiStorms_GRX.GrovePort
 comm
 
 readValue
 
 writeValue
 

Detailed Description

This class provides functions for controlling a servo and encoder connected to the PiStorms-GRX.

Constructor & Destructor Documentation

def PiStorms_GRX.RCServoEncoder.__init__ (   self,
  port = None,
  encoder = None,
  neutralPoint = None 
)

Initialize an RC servo object with an associated encoder.

Parameters
portMust be a valid port, one of [BAS1, BAS2, BAS3, BBS1, BBS2, BBS3]. The first two characters are "BA" or "BB", for "Bank A" or "Bank B". The third character is 'S' for "Servo". The fourth character is the pin number. See the RCServo class documentation for details.
encoderYou may associate an encoder with this servo by specifying the digital port it is connected to.
neutralPointYou may specify the neutral point of this servo. The default is 1500, but as a result of the manufacturing process for these servos each has a slightly different neutral point. For example, if your continuous rotation servo continues to spin when you call setNeutral, it likely has the wrong neutral point set. You can update this at any time with setNeutralPoint(self, neutralPoint). If you have ran 45-Utils/03-FindNeutralPoint.py, this configuration will be loaded automatically. Make sure the port is the same as when you configured it.

Member Function Documentation

def PiStorms_GRX.RCServoEncoder.readEncoder (   self)

Read the current position of this servo according to the encoder.

def PiStorms_GRX.RCServoEncoder.setTarget (   self,
  degrees 
)

Set the position which this servo should target.

It will try to move until it knows from the encoder that it's in the right place.

Parameters
degreesWhere the servo should target. This is in degrees and may be between negative two billion and positive two billion.

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