Lab 9:
Pick and Place Robot Control
Purpose: The purpose of this laboratory exercise is to control a pick-and-place robot by reading the states of position sensors (proximity switches) located on the robot, and writing outputs to control solenoids to drive the axes of the robot. The robot should pick-and-place parts until the stop button (switch) on the front panel is activated.
Objectives: After completing this laboratory exercise you should be able to do the following:
1. Create a task for reading digital inputs
2. Create a task for writing digital outputs
3. Write a Mathscript function to compare inputs and control output states
4. Develop a variable speed control for determining the speed of the robot
5. Monitor the states of inputs and outputs
6. Interface to the Menziken robot and demonstrate “live execution” of your program.
Keywords and
Functions
Mathscript
I/O Task: Read Digital
Inputs
Multi-channel configuration
I/O
Task: Write to Digital Outputs
Array to Sub-Array
Boolean to Number conversion
Number to Boolean conversion
Procedure: The following activities should be completed in order to complete this laboratory exercise:
1. Study the diagram below and determine the logical steps for the pick and place action
1 Home
10 3 2 6 9 8 7 5 4
`
The following addresses are used to monitor and control the Menziken Robot
INPUTS
OUTPUTS
P0.0 Horizontal RETRACT proximity switch P0.4 Horizontal Extend Actuator
P0.1 Horizontal EXTEND proximity switch P0.5 Vertical Extend Actuator
P0.2 Vertical RETRACT proximity switch P0.6 Gripper Actuator (1 is open0
P0.3 Vertical EXTEND proximity switch P0.7 Strobe (if used)
2. Write a control sequence in binary form to define the states of inputs and
constraints that govern the sequence of outputs similar to the table shown
below.
3. Create a LabView program that can be used to simulate the actual robot
control program as shown in the following illustrations
FRONT PANEL
Mathscript
BLOCK DIAGRAM
4. Note you will need to place a Mathscript Node within the while loop as shown in the previous diagram. The Mathscript NODE can be found by right clicking on the block diagram and selecting structures, then Mathscript as shown below:
An example Mathscript code is show below. Note that && syntax in Mathscript represents a logical AND Boolean function.
if (x== 5) && (X2==0)
y=4
elseif(x== 5) && (X2==4)
y=6
elseif(x== 9) && (X2==6)
y=2
elseif(x== 9) && (X2==2)
y=0
elseif(x== 5) && (X2==0)
y= 1
elseif(x==6) && (X2==1)
y=3
elseif(x==10) && (X2==3)
y=7
elseif(x==10) && (X2==7)
y=5
elseif(x==10) && (X2==5)
y=0
else
end
5. Enter the Mathscript code by selecting the test icon from the tools pallet and then clicking inside the Mathscript node
6. Notice that the output to solenoids portion of the block diagram contains an array and sub-array as shown below within the red box. Since the OUTPUTS TO SOLENOIDS is and I8 (Integer 8 bit) function and the physical outputs for the solenoids task is only 4 bits (channels), a sub-array must be created as shown. This assures that the number of bits matches the number of channels for writing OUTPUTS to the solenoids.
BLOCK DIAGRAM
7. Complete the block diagram and verify the program before physically running your LabView VI. You will have to create some “virtual” inputs and outputs.
8. Save your simulated program (VI) and load on the computer connected to the Menziken Robot.
9. Create at task for writing data to the solenoids (DIGITAL OUTPUTS) as
shown below: Open Measurement and Automation and create the following
tasks:
Task 1: Read Proximity Switches (DIGITAL INPUTS)
Note: This task should be configured for Digital Inputs
on Port 0 and should include Ports 0.0 through 0.3 as shown
below:
10. Create at task for writing data to the solenoids (DIGITAL OUTPUTS) as
shown below:
11. Execute your program and have your lab instructor verify the operation.
12. Write a formal lab report following the usually required format.