Skip to content

Commit 17fd14a

Browse files
committed
Merge pull request #8 from marshallpowell97/master.
2 parents 811b100 + 1f24ea9 commit 17fd14a

19 files changed

+204
-121
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
staubli_val3_driver/val3/ros_server/.outlining.json

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## Overview
1010

1111
This repository contains the `staubli_val3_driver` package which provides a set of VAL3 libraries and an application which together implement a [simple_message][] compatible server implementation.
12-
Together with the nodes in [industrial_robot_client][], this server can be used as a ROS 1 driver that allows motion control of Staubli CS8 controlled robots, by exposing a [FollowJointTrajectory][] [action][] server, which is compatible with MoveIt and other nodes that implement an action client.
12+
Together with the nodes in [industrial_robot_client][], this server can be used as a ROS 1 driver that allows motion control of Staubli CS8/CS8C controlled robots, by exposing a [FollowJointTrajectory][] [action][] server, which is compatible with MoveIt and other nodes that implement an action client.
1313

1414

1515
## Documentation
@@ -19,8 +19,8 @@ Refer to the `staubli_val3_driver` [readme](./staubli_val3_driver/README.md) for
1919

2020
## Compatibility
2121

22-
The current version of the driver is compatible with CS8 controllers only.
23-
Future work may extend this to support CS9 controllers as well.
22+
The current version of the driver is compatible with CS8/CS8C controllers only.
23+
Future work is planned to extend this to support CS9 controllers as well.
2424

2525

2626

staubli_val3_driver/README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22

33
## Overview
44

5-
This ROS-I driver was developed in Staubli's VAL3 language for use with 6-axis Staubli robot manipulators.
5+
This ROS-I driver was developed in Staubli's VAL 3 language for use with 6-axis Staubli robot manipulators.
66

