Package ckbot :: Module hitec :: Class Protocol
[hide private]
[frames] | no frames]

Class Protocol

source code


TBD

Instance Methods [hide private]
 
__init__(self, bus=None, nodes=None, *args, **kw)
Initialize a hitec.Protocol
source code
 
scan(self)
Do a low-level scan for all nodes
source code
 
hintNodes(self, nodes)
*PURE* use hint that specified nodes are available
source code
 
write(self, *args, **kw)
Write out a command --> redirected to Bus.write
source code
 
read(self)
Read a response; redirected to Bus.read
source code
 
send_cmd_sync(self, *argv, **kw) source code
 
request(self, cmd, tx0, tx1, nid=None, **kw)
Write out a command and record incomplete reply
source code
 
_completeResponses(self, now, timeout=0.05, retries=4)
(private) Retries another request of incomplete message if timed out, and completes any request for which a response arrived.
source code
 
_pingAsNeeded(self, now) source code
 
update(self)
Complete any outstanding async requests and collect heartbeats
source code
 
generatePNA(self, nid)
Generates a pololu.ProtocolNodeAdaptor, associating a pololu protocol with a specific node id and returns it
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, bus=None, nodes=None, *args, **kw)
(Constructor)

source code 

Initialize a hitec.Protocol

INPUT: bus -- hitec.Bus -- Serial bus used to communicate with Hitec servos nodes -- list -- list of hitec ids

ATTRIBUTES: heartbeats -- dictionary -- nid : (timestamp, last message) pnas -- dictionary -- table of NodeID to ProtocolNodeAdaptor mappings

Overrides: object.__init__

hintNodes(self, nodes)

source code 

*PURE* use hint that specified nodes are available

Overrides: ckmodule.AbstractProtocol.hintNodes
(inherited documentation)

request(self, cmd, tx0, tx1, nid=None, **kw)

source code 

Write out a command and record incomplete reply

return promise

_completeResponses(self, now, timeout=0.05, retries=4)

source code 
(private)
Retries another request of incomplete message if timed out, and
completes any request for which a response arrived.

After several retries puts a ProtocolError in the result

INPUT:
  now -- current time
  timeout -- retry rate in seconds
  retries -- number of retries
OUTPUT:
  num_failed -- number of failed requests

update(self)

source code 

Complete any outstanding async requests and collect heartbeats

Overrides: ckmodule.AbstractProtocol.update

generatePNA(self, nid)

source code 

Generates a pololu.ProtocolNodeAdaptor, associating a pololu protocol with a specific node id and returns it

Overrides: ckmodule.AbstractProtocol.generatePNA