Package joy :: Module plans :: Class GaitCyclePlan
[hide private]
[frames] | no frames]

Class GaitCyclePlan

source code


GaitCyclePlan-s combine the benefits of a SheetPlan with those of a CyclePlan. They represent "cyclical spreadsheets" consisting of settings that should be applied via the Plan bindings at various phases in the cycle.

GaitCyclePlan usage example: >>> gcp = GaitCyclePlan( app, ... sheet = [['t','x'],[0,1],[0.25,0],[0.5,-1],[0.75,0]], ... x = '>pos' ) >>> gcp.start()

would make a 4-step triangle wave be emitted to Scratch variable 'pos'

Instance Methods [hide private]
 
__init__(self, app, sheet, maxFreq=10.0, *arg, **binding)
Initialize a GaitCyclePlan instance
source code
 
_action(self, arg) source code

Inherited from CyclePlan: behavior, getFrequency, getPeriod, moveToPhase, onCycles, resetPhase, setFrequency, setPeriod

Inherited from CyclePlan (private): _doActions

Inherited from SheetPlan: getRate, setRate, update

Inherited from SheetPlan (private): _autoBinding, _doRowSets, _parseSheet

Inherited from Plan: forDuration, isRunning, onEvent, onStart, onStop, push, start, step, stop, untilTime

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

Static Methods [hide private]

Inherited from CyclePlan: bsearch

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, app, sheet, maxFreq=10.0, *arg, **binding)
(Constructor)

source code 

Initialize a GaitCyclePlan instance

INPUTS:
  app -- JoyApp -- application containing this Plan
  sheet -- list of lists -- gait table (see SheetPlan for details)
  maxFreq -- float -- maximal gait frequency; default is 10 Hz
  
  Additional keyword arguments provide output bindings for the
  gait table columns. sheet[0] is a list of column headings, with
  sheet[0][0]=='t' the time (phase). Unlike other SheetPlans, the
  time column in a GaitCyclePlan MUST range 0.0 to 1.0

  If no column bindings are provided, column headings are assumed 
  to be module names of servo modules and each of these is bound to
  <<module>>/@set_pos of the corresponding module. For example, the sheet:
  >>> sheet = [ 
  ...   ["t",   "Nx15"],
  ...   [0,     1000],
  ...   [0.5,  -1000] ]
  will generate a +/- 10 degree square wave into the position of node 0x15 

Overrides: object.__init__