Docstoc

Lincoln Log House Builder

Document Sample
Lincoln Log House Builder Powered By Docstoc
					                Lincoln Log House Builder
                                       Final Project Report




Submitted by:   Jeri Caligiuri  SID# 16801582
                Matt Rosenbrock SID# 15927690


                 Professor Kraft
        University of California, Berkeley
                     ME 135
                   Spring 2005
                  May 12, 2005
                                                                   Caligiuri, Rosenbrock 2


Abstract

       The objective of this final project was to write and implement software that would use a

Scorbot-ER robot arm to build a Lincoln Log house of specified dimensions and characteristics.

The house was meant to be five logs in height, with a window, door, and roof. Our software

system contains tasks for the GUI (graphical user interface), control logic, motion profiler and

PID (proportional integral derivative) control, and PWM (pulse width modulation). There is also

a user class, which creates the main() and start() methods, as well as the individual tasks. Inside

these tasks are states, which provide the structure inside tasks. TranRunJ, which contains

functions to communicate between separate tasks, was used to implement this state transition

logic. Unfortunately, final performance did not meet specifications. Due to the nature of a

Lincoln Log set, the logs have to be placed in precise positions to build up the house, and small

errors in placement drastically affect the outcome. While the robot arm generally moved to the

approximately the correct positions, the profiling method, tolerances, and PID gains used did not

allow the logs to be placed precisely enough to result in the anticipated performance.
                                                       Caligiuri, Rosenbrock 3


Table of Contents

Abstract………………………………………………………………………..                                2
List of Figures…………………………………………………………………                             3
Introduction……………………………………………………………………                               4
Hardware Overview…………………………………………………………..                            5
Task and State Diagrams……………………………………………………..                        5
        Task Diagram…………………………………………………………..                         5
        Position Logic State Diagram………………………………………….                8
        Arm Joint, Rotation, and Wrist State Diagram…………………………       9
        Gripper State Diagram………………………………………………….                    9
        PWM State Diagram……………………………………………………                        10
        Trapezoidal Profiler State Diagram…………………………………….            10
Implementation Details………………………………………………………..                        11
        Position Logic…………………………………………………………..                       11
        Motor Control…………………………………………………………..                        11
        Gripper………………………………………………………………….                            12
        GUI……………………………………………………………………..                              12
Performance……………………………………………………………………                                12
Discussion……………………………………………………………………...                              14
Conclusion……………………………………………………………………..                               17



List of Figures

Figure 1. Lincoln Log house…………………………………………………..                    4
Figure 2. Scorbot-ER-4u robot arm…………………………………………...                5
Figure 3. Setup configuration………………………………………………….                   5
Figure 4. Task Diagram……………………………………………………….                        7
Figure 5. Position Logic State Diagram……………………………………….              8
Figure 6. Arm Joint, Rotation, and Wrist State Diagram……………………...   9
Figure 7. Gripper State Diagram………………………………………………                   9
Figure 8. PWM State Diagram………………………………………………...                    10
Figure 9. Trapezoidal Profiler State Diagram…………………………………           10
Figure 10. GUI                                                      12
Figure 11. Base configuration of robot arm…………………………………...          13
Figure 12. Small log placement……………………………………………….                   13
Figure 13. Robot arm obtains a medium log…………………………………..            13
Figure 14. Robot arm moving medium log……………………………………                13
Figure 15. Gripper and medium log…………………………………………...                14
Figure 16. Placement of medium-sized log…………………………………...            14
Figure 17. Shoulder positions vs. time………………………………………...            15
Figure 18. Elbow positions vs. time…………………………………………...              15
Figure 19. Rotation positions vs. time………………………………………...            16
Figure 20. Wrist positions vs. time……………………………………………                16
                                                                           Caligiuri, Rosenbrock 4


Introduction

        Lincoln Log houses, such as the one shown below in Figure 1, are made of wooden logs

of varying sizes. This project utilized short- and medium-sized logs, one window, one door, and

a roof. The intent was to use a robot arm to build a house of the small and medium-sized logs of

dimensions 1x1 medium log in the x and y directions and 5 logs in height. A GUI was created,

