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

Module hitec

source code


The CKBot.hitec python module provides classes used to communicate with CKBot robot modules connected the hitec HMI serial bus (rather than CAN) using a protocol similar to the Robotics Bus Protocol. These classes are primarily used to interface with the CKBot.logical python module found in the Modlab CKBot repository. For more information on
the low-level interface, please refer to the Hitec HMI Manual found at #J TODO.


Main uses of this module:
(*) control CKBot robot modules (specifically the servos) connected to a the hitec HMI serial bus
(*) mimics the behaviour of the CAN Bus, except using the hitec hitec HMI serial bus  as a communications channel

Example 1 - hitec robot module only: 
  #>>> import logical
  #>>> nodes = [0x01, 0x06]
  #>>> p = hitec.Protocol(nodes = nodes)
  #>>> p.send_cmd([0x02,7,0])

Example 2 - Integrate with CKBot.logical python module:
  >>> import logical
  >>> nodes = [0x01, 0x06, 0x03]
  >>> p = hitec.Protocol(nodes = nodes)
  >>> c = logical.Cluster(p)
  >>> c.populate(3,{0x01:'head', 0x06:'mid', 0x03:'tail'})
  >>> c.at.head.set_pos(1000)

Both examples sets the position of the 0xD1 robot module, to 1000 (10 degrees from the  neutral position)

Classes [hide private]
  HiTec
Namespace containing useful constants and functions
  BusError
  ProtocolError
  Bus
Concrete class that provides the functionality needed to send messages to a Hitec servos over their serial connection.
  EEPROM
Concrete class representing the EEPROM in a servo
  IncompleteMessage
internal concrete class representing incomplete messages
  Protocol
TBD
  ProtocolNodeAdaptor
Utilizes the protocol along with nid to create an interface for a specific module
  HitecModule
  ServoModule
TBD
  MotorModule
TBD
Functions [hide private]
 
crop(val, lower, upper) source code