Tech Note: Robot Communications - ABB

lynxherringΤεχνίτη Νοημοσύνη και Ρομποτική

18 Οκτ 2013 (πριν από 4 χρόνια και 26 μέρες)

259 εμφανίσεις







Tech Note:
Robot Communications
-

ABB










Page
1

of
13



Version 1.0 8/16/06



OVERVIEW

................................
................................
................................
..........

2

1.1

Scope

................................
................................
................................
.....

2

1.2

Needed Hardware

................................
................................
..................

2

1.3

Needed Software

................................
................................
....................

2

2

SERIAL COMMUNICATION
S

................................
................................
.......

2

2.1

In
-
Sight Setup

................................
................................
.........................

2

2.2

Robot Controller RAPID code

................................
................................
.

2

2.3

In
-
Sight Serial Port Setup

................................
................................
.......

4

2.3.1

Input Settings

................................
................................
..................

4

2.3.2

Serial Settings

................................
................................
.................

4

2.4

In
-
Sight Job Setup

................................
................................
..................

5

3

ETHERNET COMMUNICATI
ONS

................................
................................
.

6

3.1

In
-
Sight Setup

................................
................................
.........................

6

3.2

Robot Controller Setup

................................
................................
...........

6

3.3

Robot Controller RAPID code

................................
................................
.

6

3.4

Job Setup

................................
................................
...............................

8

4

TROUBLE SHOOTING

................................
................................
.................

8

4.1

Serial with Hyper
Terminal

................................
................................
.......

8

4.1.1

In
-
Sight Serial Port Setup

................................
................................

8

4.1.2

Input Settings

................................
................................
..................

8

4.1.3

Serial Settings

................................
................................
.................

9

4.1.4

Setup a Test Job

................................
................................
...........

10

4.1.5

Connect to In
-
Sight

................................
................................
........

10

4.2

Verify Ethernet connection with Telnet

................................
.................

13

4.2.1

Setup a Test Job

................................
................................
...........

13

4.2.2

Connect to In
-
Sight

................................
................................
........

13





Page
2

of
13



Version 1.0 8/16/06



1

Overview

1.1

Scope

The purpose of this document is to outline the steps needed to connect and
transfer data from a Cognex In
-
Sight Sensor to an ABB Robot Controller.

In all
of the
setups outlined
,

the robot controller will
be
the device controlling
the
acquisition and transfer of data. In general the robot controller, with the use of
In
-
Sight Native Mode commands, will trigger the sensor to acquire and process
an image and then
the robot controller will
request

specific
data from the sensor.



For
a full list of Native Mode commands
from In
-
Sight Explorer
Select Help | In
-
Sight Explorer Help; from the Contents tab expand Communications Reference |
Native Mode Communications and here you'll find the full list of all Basic and
Extended Native Mode com
mands.


1.2

Needed
Hardware

In
-
Sight Sensor

(models 3400 or 5x
00)

In
-
Sight I/O module

(model 145
0 or
1460)

DB9

Serial Cable

(300
-
0281)

or
Ethernet Cable

Computer

ABB Robot Controller (IRC5, S4Cplus or S4P+)

PC Interface (Recommended for Ethernet communications

but not required)

Sensor Interface (for Serial communications)


1.3

Needed Software

Cognex In
-
Sight Explorer version 3.3 or higher

Cognex In
-
Sight firmware version 3.3 or higher

ABB
RAPID programming language

2

Serial communications

2.1

In
-
Sight Setup



Make sure In
-
Sight Explorer version 3.3 or higher is installed



Make sure the sensors firmware is version 3.3 o
r

higher


2.2

Robot Controller
RAPID code

MODULE VISION

!

DATA DECLARATIONS


PERS num nXOffs:=0;

PERS num nYOffs:=0;

PERS num nAngle:=0;

VAR string stReceived;

VAR

iodev ComChannel;

PERS tooldata tGripper:=[TRUE,[
0,0,0],[0,0,0,1]],

[5,[0,0,
],[1,0,0,0],0,0,0]];

PERS tooldata tVision:=[TRUE,[[0,0,0],[0,0,0,1]],

[5,[0, 0, 0],[1,0,0,0],0,0,0]];




Page
3

of
13



Version 1.0 8/16/06



CONST robtarget pHome:=[[0,0,0],[0,0,0,1],

[
-
2,0,1,0],[9E+09,9E+09,9E+09,9E+
09,9E+09,9E+09]];