which has start, stop, continue, and gain adjustment capabilities.

                                                        TranRunJ, a Java software base, was used to

                                                implement the task and state diagram logic of our

                                                control system. In creating the structure necessary to

                                                use TranRunJ, the first step is constructing a task

                                                diagram, which shows the hierarchy and

                                                communication paths of the system. Tasks are
Figure 1. This was the intended
configuration of the Lincoln Log                functional, cooperating subunits that operate in
House for this project.
parallel.

        From these task diagrams, state diagrams are then created to provide the structure

contained inside the tasks. These decompose difficult problems into smaller, simpler problems

and provide a structure that allows one to move easily from the diagrams to coding. Only one

state is active at a time, compared to the parallel operation of tasks. Each state may have an

Entry, Action, and one or more Transition functions. In TranRunJ, it is very convenient to pass

information between different tasks: one simply communicates with messages (sent from and to

mailboxes) to send data1.


1
 Auslander, Dave and Kraft, Steve. "Introduction to State Diagrams" lecture notes of March 8, 2005. UC Berkeley
Dept. of Mechanical Engineering. Spring 2005. <http://me.berkeley.edu/ME135_S05/notes/statediagram.ppt>
Further note: some of this TranRunJ discussion was used in our ME135 Lab 7 report. Spring 2005.
                                                                     Caligiuri, Rosenbrock 5


Hardware Overview

       A Scorbot-ER-4u robot arm, provided in the ME135 laboratory was used (see Figure 2).

This robot arm contains six motors: base (rotation), shoulder, elbow, wrist 1, wrist 2, and a

gripper.




       Figure 2. This is the Scorbot robot arm      Figure 3. This is the set-up: the logs, windows,
       used in our project.                         and roof are placed in precise locations.


       The Lincoln logs were set up in the configuration shown above in Figure 3. The logs

were placed in stacks according to their length, and held up with nails. The roof, door and

window were placed next to these, in specified positions. The base configuration, consisting of

four logs, is in the center. It should be noted that the robot’s range had to be taken into

consideration for these placements.



Task and State Diagrams

Task Diagram

       Figure 4 shows the task diagram for our approach to this project. Note that our software

also contains a user class, which creates the other individual tasks. Five basic tasks were created:

a GUI with start, stop, and continue capabilities as well as capacity for setting the gains of each

individual motor; a position logic task, which stores the desired positions as well as sending
                                                                         Caligiuri, Rosenbrock 6


messages to make the appropriate motors move; a Gripper class, which simply sends a duty cycle

of 1 or –1 (for a specified time) to the PWM; an Arm Joint task which both the shoulder and

elbow utilize and which contains a velocity profiler, PID control and rollover correction; a Wrist

Rotation task, which each of the two wrist motors utilize; and, a Rotation task, which controls

the rotation of the base (each of these tasks also contain a velocity profiler, PID control, and

rollover correction). Note that the motor angle class, which is not really a task, simply converts

the desired X, Y, and Z position into corresponding angles for each of the six motors. This class

was obtained from the software of Fall 2004 ME230 students Hwan Hur and Jongho Lee.2




2
    “ME 230 Project Team Sites.” <http://www.me.berkeley.edu/ME230_F04/html/student.html>
                                                                            Caligiuri, Rosenbrock 7




                                                       GUI
                                                         “start”, “continue”
                               X,Y, Z
        Motor Angle                            Position Logic
        (used for              angle                                               send(θ,channel)
        shoulder &
        elbow only)




                Shoulder:               Elbow:               Wrist1:             Rotation:       Wrist2:
Gripper:
                Arm Joint:              Arm Joint:           Wrist Rot.:         Velocity        Wrist Rot.:
Sends duty
                V. profiler,            V. profiler,         V. profiler,        profiler,       V. profiler,
cycle of 1
                Rollover,               Rollover,            Rollover,           rollover,       Rollover,
or -1
                PID                     PID                  PID                 PID             PID




  PWM                 PWM                  PWM                                      PWM              PWM
                                                                  PWM
                                                                                                     software
                                                                                                     hardware


                                Encoder                  Amp
                                                                               Each of the 6
                                                                               motors has this
                                                                               setup
                                              Motor


Figure 4. This is the task diagram for the Lincoln log house builder. Note that five of the
motors require a profiler and PID control. The gripper, which simply has to open and close, does
not require motion profiling or control.
                                                                              Caligiuri, Rosenbrock 8


