HtMA/palash

"close enough"

 

Week 13: Machine Building

We built a laser graffiti machine based on James and Nadya's SCIENCE machine construction kit.

Alexis's vine just about describes it:

My role was project coordination and writing the code that took the output of path planning and drove the motor and laser. I setup gestalt and modified the xy_plotter example code that came with it.

This code snippet conveys the gist of the laser_writer program:

def run(stages, laser, moves, conf):
        dry_run = conf.dry_run
        for move in moves:
                laser_val = move[-1]
                xy_move = scale_xy_move(move[:2])

                set_laser(laser, laser_val, dry_run)
                move_motors(stages, xy_move, dry_run) # blocking

def set_laser(laser, laser_val, dry_run):
        if laser_val > 0.5:
                if dry_run:
                        print 'turning on laser'
                else:
                        laser.turn_on()
        else:
                if dry_run:
                        print 'turning off laser'
                else:
                        laser.turn_off()

def move_motors(stages, xy_move, dry_run):
        if dry_run:
                print 'moving to ', xy_move
                time.sleep(1)
                return # remove this when using the real deal

        stages.move(xy_move, 0)
        status = stages.xAxisNode.spinStatusRequest()
        # This checks to see if the move is done.
        while status['stepsRemaining'] > 0:
                time.sleep(0.001)
                status = stages.xAxisNode.spinStatusRequest()