Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
Robot Vision – 2 exercise
Robot Vision 2 slide2
Exercise profiles
• Start profile: RobotVision_2_Start
• Final profile: RobotVision_2_Final
Robot Vision 2 slide3
The task
• To separate the 3 different object presentations
• To find the Robot picking point and angle of the object
Robot Vision 2 slide4
Vision Strategy
• Use a blob to identify object present and set up a ObjectPresent logical state
• Use Blob2 to set up constrains based on results from the Blob tool
• Use Python to set up the business logic
Robot Vision 2 slide5
Logical states
• Object present
• No Object
• Undefined Object
Robot Vision 2 slide6
Locate object
• Use a blob to locate the object• Use the blob area as condition in a logic
tool to define ObjectPresent state
Robot Vision 2 slide7
Identify Object Presentations
• Use Blob2 to identify the 3 different presentations
• Name them:– FindPresentation1– FindPresentation2– FindPresentation3
Robot Vision 2 slide8
Using results from Blob2
• In the results tab you will find a large number of results that can be used to separate presentations
• In the exercise we will use Circularity and Axis Ratio
Robot Vision 2 slide9
Setting Constrains
• By studying the variation of circularity and axis ratio for the three presentations, you can set minimum and maximum levels
Robot Vision 2 slide10
Undefined object
• Use a Logic Tool and check the tool status to set up the Undefined Object state– Status = 1 is OK– Status = 3 is error
• Name the tool:DefinedObject
Robot Vision 2 slide11
Selecting presentation
• We will use a Python Tool to select the correct presentation based on the results of the 3 blob tools
• The first step is to import the different values using the GetValue statement– The Round function is used to get only one
decimal after comma– The Int function returns only the integer
Robot Vision 2 slide12
Importing data to Pythonx1 = round (GetValue ('FindPresentation1.Center of gravity[0].x'), 1)y1 = round (GetValue ('FindPresentation1.Center of gravity[0].y'), 1)x2 = round (GetValue ('FindPresentation2.Center of gravity[0].x'), 1)y2 = round (GetValue ('FindPresentation2.Center of gravity[0].y'), 1)x3 = round (GetValue ('FindPresentation3.Center of gravity[0].x'), 1)y3 = round (GetValue ('FindPresentation3.Center of gravity[0].y'), 1)
print x1 , y1 , x2 , y2 , x3 , y3
angle1 = int (GetValue ('FindPresentation1.Angle[0]'))angle2 = int (GetValue ('FindPresentation2.Angle[0]'))angle3 = int (GetValue ('FindPresentation3.Angle[0]'))
print angle1, angle2, angle3
status1 = int (GetValue ('FindPresentation1.Status'))status2 = int (GetValue ('FindPresentation2.Status'))status3 = int (GetValue ('FindPresentation3.Status'))
print status1,status2,status3
Robot Vision 2 slide13
Error reporting in Python
Robot Vision 2 slide14
Using Console window
• The print command in Python will print the data in the Console Window
• Activate the console window in Advanced
Robot Vision 2 slide15
Console Window result
• The parameter will be printed in the console window after every inspection
Robot Vision 2 slide16
Object Presentation number
• The 3 different presentations of the object must be communicated to the Robot and the user after each inspection
• We will generate the number (1 – 3) in the Python script and put the result in a External Scalar Tool named ObjectPresentation
• From that tool we can send the data to the Robot using RS232 and also display the result in the result panel
Robot Vision 2 slide17
Generating Presentation number
• First add the External Scalar Tool and name it ObjectPresentation
• To set a value in another tool we use the command: SetValue
• On next page you will find the Python script including SetValue command and the if statements controlling the business logic
Robot Vision 2 slide18
Using If statements to select
Robot Vision 2 slide19
Picking Point and Angle
• The final picking point will be available for an external PLC using the tool ExternalPoint
• The angle will be available using the tool ExternalScalar
• Create the tools name them PickingPoint and PickingAngle
Robot Vision 2 slide20
Setting the picking point and angle
• The next section in the Python script select the status that =1 and set the x and y value in the ExternalPoint tool named PickingPoint and the angle to ExternalScalar tool PickingPoint
• The SetValue command is used to set parameters in other tools
Robot Vision 2 slide21
Combining results for presentation in the result panel
• Results can be combined for better presentation in the Result window
• First create a ExternalText tool named “PointDescription”
• The indicated script will set the result in the PointDescription tool using the SetValuecommand
Robot Vision 2 slide22
OK, No and Undefined Object States
• Define the logical states in the settings tab using the logical tools ObjectPresent and DefinedObject
Robot Vision 2 slide23
Configure the Result Panel
• Display both the result from the tool PickingDescription and PickingAngle
Robot Vision 2 slide24
The final result