State Diagrams

Position Logic

       The position logic task is the most complex of the tasks shown in the preceding figure.

As shown below in Figure 5, it contains six states. Note that all states point back to idle state

when Stop Button == true, and that all arrows pointing from Continue also require that Continue

Button == true. These are not on the diagram so as to maintain clarity.



    Idle State                StartButton == true       Actuate Base
    Entry: stop all                                     Entry: get X and Y from positions
    motors.                                             array. Calculate base & wrist angles,
                                                        send to appropriate class.

                                                               State =
                                                               actuate Base               Wrist 1, Wrist 2
                                                                                          & Rotation are
                                                                                          done, sends
                                               Shoulder & Elbow are                       State = Reset
  Reset Arm                                                                               Arm
                                               done, sends either State =
  Entry: gets appropriate angles to
                                               Actuate Base or Arm
  move arm 15cm above table height
  using X & Y from pre-transition state.                            Continue
  Action: Sends setpoint angles to the            State =
  shoulder and elbow after angle                 Reset Arm
  calculation is done.

         Gripper is done, positions                                                     Shoulder & Elbow
         array incremented by 1,                                 State =                are done, sends State
         State = resetArm                                        Actuate Arm            = Actuate Gripper
                                      State = actuate
                                      Gripper            Actuate Arm
      Actuate Gripper                                    Entry: calculates appropriate Z position,
      Entry: send message to                             which depends on the current position,
      gripper class of whether it                        increments # of short/medium logs left.
      needs to open or close.                            Gets angles for (X,Y,Z).
                                                         Action: sends position setpoints to
                                                         shoulder and elbow after angle calculation
                                                         is done.



Figure 5. This is the state diagram for the position logic task.
                                                                            Caligiuri, Rosenbrock 9


Arm Joint, Rotation, and Wrist Rotation

        These tasks, all similar, have two states: Idle and Go, and are utilized by the shoulder,

elbow, base, and wrist motors. The Go state, as shown in Figure 6, contains the motion control.

Note that pressing the stop button will return this motion control task to its idle state. Note that

in the Rotation classes for the base and the wrist, the angles are calculated directly, whereas for

the arm joints, the angles are the result of the Motor Angle class.

                                    Receives
      IdleState                     desired position     GO
      Entry: turn off motor                              Action: Rollover correction. Position
                                                         setpoint for motion profiling calculated.
                                  Position == desPos     PID control.
                                             +/- 15

Figure 6. This is the state diagram for the motor control classes.


Gripper

        This task (see Figure 7) has three states: idle, open, and close. It simply sends a positive

or negative duty cycle to the PWM class for a certain length of time (1 second) depending on

whether Position Logic wants the gripper to be open or closed. Note that pressing the stop

button will return the gripper task to its idle state.

                                      Receives message:
          IdleState                   GripperMsg == 1        Open
          Entry: turn off motor                              Action: sends Duty = 1 to PWM.

                                      Time Elapsed > 1
                                      second
     Receives
     GripperMsg
                              Time Elapsed > 1
     == 0
                              second

        Close
        Action: sends Duty = -1 to PWM.


Figure 7. This is the state diagram for the gripper.
                                                                          Caligiuri, Rosenbrock 10


PWM

          This task (Figure 8), used for turning motors on and off, contains just two states: On and

Off.


                                          ElapsedTime >
                                          dutyCycle*period       Off
             On
                                                                 Entry: turn off motor,
             Entry: turn on motor,
                                                                 ElapsedTime = 0;
             ElapsedTime = 0;
                                          ElapsedTime >
                                          (1-dutyCycle)*period


Figure 8. This is the state diagram for the PWM task.


Trapezoidal Profiler

          This class (see Figure 9) contains four states: idle, accelerate, decelerate, and hold. Note

that constant velocity is accounted for in the accelerate state. We did not actually use this

profiler in our TranRunJ implementation. Note that if a “Stop Motor” command is received in

any state, the message is sent to motor control, and the profiler returns to idle state.



        Idle                   receives desAngle
                               message
                                                   Accelerate
        Entry: stop motor                          Action: calculate velocity. If
                                                   V > Vcruise, V = Vcruise.
                                                   Calculate setpoint position.
                                                   Send position to motor control.


                            TaskMessage                                       XStop >=
                            == desAngle                                       desPos



                                                   Decelerate
       Hold                          Pos >=        Action: calculates stop
       Entry: sends the position     desPos        velocity. Calculates setpoint
       setpoint to motor control.                  position. Sends position to
                                                   motor control.


