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

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

Inheritance diagram for PiStorms_GRX.RCServo:
PiStorms_GRX.RCServoEncoder

Public Member Functions

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 Attributes

 sendDataArray
 
 speed
 
 bankAddr
 
 pinNum
 
 pos
 
 neutralPoint
 
 range
 

Detailed Description

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

It has six servo pins at the top of the device. There are three on Bank A and three on Bank B. The pins on the outside, closer to the edge of the device, are numbered 1. The next pins inward are pin 2, and the pins closest to the center are pin 3. The ports are represented in the form "BAS1" for Bank A Servo 1. Looking at the top of the device with the screen facing you, the ports are, from left to right:

BBS1, BBS2, BBS3, BAS3, BAS2, BAS1

The signal pin should be facing away from you (closer to the Raspberry Pi) and the ground pin should be closer to you, towards the front of the device with the screen. Of course this leaves the voltage pin in the center. This class supports both regular servos and continuous rotation servos.

Constructor & Destructor Documentation

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

Initialize an RC servo object.

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.
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.RCServo.setNeutral (   self)

Return this servo to the neutral position.

For a regular servo it will go to the center, and a continuous rotation servo will stop rotating.

def PiStorms_GRX.RCServo.setNeutralPoint (   self,
  neutralPoint 
)

Update the neutral point of this servo.

Parameters
neutralPointThe new neutral point of this servo. As with setPos(self, newPos), this number must be between 500 and 2500.
Note
This does not call self.setNeutral(self) after the neutral point is set.
def PiStorms_GRX.RCServo.setPos (   self,
  newPos 
)

Use this method to set the position of regular servos.

Parameters
newPosA position between 0.0 and 180.0, with 90.0 being the nominal center value.
def PiStorms_GRX.RCServo.setPulse (   self,
  pulse 
)

Sets the pulse being send to this servo.

Parameters
pulseA number of microseconds for the pulse length.
Remarks
There is no need to use this method directly in your program.
def PiStorms_GRX.RCServo.setSpeed (   self,
  speed 
)

Use this method to set the speed of continuous rotation servos.

Parameters
speedA decimal between -100 and 100 for what speed this servos should run at.
def PiStorms_GRX.RCServo.stop (   self)

Stop sending a signal altogether to this servo.


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