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

Module pololu

source code

The CKBot.pololu python module provides classes used to communicate with CKBot robot modules connected to a Pololu Maestro Device (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 Pololu Maestro Device User Manual found at http://www.pololu.com/docs/0J40/all

NOTE: Our implementation assumes the Pololu Maestro Device is set receive commands in Pololu Mode.

Main uses of this module: (*) control CKBot robot modules (specifically the servos) connected to a Pololu Maestro device (*) mimics the behaviour of the CAN Bus, except using the Pololu Maestro Device as a communications channel, can currently only send position and go_slack commands

Example 1 - Pololu robot module only: nodes = {0:0x23, 5:0x65} bus = pololu.Bus() p = pololu.Protocol(bus = bus, nodes = nodes) p.send_cmd(0x23,4,1000)

Example 2 - Integrate with CKBot.logical python module: import logical nodes = {0xD1:0, 0xA7:1, 0xDA:2} bus = pololu.Bus() #J on mac for now do .Bus("/dev/tty.usbserial-A70041hF") p = pololu.Protocol(bus = bus, nodes = nodes) c = logical.Cluster(p) c.populate(3,{0xD1:'head', 0xA7:'mid', 0xDA:'tail'}) c.at.head.set_pos(1000)

Both examples sets the position of the 0x23 robot module, connected to Pololu Maestro channel 0, to 1000 (10 degrees from the neutral position)

Classes [hide private]
  Bus
Concrete class that provides the functionality needed to send messages to a pololu controller over a serial connection.
  Protocol
This is a concrete class that provides all the functionality needed to send messages to a pololu controller over a "pololu bus".
  Msg
A concrete class representing a FAKE completed response to a Robotics Bus Dictionary Object request.
  ProtocolNodeAdaptor
Utilizes the protocol along with nid to create an interface for a specific module
  ServoModule
ServoModule Class has the basic functionality of ServoModules, with some exceptions listed below:
Variables [hide private]
  DEBUG = []