virtualmachine6
index
/home/sl/Desktop/virtualmachine6.py

# Virtual Machine
# Rapid Prototyping of Rapid Prototyping Machines
#
# Ilan E. Moyer
# for the MIT Center for Bits and Atoms
#
# 5/9/08
#
# Usage:
#   python virtualmachine.py <RML file>
#
# This script creates a "computerobject, "controllerobject and
# "machineobject. It runs the "loadrml" and "parserml" methods of
# the computer object, in order to read the RML file specified on the
# command line and store its data in member variables of the
# "computerobject. This populates the "movetable" and
# "feedmodetable" variables.
#
# The "movetable" and "feedmodetable" member variables of the
# "computerobject contain a list of instructions. These are operated
# on one at a time by the movegen and stepgen methods of the
# "controllerobject, which produces location deltas for the virtual
machine. The "machineobject's position is then updated by the
# resulting delta amount at each step.
#

 
Modules
       
commands
csv
math
numpy
serial
sys
time

 
Classes
       
__builtin__.object
computer
controller
guide
machine
motor
motorcontroller
transmission

 
class computer(__builtin__.object)
    computer object has the logic for reading an RML file and storing the list of instructions.
 
  Methods defined here:
loadrml(self)
Loads the RML file specified on the command line in sys.argv[1].
parserml(self)
Populates the movetable and feedmodetable member variables by parsing the RML instructions.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
feedmodetable = 0
movetable = 0
rml = 0
tableindex = 0
zup = 0

 
class controller(__builtin__.object)
    Controller class.
 
  Methods defined here:
movegen(self, moveto)
simmove(self, outgoing)
stepgen(self, traverse, rate)
Note: rate in in/min
 
IMPORTANT... THIS VERSION OF STEPGEN ONLY WORKS PROPERLY WITH
1 AND 2 AXIS SUMULTANEOUS MOVEMENT
 
THIS IMPLIES THAT ERROR MAPPING WON'T WORK YET
xmit(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
movtol = 0.0001

 
class guide(__builtin__.object)
    Provides "move" method. Temporary storage for direction vector.
 
  Methods defined here:
move(self, s)
Multiplies stepsize "s" by direction vector.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
vector = [0, 0, 0]

 
class machine(__builtin__.object)
    Virtual machine class.
 
  Methods defined here:
move(self, commandmove)
This function defines how the virtual machine moves based on
its configuration and perhaps additional sensor inputs.
The goal is to create a model of the the machine which can be
used in a virtual feedback loop by the controller.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
dynamicrangeresolution = 6000
guides = [<virtualmachine6.guide object at 0x83bcb4c>, <virtualmachine6.guide object at 0x83c7c4c>, <virtualmachine6.guide object at 0x83c764c>]
i = 2
maxcountersize = 36000000
motorcontrollers = [<virtualmachine6.motorcontroller object at 0x83c72cc>, <virtualmachine6.motorcontroller object at 0x83c74cc>, <virtualmachine6.motorcontroller object at 0x83c76ec>]
numberofaxes = 3
position = array([ 0., 0., 0.])
softwarecounternumber = 4.0

 
class motor(__builtin__.object)
    motor
 
  Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
ratio = 0

 
class motorcontroller(__builtin__.object)
    Used as a structure for storing motorcontroller data. No methods.
 
  Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
clockspeed = 0
counterrate = 0
direction = 0
duration = 0
hardwarecounter = 0
hardwarecountersize = 0
prescalar = 0
rate = 0
softwarecounter = 0
softwarecountersize = 0
stepsize = 0

 
class transmission(__builtin__.object)
    transmission
 
  Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
ratio = 0