-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_trajectory_client.py
34 lines (26 loc) · 1.08 KB
/
test_trajectory_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import roslib; roslib.load_manifest('staubli_tx60')
import rospy
import actionlib
import staubli_tx60.msg
from copy import *
def set_trajectory_client(client = None):
if client == None:
#setup client
client = actionlib.SimpleActionClient('setJointTrajectory', staubli_tx60.msg.SetJointTrajectoryAction)
client.wait_for_server()
jointGoalList = list()
#set up joint trajectory params
p = staubli_tx60.msg.StaubliMovementParams(jointVelocity = 1.0,
jointAcc = 1.0,
jointDec= 1.0,
endEffectorMaxTranslationVel = 9999.0,
endEffectorMaxRotationalVel = 9999.0,
movementType = 1)
#Set up Joint Goals
jointGoalList.append(staubli_tx60.msg.JointTrajectoryPoint(jointValues = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0], params = p))
for i in range(30):
jointGoalList.append(deepcopy(jointGoalList[-1]))
jointGoalList[-1].jointValues[5] += .05
actionGoal = staubli_tx60.msg.SetJointTrajectoryGoal(jointTrajectory = jointGoalList)
client.send_goal(actionGoal)
return client, jointGoalList