CONST robtarget pVisionPos:=[[0,0,0],[0,0,0,1],

[
-
2,0,
-
1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];




PROC Main()

MoveL pHome,v1000,fine,tVision;

GetVisionData;

MoveL Reltool(pVisionPos,nXOffs,nYOffs,0
\
Rz:=nAngle),v500,

fine,tGripper;

Wa
itTime 3;

MoveL pHome,v1000,fine,tVision;

ENDPROC


PROC GetVisionData()

VAR string XData:="";

VAR string YData:="";

VAR string AngleData:="";

VAR num NumCharacters
:=
9
;

VAR bool bOK;


nXOffs:=0;

nYOffs:=0;

nAngle:=0;


Close
ComChannel
;

Open “COM2
”,
ComChann
el

\
Append
\
B
in;

ClearIOBuff
ComChannel
;

WaitTime
\
InPos, 0.5;


! Instruction In
-
Sight to Acquire
an
Image

! and not return until complete

WriteStrBin
ComChannel
, “sw8
\
0D
”;

CheckStatus;


! Get the value in cell C7

WriteStr
Bin

ComChannel
, “gvc007
\
0D
”;

CheckSt
atus;


! Read the
X
-
offset

XData
:= ReadStr
bin

(
ComChannel
,
NumCharacters

\
Time:=5
);


! Read the
Y
-
offset

YData
:= ReadStr
bin

(
ComChannel
,
NumCharacters

\
Time:=5
);


! Read the
Angle
-
offset

AngleData
:= ReadStr
bin

(
ComChannel
,
NumCharacters

\
Time:=5
);


!Closes

Serial Channel "COM2"

Close ComChannel;


!Convert String Data To Numerical Data

bOK:=StrToVal(XData,nXOffs);

bOK:=StrToVal(YData,nYOffs);

bOK:=StrToVal(AngleData,nAngle);

ENDPROC


PROC CheckStatus()

stReceived:=ReadStrBin(ComChannel,1
\
Time:=5);

IF stRecei
ved<>"1" THEN

TPErase;

TPWrite "Vision Error!";




Page
4

of
13



Version 1.0 8/16/06



Stop;

ENDIF

ClearIOBuff ComChannel;

ENDPROC


ENDMODULE


2.3

In
-
Sight Serial Port Setup

While c
onnect
ed

to the sensor

and Offline:

2.3.1

Input Settings



Select Se
nsor |
Discrete

I/O Settings | In
put Settings…



For In
put M
odule, select I/O Expansion Module




Click OK

2.3.2

Serial Settings



S
elect Sensor | Serial Port Settings…



Set the following properties:




Page
5

of
13



Version 1.0 8/16/06




o

Baud Rate: 115200

o

Data Bits: 8

o

Stop Bits: 1

o

Parity: None

o

Handshake: None

o

Mode: Native

o

Fixed Input Length: Unchecked

o

Input Te
rminator: 13

o

Output Terminator: 13

o

Verify that the dialog reports that the “I/O Expansion Module is
attached”



Click OK


2.4

In
-
Sight Job Setup

With a New Job perform the following steps:



Set the A0 Image cell properties (double
-
click cell A0):

o

Trigger = Extern
al

o

Manual = Checked



In cell A2 type ExtractBlobs( at this point the property sheet for
ExtractBlobs should popup, click OK



Insert Snippet “
ABB
”:

o

Select cell A4

o

If the Tool Palette isn’t visible; select View | Tool Palette

o

From the Snippets tab find and dou
ble
-
click

Communications | Robots | ABB



Define the coordinate cell references:

o

X: Double
-
click C6, double
-
click C2,

o

Y: Double
-
click D6, double
-
click D2

o

Angle: Double
-
click E6, double
-
click E2



Press the Manual Trigger icon a few times to confirm that Extra
ctBlobs( )
data is changing.



Save the job




Page
6

of
13



Version 1.0 8/16/06





Turn the sensor Online


3

Ethernet Communications

3.1

In
-
Sight Setup



Make sure In
-
Sight Explorer version 3.3 or higher is installed



Make sure the sensors firmware is version 3.3 of higher


3.2

Robot Controller Setup

The cod
e example shows the controller connecting to an In
-
Sight with IP address
192.168.0.1
;

To find the IP address of your sensor, from In
-
Sight Explorer, right
-
click the sensor name under In
-
Sight Network and select Properties.

3.3

Robot Controller RAPID code

MODU
LE VISION

!

DATA DECLARATIONS


PERS num nXOffs:=0;

PERS num nYOffs:=0;

PERS num nAngle:=0;

VAR string stReceived;

VAR socketdev ComSocket;

PERS tooldata tGripper:=[TRUE,[
0,0,0],[0,0,0,1]],

[5,[0,0,
],[1,0,0,0],0,0,0]];

PERS tooldata tVision:=[TRUE,[[0,0,0],
[0,0,0,1]],

[5,[0, 0, 0],[1,0,0,0],0,0,0]];

CONST robtarget pHome:=[[0,0,0],[0,0,0,1],

[
-
2,0,1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

CONST robtarget pVisionPos:=[[0,0,0],[0,0,0,1],

[
-
2,0,
-
1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];



PROC Main()

Conn
ectToInSight

;

MoveL pHome,v1000,fine,tVision;

GetVisionData;

MoveL Reltool(pVisionPos,nXOffs,nYOffs,0
\
Rz:=nAngle),v500,

fine,tGripper;

WaitTime 3;

MoveL pHome,v1000,fine,tVision;

GetVisionData;

MoveL Reltool(pVisionPos,nXOffs,nYOffs,0
\
Rz:=nAngle),v500,

fi
ne,tGripper;

WaitTime 3;

MoveL pHome,v1000,fine,tVision;

SocketClose
ComSocket
;

ENDPROC



PROC GetVisionData()

VAR string XData:="";

VAR string YData:="";

VAR string AngleData:="";

VAR num NumCharacters
:=9
;

VAR bool bOK;


nXOffs:=0;

nYOffs:=0;




Page
7

of
13



Version 1.0 8/16/06



nAngle:=0;


status := SocketGetStatus(
ComSocket
);

IF status <> SOCKET_CONNECTD THEN

TPErase;

TPWrite "Vision
Sensor Not Connected
";

Return;

ENDIF


! Instruct In
-
Sight to Acquire an Image

!
and not return until complete

SocketSend
ComSocket

\
Str:="sw8"
;

CheckStatus
;


S
ocketReceive
ComSocket

\
Str:=
stReceived
;


! Get the value in cell C7

SocketSend
ComSocket

\
Str:="gv
c
007"
;

CheckStatus
;


! Read the data

SocketReceive
ComSocket

\
Str:=
stReceived
;


! Parse the data string

XData
:= StrPart(
stReceived
,
0
,
NumCharacters
);

YData
:
= StrPart(
stReceived
,
NumCharacters
,
NumCharacters
);

AngleData
:= StrPart(
stReceived, 2*
NumCharacters
,
NumCharacters
);


!Convert String Data To Numerical Data

bOK:=StrToVal(XData,nXOffs);

bOK:=StrToVal(YData,nYOffs);

bOK:=StrToVal(AngleData,nAngle);

ENDPROC



PROC CheckStatus()

SocketReceive
ComSocket

\
Str:=
stReceived
;

IF stReceived

<>

"1" THEN

TPErase;

TPWrite "Vision Error!";

Stop;

ENDIF

ENDPROC



PROC
ConnectToInSight
()

SocketCreate
ComSocket
;

SocketConnect
ComSocket
, "192.168.0.1", 23
;


SocketReceive
Com
Socket

\
Str:=
stReceived
;


IF
stReceived

<> "User: "
THEN

TPErase;

TPWrite "Vision
Login Error (User Prompt)
";

Stop;

ENDIF


! Send
the
Username

SocketSend
ComSocket

\
Str:="admin"
;


SocketReceive
ComSocket

\
Str:=
stReceived
;


IF
stReceived

<> "Password: "

THE
N




Page
8

of
13



Version 1.0 8/16/06



TPErase;

TPWrite "Vision
Login Error (
Password

Prompt)
";

Stop;

ENDIF


! Send Password

SocketSend
ComSocket

\
Str:=""
;


SocketReceive
ComSocket

\
Str:=
stReceived
;


IF
stReceived

<> "User Logged I
n"
THEN

TPErase;

TPWrite "Vision
Login Error (Final Login)
";

S
top;

ENDIF

ENDPROC


ENDMODULE


3.4

Job Setup

With a New Job perform the following steps:



Set the following A0 Image cell properties (double
-
click cell A0):

o

Trigger = External

o

Manual = Checked



In cell A2 type
ExtractBlobs
( at this point the property sheet for
E
xtractBlobs

should popup, click OK



Insert Snippet “ABB”:

o

Select cell A4

o

If the Tool Palette isn’t visible; select View | Tool Palette

o

From the Snippets tab find and double
-
click

Communications | Robots | ABB



Define the coordinate cell references:

o

X: Double
-
click C6, double
-
click C2,

o

Y: Double
-
click D6, double
-
click D2

o

Angle: Double
-
click E6, double
-
click E2



Press the Manual Trigger icon a few times to confirm that ExtractBlobs( )
data is changing.



Save the job



Turn the sensor Online


4

Trouble Shooting

4.1

Seri
al with HyperTerminal

4.1.1

In
-
Sight Serial Port Setup

While connected to the sensor and Offline:

4.1.2

Input Settings



Select Sensor |
Discrete

I/O Settings | Input Settings…



For Input Module, select I/O Expansion Module




Page
9

of
13



Version 1.0 8/16/06






Click OK

4.1.3

Serial Settings



Select Sensor | Seri
al Port Settings…



Set the following properties:


o

Baud Rate: 115200

o

Data Bits: 8

o

Stop Bits: 1

o

Parity: None

o

Handshake: None

o

Mode: Native




Page
10

of
13



Version 1.0 8/16/06



o

Fixed Input Length: Unchecked

o

Input Terminator: 13

o

Output Terminator: 13

o

Verify that the dialog reports that the “I/O Ex
pansion Module is
attached”



Click OK

4.1.4

Setup a Test Job



With a New Job perform the following steps:

o

Confirm the following A0 Image cell properties (double
-
click cell
A0):



Trigger = External



Manual = Checked (default)

o

In cell A2 type
ExtractBlobs
( at this poi
nt the property sheet for
ExtractBlobs

should popup, click OK

o

In cell A4 type
FindBlobs
( at this point the property sheet for
FindBlobs

should popup, enter B2 for the Blobs property and then
click OK



You can test the job by clicking the Manual Trigger butt
on on the icon bar
or selecting Image | Manual Trigger from the menus



Put the sensor Online by either clicking the Online button on the icon bar
or selecting Sensor | Online from the menus

4.1.5


Connect to In
-
Sight



From Windows click Start | All Programs | Acce
ssories | Communications |
HyperTerminal



Create a New Connection




Page
11

of
13



Version 1.0 8/16/06




o

Port: COM1

o

Bits per second: 115200

o

Data bits: 8

o

Parity: None

o

Stop bits: 1

o

Flow Control: None



File | Properties | Settings




Page
12

of
13



Version 1.0 8/16/06




o

Emulation: ANSI

o

ASC
II Setup (for viewing ease) set the following




Send line ends with line feeds



Echo typed characters locally



Append line feeds to incoming line ends




Page
13

of
13



Version 1.0 8/16/06





Wrap lines that exceed terminal width



Connect



Type: sw8 (this will cause a manual acquire and the image should
change)



Type: gvC004 (this will get the va
lue of cell C4)



4.2

Verify
Ethernet
connection
with Telnet

4.2.1

Setup a Test Job



Check and record the IP address of your sensor by selecting Help | About
In
-
Sight Explorer... from the menus



With a New Job perform the following steps:

o

Confirm the following A0 Imag
e cell properties (double
-
click cell
A0):



Trigger =
External



Manual = Checked (default)

o

In cell
A2

type
ExtractBlobs
( at this point the property sheet for
ExtractBlobs

should popup, click OK

o

In cell A4 type
FindBlobs
( at this point the property sheet for
F
indBlobs

should popup, enter B2 for the Blobs property and then
click OK



You can test the job by clicking the Manual Trigger button on the icon bar
or selecting Image | Manual Trigger from the menus



Put the sensor Online by either clicking the Online butto
n on the icon bar
or selecting Sensor | Online from the menus

4.2.2


Connect to In
-
Sight



From Windows click Start | Run...



In the Run window type: telnet <the sensors IP Address>


example: telnet
10.27.80.66



Click OK



You should be prompted for a user name, type
admin



Press Enter



The password by default is blank, so just press Enter



You should now see User Logged In



T
ype: sw
8 (this will cause a manual acquire and the image should
change)



T
ype: gvC00
4

(th
is will get the value of cell C4
)



To disconnect your telnet s
ession type CTRL
+
]



type: quit to close the window