Figure 9. This is the state diagram for the trapezoidal profiler.
                                                                   Caligiuri, Rosenbrock 11


TranRunJ Implementation Details

Position Logic

       The Position Logic class contains all of the positions that the robot arm must step

through. Each position is defined by its x and y coordinates and its orientation. The sequence of

positions in this state is given by a positions array. Then, depending on which move needs to be

made, the program either steps into the Actuate Base state, Reset Arm state, Actuate Arm state,

or the Actuate Gripper state. It sends the appropriate angles, based on the necessary X, Y, and Z

position, to the motor control tasks. For the shoulder and the elbow, it gets these angles from the

Motor Angle class, as discussed in the Task Diagram section. Note that for the wrist and base

rotation, the angles are calculated directly in position logic rather than in the Motor Angle class.

These angles are then sent to the motor control classes, which move the motors to the desired

positions. The Z positions are incremented throughout this process, so Position Logic always

knows how to vertically position the robot to pick up a log from a stack or place down a log on

the house structure. Also note that the Reset Arm state involves moving the robot arm 15cm

above the table, so it does not displace logs, the window, etc. before moving to its next position.


Arm Joint, Rotation, and Wrist Rotation

       Although the motion control is done in separate Java classes, they perform the same

functions (at different speeds). Each class checks for a message from the Position Logic class

telling it which angle to move the motor to. It then goes through rollover correction, PID

control, and velocity profiling. This profiling is done by calculating a position set point, which is

equal to velocity * (currentTime-transitionTime) + transitionPosition, where transitionTime and

transitionPosition are the time the task message is received and the desired position read in from

Position Logic, respectively.
                                                                  Caligiuri, Rosenbrock 12


Gripper

       This class sends a duty cycle of +1 or – 1, depending on whether it needs to open or

close, to the PWM class for one second. This process could be further refined, as the gripper

currently hits the stops when it opens. However, since we could not build up the logs to a height

where this would be an issue, we left it as-is, rather than having it move between certain

positions.


GUI

       The GUI (Figure 10) contains

buttons for stop, continue, and start. It

further allows the user to reset gains for

any of the six motors. It displays a choice

to the user for the placement of the door

and the window as to which of the four

sides of the house they should be

positioned. This placement choice was
                                               Figure 10. This is the GUI used for this project.
not implemented.




Performance

       The robot arm was set up in the base configuration shown in Figure 11. It was able to

move itself through the appropriate states, picking up a small log and placing it on the base log

setup. However, it was slightly off in position, and the grooves in the logs were not forgiving

enough to accommodate this (see Figure 12). The robot arm then continues, resetting itself and
                                                                   Caligiuri, Rosenbrock 13




Figure 11. This is the base configuration     Figure 12. This shows the small log after being
(the start button is pressed after it is in   placed into position. As the precision was not
this placement).                              enough to place it squarely within the groove, it fell
                                              slightly sideways.


moving to pick up a medium log (Figure 13). Following the process, the arm carries the log over

to the base configuration (Figure 14), sets it down (Figure 15), and releases it (Figure 16).

Again, the slight error in position has disastrous consequences. Generally, after placing a few

logs, the robot stops working. However, sometimes this occurs after two logs, and sometimes

after six or more. Things that seemed to affect this were having anything else running in the

background and printing things out to the screen or to a file. The motor performance was smooth

until it came time to either stop or start the motor: then, performance was a bit rough, and the

robot arm seemed to jump slightly.




     Figure 13. Here, the gripper closes to         Figure 14. The robot arm carries the
     pick up a medium-sized log.                    medium log to the base configuration.
                                                                    Caligiuri, Rosenbrock 14




Figure 15. The gripper is waiting for the      Figure 16. This shows the placement of the
continue button to be pressed, after which     log after the gripper released it. It does not sit
it will release the log.                       in the groove as it is supposed to.



Discussion

       The main problem in our project was that the robot arm was unable to place the Lincoln

Logs precisely enough. This is due in part to the fact that we used a velocity rather than