7-
It is advisable to try this driver on Staubli's emulator first.
7+
It is advisable to try this driver on the emulator in [Staubli Robotics Suite (SRS)](https://www.staubli.com/en-us/robotics/product-range/robot-software/pc-robot-programming-srs/) first.
88

99

1010
## Requirements
1111

1212
* Staubli 6-axis robot manipulator
13-
* Staubli CS8 controller
14-
* it may work with other controllers, but this driver was tested on CS8 only
13+
* Staubli CS8/CS8C controller
1514
* VAL3 version s7.7.2 or greater
1615
* this is very important, since this implementation uses return values of `sioGet()`
1716
only available from s7.7.2 onwards
18-
17+
* Staubli Robotics Suite 2019 (not required but strongly recommended)
1918

2019
## Installation
2120

@@ -29,20 +28,22 @@ Clone [staubli_val3_driver](https://github.com/ros-industrial/staubli_val3_drive
2928
git clone https://github.com/ros-industrial/staubli_val3_driver.git
3029
```
3130

32-
### Transfer driver to Staubli CS8 controller
31+
### Transfer driver to Staubli CS8/CS8C controller
32+
33+
There are 2 ways of transferring the VAL 3 application to the controller:
3334

34-
There are several ways of transferring VAL3 applications to a Staubli controller.
35-
The simplest method is probably copying the contents of `val3` folder into a USB memory stick (<2GB given the CS8 limitations), plugging the stick to the controller and using the teach pendant to copy the folders.
35+
1. Copy the contents of `val3` folder onto a USB memory stick (<2GB given the CS8/CS8C limitations), plugging the stick into the controller and using the teach pendant to copy the folders
36+
37+
1. Use the Transfer Manager in SRS to copy the VAL 3 applications to the controller. (Home -> Controller -> Transfer Manager)
3638

3739
### Open the VAL3 application with Staubli SRS
3840

39-
Although it is possible to edit the source files with any text editor (they are essentially XML files), it is advisable to use the Staubli Robotics Suite:
41+
Although it is possible to edit the source files with any text editor (they are essentially XML files), it is advisable to use [Staubli Robotics Suite](https://www.staubli.com/en-us/robotics/product-range/robot-software/pc-robot-programming-srs/):
4042

4143
* Copy contents of folder `val3` into the `usrapp` folder of the Staubli cell
4244
* Open the `ros_server` VAL3 project located inside the `ros_server` folder
4345

44-
SRS offers autocompletion, syntax highlighting and syntax checking, amongst other useful features, such as a Staubli controller/teach pendant emulator.
45-
46+
SRS offers autocompletion, syntax highlighting and syntax checking, amongst other useful features, such as a Staubli controller/teach pendant emulator.
4647

4748
## Usage
4849

@@ -55,7 +56,7 @@ From `Main menu`:
5556

5657
### Configuration
5758

58-
The TCP sockets on the CS8 controller/emulator must be configured prior to using the driver, otherwise a runtime error will be displayed on the teach pendant and the driver will not work.
59+
The TCP sockets on the CS8/CS8C controller/emulator must be configured prior to use, otherwise a runtime error will be generated and the driver will not work.
5960

6061
Two sockets (TCP Servers) are required. From `Main menu`:
6162

@@ -73,17 +74,17 @@ have been transferred to the Staubli controller
7374
2. The VAL3 application `ros_server` has been loaded
7475
3. Both TCP Server sockets have been configured properly
7576

76-
Then simply press the `Run` button, ensure that `ros_server` is highlighted, then press `F8` (Ok).
77+
Press the `Run` button, ensure that `ros_server` is highlighted, then press `F8` (Ok).
7778

78-
Notice that depending on which mode of operation is currently active, the motors may need to be enabled manually (a message will pop up on the screen).
79-
Likewise, the robot will only move if the `Move` button has been pressed (or is kept pressed if in manual mode).
79+
Depending on which working mode the controller is in, arm power may need to be enabled manually (a message will pop up on the screen).
80+
Once arm power is enabled, the robot will only move if the `Move` button has been pressed (or is kept pressed if in manual mode).
8081

8182
### Run the industrial_robot_client node (ROS-I client)
8283

8384
The `indigo-devel` branch provides launch files (within the `staubli_val3_driver` ROS package). Simply run:
8485

8586
```shell
86-
roslaunch staubli_val3_driver robot_interface_streaming.launch robot_ip:=<CS8 controller IP address>
87+
roslaunch staubli_val3_driver robot_interface_streaming.launch robot_ip:=<controller IP address>
8788
```
8889

8990
## Bugs, suggestions and feature requests

staubli_val3_driver/val3/ros_server/dataReceiver.pgx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,19 @@
2929
// 3: decode body
3030
// 4: push motion into buffer
3131
// 5: send ACK
32-
l_nMsgRecvState=0
32+
33+
// Set variable constants to make sure they were not changed
34+
nReset=0
35+
nRecHeader=0
36+
nDecHeader=1
37+
nRecBody=2
38+
nDecBody=3
39+
nPushMotion=4
40+
nAck=5
41+
42+
l_nMsgRecvState=nRecHeader
3343
34-
while (true)
44+
while(true)
3545
// usually for state machines a switch-case statement is a neat implementation
3646
// HOWEVER, at every iteration of while() this task is sequenced and only called
3747
// after whatever ms is was defined when created.
@@ -41,30 +51,30 @@
4151
// into buffer and then send ACK to client WITHIN ONE ITERATION of while(),
4252
// hence the if statement sequence below
4353
l_nStartTime = clock()
44-
if (l_nMsgRecvState==0)
54+
if(l_nMsgRecvState==nRecHeader)
4555
call recvMsgHeader(l_nMsgRecvState)
4656
endIf
4757
nHeaderTime = clock() - l_nStartTime
48-
if (l_nMsgRecvState==1)
58+
if(l_nMsgRecvState==nDecHeader)
4959
call decodeMsgHeader(l_nMsgRecvState)
5060
endIf
51-
if (l_nMsgRecvState==2)
61+
if(l_nMsgRecvState==nRecBody)
5262
call recvMsgBody(l_nMsgRecvState)
5363
endIf
54-
if (l_nMsgRecvState==3)
64+
if(l_nMsgRecvState==nDecBody)
5565
call decodeMsgBody(l_nMsgRecvState)
5666
endIf
57-
if (l_nMsgRecvState==4)
67+
if(l_nMsgRecvState==nPushMotion)
5868
call pushMotion(l_nMsgRecvState)
5969
endIf
60-
if (l_nMsgRecvState==5)
70+
if(l_nMsgRecvState==nAck)
6171
call encodeAck()
6272
call sendAck(l_nMsgRecvState)
6373
endIf
6474
nElapsedTime = clock() - l_nStartTime - nHeaderTime
6575
6676
// assert state machine is working OK
67-
if (l_nMsgRecvState<0 or l_nMsgRecvState>5)
77+
if(l_nMsgRecvState<nRecHeader or l_nMsgRecvState>nAck)
6878
popUpMsg("Data reception state machine error")
6979
endIf
7080
@@ -75,4 +85,4 @@
7585
endWhile
7686
end]]></Code>
7787
</Program>
78-
</Programs>
88+
</Programs>

staubli_val3_driver/val3/ros_server/decTrajPt.pgx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
2-
<Programs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.staubli.com/robotics/VAL3/Program/2" >
3-
<Program name="decTrajPt" access="public" >
4-
<Parameters xmlns="http://www.staubli.com/robotics/VAL3/Param/1" >
5-
<Parameter name="x_bFlag" type="bool" use="reference" xsi:type="element" dimensions="1" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Programs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.staubli.com/robotics/VAL3/Program/2">
3+
<Program name="decTrajPt" access="public">
4+
<Parameters xmlns="http://www.staubli.com/robotics/VAL3/Param/1">
5+
<Parameter name="x_bFlag" type="bool" xsi:type="element" use="reference" />
66
</Parameters>
77
<Locals>
88
<Local name="l_nIndex" type="num" xsi:type="array" size="1" />
@@ -32,30 +32,30 @@
3232
3333
// sequence
3434
l_nRetVal=fromBinary(rosTrajPtMsg.body.nData,4,"-4l",rosTrajPtMsg.jointTrajPt.nSeq)
35-
if (l_nRetVal!=1)
35+
if(l_nRetVal!=1)
3636
x_bFlag=false
3737
return
3838
endIf
3939
4040
// joints[10]
4141
for l_nIndex=0 to 9 step 1
4242
l_nRetVal=fromBinary(rosTrajPtMsg.body.nData[(l_nIndex*4)+4],4,"4.0l",rosTrajPtMsg.jointTrajPt.nJoints[l_nIndex])
43-
if (l_nRetVal!=1)
43+
if(l_nRetVal!=1)
4444
x_bFlag=false
4545
return
4646
endIf
4747
endFor
4848
4949
// velocity
5050
l_nRetVal=fromBinary(rosTrajPtMsg.body.nData[44],4,"4.0l",rosTrajPtMsg.jointTrajPt.nVelocity)
51-
if (l_nRetVal!=1)
51+
if(l_nRetVal!=1)
5252
x_bFlag=false
5353
return
5454
endIf
5555
5656
// duration
5757
l_nRetVal=fromBinary(rosTrajPtMsg.body.nData[48],4,"4.0l",rosTrajPtMsg.jointTrajPt.nDuration)
58-
if (l_nRetVal!=1)
58+
if(l_nRetVal!=1)
5959
x_bFlag=false
6060
return
6161
endIf
@@ -66,4 +66,4 @@
6666
x_bFlag=true
6767
end]]></Code>
6868
</Program>
69-
</Programs>
69+
</Programs>

staubli_val3_driver/val3/ros_server/decTrajPtFull.pgx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
2-
<Programs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.staubli.com/robotics/VAL3/Program/2" >
3-
<Program name="decTrajPtFull" access="public" >
4-
<Parameters xmlns="http://www.staubli.com/robotics/VAL3/Param/1" >
5-
<Parameter name="x_bFlag" type="bool" use="reference" xsi:type="element" dimensions="1" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Programs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.staubli.com/robotics/VAL3/Program/2">
3+
<Program name="decTrajPtFull" access="public">
4+
<Parameters xmlns="http://www.staubli.com/robotics/VAL3/Param/1">
5+
<Parameter name="x_bFlag" type="bool" xsi:type="element" use="reference" />
66
</Parameters>
77
<Locals>
88
<Local name="l_nIndex" type="num" xsi:type="array" size="1" />
@@ -32,36 +32,36 @@
3232
3333
// robotId
3434
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData,4,"-4l",rosTrajPtFMsg.jointTrajPtFull.nRobotId)
35-
if (l_nRetVal!=1)
35+
if(l_nRetVal!=1)
3636
x_bFlag=false
3737
return
3838
endIf
3939
4040
// sequence
4141
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData,4,"-4l",rosTrajPtFMsg.jointTrajPtFull.nSeq)
42-
if (l_nRetVal!=1)
42+
if(l_nRetVal!=1)
4343
x_bFlag=false
4444
return
4545
endIf
4646
4747
// valid fields
4848
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData,4,"-4l",rosTrajPtFMsg.jointTrajPtFull.nValidFields)
49-
if (l_nRetVal!=1)
49+
if(l_nRetVal!=1)
5050
x_bFlag=false
5151
return
5252
endIf
5353
5454
// time
5555
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData,4,"4.0l",rosTrajPtFMsg.jointTrajPtFull.nTime)
56-
if (l_nRetVal!=1)
56+
if(l_nRetVal!=1)
5757
x_bFlag=false
5858
return
5959
endIf
6060
6161
// positions[10]
6262
for l_nIndex=0 to 9 step 1
6363
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData[(l_nIndex*4)+16],4,"4.0l",rosTrajPtFMsg.jointTrajPtFull.nPositions[l_nIndex])
64-
if (l_nRetVal!=1)
64+
if(l_nRetVal!=1)
6565
x_bFlag=false
6666
return
6767
endIf
@@ -70,7 +70,7 @@
7070
// velocities[10]
7171
for l_nIndex=0 to 9 step 1
7272
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData[(l_nIndex*4)+56],4,"4.0l",rosTrajPtFMsg.jointTrajPtFull.nVelocities[l_nIndex])
73-
if (l_nRetVal!=1)
73+
if(l_nRetVal!=1)
7474
x_bFlag=false
7575
return
7676
endIf
@@ -79,7 +79,7 @@
7979
// accelerations[10]
8080
for l_nIndex=0 to 9 step 1
8181
l_nRetVal=fromBinary(rosTrajPtFMsg.body.nData[(l_nIndex*4)+96],4,"4.0l",rosTrajPtFMsg.jointTrajPtFull.nAccelerations[l_nIndex])
82-
if (l_nRetVal!=1)
82+
if(l_nRetVal!=1)
8383
x_bFlag=false
8484
return
8585
endIf
@@ -91,4 +91,4 @@
9191
x_bFlag=true
9292
end]]></Code>
9393
</Program>
94-
</Programs>
94+
</Programs>

staubli_val3_driver/val3/ros_server/decodeMsgBody.pgx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
l_bFlag=false
2828
2929
switch rosGenericMsg.header.nMsgType
30-
case 11
30+
case nStdMsgType["JOINT_TRAJ_PT"]
3131
call decTrajPt(l_bFlag)
3232
break
33-
case 14
33+
case nStdMsgType["JOINT_TRAJ_PT_FULL"]
3434
call decTrajPtFull(l_bFlag)
3535
break
3636
default
@@ -39,27 +39,27 @@
3939
4040
if (l_bFlag == true)
4141
// move on to state 4: push motion into buffer
42-
x_nMsgRecvState=4
42+
x_nMsgRecvState=nPushMotion
4343
else
4444
// error whilst decoding msg body...
4545
if (rosGenericMsg.header.nCommType==2)
4646
switch rosGenericMsg.header.nMsgType
47-
case 11
47+
case nStdMsgType["JOINT_TRAJ_PT"]
4848
rosTrajPtAck.header.nReplyCode=2
4949
break
50-
case 14
50+
case nStdMsgType["JOINT_TRAJ_PT_FULL"]
5151
rosTrajPtFAck.header.nReplyCode=2
5252
break
5353
default
5454
break
5555
endSwitch
5656
// jump to state 5: sendAck()
57-
x_nMsgRecvState=5
57+
x_nMsgRecvState=nAck
5858
else
5959
// reset state machine, since no ACK is required
60-
x_nMsgRecvState=0
60+
x_nMsgRecvState=nReset
6161
endIf
6262
endIf
6363
end]]></Code>
6464
</Program>
65-
</Programs>
65+
</Programs>

staubli_val3_driver/val3/ros_server/decodeMsgHeader.pgx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,31 @@
2828
l_nRetVal=fromBinary(rosGenericMsg.prefix.nData,4,"-4l",rosGenericMsg.prefix.nLength)
2929
if (l_nRetVal!=1)
3030
// error decoding prefix, reset state machine
31-
x_nMsgRecvState=0
31+
x_nMsgRecvState=nReset
3232
return
3333
endIf
3434
l_nRetVal=fromBinary(rosGenericMsg.header.nData,4,"-4l",rosGenericMsg.header.nMsgType)
3535
if (l_nRetVal!=1)
3636
// error decoding header (msg type), reset state machine
37-
x_nMsgRecvState=0
37+
x_nMsgRecvState=nReset
3838
return
3939
endIf
4040
l_nRetVal=fromBinary(rosGenericMsg.header.nData[4],4,"-4l",rosGenericMsg.header.nCommType)
4141
if (l_nRetVal!=1)
4242
// error decoding header (comm type), reset state machine
43-
x_nMsgRecvState=0
43+
x_nMsgRecvState=nReset
4444
return
4545
endIf
4646
l_nRetVal=fromBinary(rosGenericMsg.header.nData[8],4,"-4l",rosGenericMsg.header.nReplyCode)
4747
if (l_nRetVal!=1)
4848
// error decoding header (reply code), reset state machine
49-
x_nMsgRecvState=0
49+
x_nMsgRecvState=nReset
5050
return
5151
endIf
5252
5353
// no errors detected whilst decoding prefix and header
5454
// move on to state 2: receive msg body
55-
x_nMsgRecvState=2
55+
x_nMsgRecvState=nRecBody
5656
end]]></Code>
5757
</Program>
58-
</Programs>
58+
</Programs>

0 commit comments

Comments
 (0)