ckbot :: pololu :: ServoModule :: Class ServoModule
[hide private]
[frames] | no frames]

Class ServoModule

source code



ServoModule Class has the basic functionality of ServoModules, with some exceptions listed below:

- Pololu Modules cannot get_pos or is_slack
- The Pololu Device allows for:
- servo parameter settings
- set speed
- set neutral
and various options for setting positions. We currently only use absolute 
positions however. For more information refer to the Pololu User Manual
on p.6

Instance Methods [hide private]
 
__init__(self, node_id, typecode, pna, *argv, **kwarg)
Concrete constructor.
source code
 
is_slack(self)
Returns true if the module is slack, none if go_slack has not been called yet.
source code
 
get_pos(self)
Returns the 'believed' position of the module, none if set_pos has not been called yet.
source code
 
go_slack(self)
Equivalent of setting a ServoModule slack.
source code
 
set_pos(self, pos)
Sets the position of a pololu module.
source code

Inherited from ckmodule.AbstractServoModule: get_pos_async, set_pos_UNSAFE

Inherited from ckmodule.Module: get_od, iterattr, iterhwaddr, iterprop, reset, start, stop

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
_deg2pol(cls, angle)
Returns a correctly scaled module position
source code

Inherited from ckmodule.Module: newFromDiscovery

Class Variables [hide private]

Inherited from ckmodule.AbstractServoModule: POS_LOWER, POS_UPPER

Inherited from ckmodule.Module: Types

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, node_id, typecode, pna, *argv, **kwarg)
(Constructor)

source code 

Concrete constructor. 

ATTRIBUTES:
  node_id -- 7 bit number to address a module uniquely
  typecode -- version number of module code 
  pna -- ProtocolNodeAdaptor -- specialized for this node_id

Overrides: object.__init__
(inherited documentation)

_deg2pol(cls, angle)
Class Method

source code 

Returns a correctly scaled module position

INPUT: angle -- int -- between 9000 to -9000, in 100ths of degrees, 0 is neutral

OUTPUT: corrected_angle -- int -- scaled between 0 and 255, 127 is neutral

is_slack(self)

source code 

Returns true if the module is slack, none if go_slack has not been called yet.

WARNING: This function does NOT actually read states from the pololu device, returns an attribute that is updated by calls to set_pos and go_slack. If any external communications fail, then this function may report incorrect states

Overrides: ckmodule.AbstractServoModule.is_slack

get_pos(self)

source code 

Returns the 'believed' position of the module, none if set_pos has not been called yet.

WARNING: This function does NOT actually read states from the pololu device, returns an attribute that is updated by calls to set_pos and go_slack. If any external communications fail, then this function may report incorrect states

Overrides: ckmodule.AbstractServoModule.get_pos

go_slack(self)

source code 

Equivalent of setting a ServoModule slack. This is referred to as "off" as specified in the Pololu User Manual under the Command 0

Overrides: ckmodule.AbstractServoModule.go_slack

set_pos(self, pos)

source code 

Sets the position of a pololu module.

Uses the Pololu Set Absolute Position (Command 4) specified by the Pololu User Manual

INPUT: pos -- int -- the desired position of the module, value between 9000 and -9000

Overrides: ckmodule.AbstractServoModule.set_pos