trapezoidal profiler. Note that the original intent was to use a trapezoidal profiler (as shown in

the state diagram section and the source code), but debugging issues caused us to substitute a

simpler velocity profile. The following four figures show how the desired angle, actual angle,

and profiler setpoint angle differ versus time. It can be seen from Figure 17 that the shoulder

managed to follow the setpoint position fairly well, but this did not necessarily correspond to the

desired position. Again, a trapezoidal profiler would have been able to set more accurate

setpoint positions. From Figure 18, it can be seen that the elbow had a bit more trouble

following the setpoint position. The base (Figure 19) had trouble following setpoint position

when the angle was decreasing, but otherwise stayed fairly close to the setpoint. Again, like the

shoulder, setpoint deviates from actual position too much for this project's purposes, something

that a trapezoidal profiler would have helped negate.
                                                                                                           Caligiuri, Rosenbrock 15


                                                           Shoulder: Desired, Actual, & Setpoint Positions vs. Time

                                    120

                                    100
          Angle (degrees)



                                              80
                                                                                                                       Desired Position
                                              60                                                                       Actual Position
                                                                                                                       Setpoint Position
                                              40

                                              20

                                              0
                                                   0       10     20    30     40     50        60   70        80
                                                                         Time (seconds)

Figure 17. This shows the desired, actual, and setpoint angle of the shoulder vs. time.




                                                           Elbow: Desired, Actual, & Setpoint Positions vs. Time

                                               50

                                               40
                            Angle (degrees)




                                               30                                                                   Desired Position
                                                                                                                    Actual Position
                                               20                                                                   Setpoint Position
                                               10

                                                   0
                                                       0          20          40           60             80
                                                                       Time (seconds)

Figure 18. This shows the desired, actual, and setpoint angle of the elbow vs. time.
                                                                                                Caligiuri, Rosenbrock 16


                                        Rotation: Desired, Actual, and Setpoint Positions vs. Time

                               50

                               40
              Angle(degrees)

                               30                                                                      Desired Position
                                                                                                       Actual Position
                               20                                                                      Setpoint Position

                               10

                                0
                                    0      10        20      30    40      50        60     70
                                                          Time (seconds)

Figure 19. This shows the desired, actual, and setpoint angle of the base rotation vs. time.


       The wrist (Figure 20) also had a bit of trouble following the setpoint. Again, the setpoint

was off from the desired position, compounding the error. Possible solutions to these problems

would be implementation of a trapezoidal profiler and further adjustment of the gains.

Additionally, we could have modified the logs so that the grooves would be more forgiving or

even made our own Lincoln logs.


                                        Wrist: Desired, Actual, & Setpoint Positions vs. Time

                               150
                               120
           Angle (degrees)




                                90
                                                                                                       Desired Position
                                60
                                                                                                       Actual Position
                                30
                                                                                                       Setpoint Position
                                 0
                               -30 0            20          40     60           80        100

                               -60
                                                          Time (seconds)

Figure 20. This shows the desired, actual, and setpoint angle of the wrist vs. time.
                                                                   Caligiuri, Rosenbrock 17


       Other problems that arose were the sensitivity of the performance to things like other

programs running in the background, and printing arrays to files or out to the screen. For

example, running LabView in the background so we could watch the encoder counts of each

motor turned out to adversely affect motor performance. Additionally, trying to print arrays to

files or display information on the screen sometimes resulted in lesser performance and affected

how far the robot arm would get through its sequence of positions. Determining good gains was

also an issue. The code from Lab 7 was used in this process, controlling one motor at a time, to

determine appropriate gains for each of the six motors. These in general resulted in smooth

performance, although motion was somewhat jumpy at times, especially right after the motors

were started and right before they were stopped.


Conclusion

       In conclusion, we could not get the precision in movement that was necessary to place the

Lincoln logs. Our design strategy appeared to be successful in that the motors could follow the

positions array stepped through in the Position Logic task and that we initially realized that a

trapezoidal profiler would be beneficial. However, due to problems debugging, the profiler was

removed and time did not allow for it to be reintegrated into the system. Again, possible

solutions to this problem of precision would be to use the trapezoidal profiler, continue

optimizing gains, and make the grooves of the Lincoln logs wider.

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:46
posted:2/13/2010
language:English
pages:17