24
Robot Vision – 2 exercise

SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision – 2 exercise

Page 2: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide2

Exercise profiles

• Start profile: RobotVision_2_Start

• Final profile: RobotVision_2_Final

Page 3: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • 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

Page 4: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 5: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide5

Logical states

• Object present

• No Object

• Undefined Object

Page 6: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 7: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide7

Identify Object Presentations

• Use Blob2 to identify the 3 different presentations

• Name them:– FindPresentation1– FindPresentation2– FindPresentation3

Page 8: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 9: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 10: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 11: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 12: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 13: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide13

Error reporting in Python

Page 14: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 15: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide15

Console Window result

• The parameter will be printed in the console window after every inspection

Page 16: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 17: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 18: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide18

Using If statements to select

Page 19: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 20: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 21: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 22: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

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

Page 23: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide23

Configure the Result Panel

• Display both the result from the tool PickingDescription and PickingAngle

Page 24: SL-2003-46-b Robot Vision 2scorpion.tordivel.no/files/Info/SL-2003-46-b Robot Vision 2.pdf · Robot Vision 2 slide2 Exercise profiles • Start profile: RobotVision_2_Start • Final

Robot Vision 2 slide24

The final result