Skip to content

Commit 15d8319

Browse files
committed
Some small changes in const poses
1 parent f044159 commit 15d8319

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

scripts/controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ def __init__(self):
3333
self.HOME_POS_MANIPULATOR_01 = [0.004601942375302315, -0.4218447208404541, 1.6260197162628174, -0.1426602154970169, 0.010737866163253784]
3434
self.HOME_POS_MANIPULATOR_02 = [0.0, 0.0, 1.22, -0.142, 0.0]
3535
self.HOME_POS_CAMERA_01 = [0.0, 0.698]
36-
self.HOME_POS_CAMERA_02 = [0.698, 0.0]
36+
self.HOME_POS_CAMERA_02 = [-0.523, -0.523]
3737
self.IK_POSITION_TOLERANCE = 0.01
3838
self.IK_ORIENTATION_TOLERANCE = np.pi/9
3939
self.MIN_CLOSING_GAP = 0.002
4040

4141
def set_camera_angles(self, angles):
4242
pan_msg = Float64()
4343
pan_msg.data = angles[0]
44-
rospy.loginfo('Going to camera pan: {} rad'.format(pan_rad))
44+
rospy.loginfo('Going to camera pan: {} rad'.format(angles[0]))
4545
self.pan_pub.publish(pan_msg)
4646

4747
tilt_msg = Float64()
4848
tilt_msg.data = angles[1]
49-
rospy.loginfo('Going to camera tilt: {} rad'.format(tilt_rad))
49+
rospy.loginfo('Going to camera tilt: {} rad'.format(angles[1]))
5050
self.tilt_pub.publish(tilt_msg)
5151
rospy.sleep(4)
5252

@@ -57,7 +57,7 @@ def set_arm_joint_angles(self, joint_target):
5757

5858
def get_joint_state(self, data):
5959
self.current_joint_state = data.position[0:5]
60-
self.current_gripper_state = data.positions[7:9]
60+
self.current_gripper_state = data.position[7:9]
6161

6262
def open_gripper(self):
6363
empty_msg = Empty()

scripts/ik_control.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def get_joint_state(data):
5959
global current_joint_state
6060
global current_gripper_state
6161
# if len(data.position) == 9:
62-
current_gripper_state = data.positions[7:9]
63-
current_joint_state = data.positions[0:5]
62+
current_gripper_state = data.position[7:9]
63+
current_joint_state = data.position[0:5]
6464

6565
def open_gripper(pub):
6666
empty_msg = Empty()
@@ -129,7 +129,7 @@ def main():
129129

130130
# Homing of all servos
131131
home_joint = [0.004601942375302315, -0.4218447208404541, 1.6260197162628174, -0.1426602154970169, 0.010737866163253784]
132-
#home_joint = [0.0, 0.0, 1.22, -0.142, 0.0]
132+
# home_joint = [0.0, 0.0, 1.22, -0.142, 0.0]
133133
set_arm_joint(arm_pub, home_joint)
134134
close_gripper(gripper_close_pub)
135135
set_camera_angles(pan_pub, tilt_pub, rad_from_deg*0., rad_from_deg*40.0) #, ck)

scripts/machine.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import smach_ros
77

88
from controller import Controller
9+
from geometry_msgs.msg import PoseStamped
910

1011
# Initialize controller
1112
ctrl = Controller()
@@ -98,25 +99,24 @@ def execute(self, userdata):
9899
class FindAttention(smach.State):
99100

100101
def __init__(self):
101-
smach.State.__init__(self, outcomes=['giveTool'], output_keys=['frame_name'])
102+
smach.State.__init__(self, outcomes=['giveTool'], output_keys=['head_pose'])
102103

103104
def execute(self, userdata):
104105
## Call service to get the frame id of the hand centroid
105-
## TODO: change the name of the variable frame_name
106-
userdata.frame_name = "random"
106+
posestamped = rospy.wait_for_message("/openface2/head_pose", PoseStamped)
107107
rospy.loginfo('Executing state FindAttention')
108108
return 'giveTool'
109109

110110
# define state IK2
111111
class IK2(smach.State):
112112
def __init__(self):
113-
smach.State.__init__(self, outcomes=['foundIK'], input_keys=['frame_name'])
113+
smach.State.__init__(self, outcomes=['foundIK'], input_keys=['head_pose'])
114114

115115
def execute(self, userdata):
116116
## Wait till IK not found. Change tolerance and call compute IK again
117117
## Break go to pose into find pose and compute IK functions
118118
## Make a different function with gripper pointing upwards and call it from here
119-
success = ctrl.go_to_pose(userdata.frame_name)
119+
success = ctrl.go_to_pose(userdata.head_pose)
120120
# if not success
121121
rospy.loginfo('Executing state IK2')
122122
return 'foundIK'

0 commit comments

Comments
 (0)