Skip to content

Commit 0d42bd3

Browse files
committed
Merge 'upstream/master'
2 parents 080c8a5 + 6614dec commit 0d42bd3

File tree

65 files changed

+209
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+209
-204
lines changed

README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Supported ROS Versions
1212
- Indigo
1313
- Kinetic
1414
- Melodic
15+
- Noetic
1516

1617
Installation
1718
------------

intera_examples/CMakeLists.txt

+31
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,37 @@ catkin_package(
3636
intera_interface
3737
)
3838

39+
catkin_install_python(PROGRAMS
40+
scripts/ik_service_client.py
41+
scripts/go_to_joint_angles.py
42+
scripts/joint_position_waypoints.py
43+
scripts/joint_torque_springs.py
44+
scripts/gripper_cuff_control.py
45+
scripts/head_wobbler.py
46+
scripts/joint_recorder.py
47+
scripts/fk_service_client.py
48+
scripts/joint_velocity_wobbler.py
49+
scripts/navigator_io.py
50+
scripts/joint_position_joystick.py
51+
scripts/joint_position_keyboard.py
52+
scripts/gripper_keyboard.py
53+
scripts/stop_motion_trajectory.py
54+
scripts/go_to_joint_angles_in_contact.py
55+
scripts/joint_position_file_playback.py
56+
scripts/go_to_cartesian_pose.py
57+
scripts/head_display_image.py
58+
scripts/joint_trajectory_client.py
59+
scripts/joint_trajectory_file_playback.py
60+
scripts/set_interaction_options.py
61+
scripts/constrained_zeroG.py
62+
scripts/gripper_joystick.py
63+
scripts/lights_blink.py
64+
scripts/camera_display.py
65+
scripts/send_random_trajectory.py
66+
scripts/send_traj_from_file.py
67+
68+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
69+
3970
install(
4071
DIRECTORY scripts/
4172
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}

intera_examples/cfg/SawyerJointSpringsExample.cfg

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/package.xml

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<package>
2+
<package format="3">
33
<name>intera_examples</name>
44
<version>5.3.0</version>
55
<description>
@@ -21,6 +21,8 @@
2121

2222
<buildtool_depend>catkin</buildtool_depend>
2323

24+
<buildtool_depend condition="$ROS_PYTHON_VERSION == 2">python-setuptools</buildtool_depend>
25+
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_depend>
2426
<build_depend>rospy</build_depend>
2527
<build_depend>actionlib</build_depend>
2628
<build_depend>sensor_msgs</build_depend>
@@ -32,16 +34,16 @@
3234
<build_depend>intera_motion_msgs</build_depend>
3335
<build_depend>intera_interface</build_depend>
3436

35-
<run_depend>rospy</run_depend>
36-
<run_depend>actionlib</run_depend>
37-
<run_depend>sensor_msgs</run_depend>
38-
<run_depend>control_msgs</run_depend>
39-
<run_depend>trajectory_msgs</run_depend>
40-
<run_depend>cv_bridge</run_depend>
41-
<run_depend>dynamic_reconfigure</run_depend>
42-
<run_depend>intera_core_msgs</run_depend>
43-
<run_depend>intera_motion_msgs</run_depend>
44-
<run_depend>intera_interface</run_depend>
45-
<run_depend>joystick_drivers</run_depend>
37+
<exec_depend>rospy</exec_depend>
38+
<exec_depend>actionlib</exec_depend>
39+
<exec_depend>sensor_msgs</exec_depend>
40+
<exec_depend>control_msgs</exec_depend>
41+
<exec_depend>trajectory_msgs</exec_depend>
42+
<exec_depend>cv_bridge</exec_depend>
43+
<exec_depend>dynamic_reconfigure</exec_depend>
44+
<exec_depend>intera_core_msgs</exec_depend>
45+
<exec_depend>intera_motion_msgs</exec_depend>
46+
<exec_depend>intera_interface</exec_depend>
47+
<exec_depend>joystick_drivers</exec_depend>
4648

4749
</package>

intera_examples/scripts/camera_display.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,13 +22,14 @@
2322
import rospy
2423
import intera_interface
2524

26-
def show_image_callback(img_data, (edge_detection, window_name)):
25+
def show_image_callback(img_data, xxx_todo_changeme):
2726
"""The callback function to show image by using CvBridge and cv
2827
"""
28+
(edge_detection, window_name) = xxx_todo_changeme
2929
bridge = CvBridge()
3030
try:
3131
cv_image = bridge.imgmsg_to_cv2(img_data, "bgr8")
32-
except CvBridgeError, err:
32+
except CvBridgeError as err:
3333
rospy.logerr(err)
3434
return
3535
if edge_detection == True:

intera_examples/scripts/constrained_zeroG.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python
2-
32
# Copyright (c) 2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/fk_service_client.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,7 +48,7 @@ def fk_service_client(limb = "right"):
4948
try:
5049
rospy.wait_for_service(ns, 5.0)
5150
resp = fksvc(fkreq)
52-
except (rospy.ServiceException, rospy.ROSException), e:
51+
except (rospy.ServiceException, rospy.ROSException) as e:
5352
rospy.logerr("Service call failed: %s" % (e,))
5453
return False
5554

intera_examples/scripts/go_to_cartesian_pose.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python
2-
32
# Copyright (c) 2016-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/go_to_joint_angles.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python
2-
32
# Copyright (c) 2016-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/go_to_joint_angles_in_contact.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python
2-
32
# Copyright (c) 2016-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/gripper_cuff_control.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/gripper_joystick.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/gripper_keyboard.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -95,7 +94,7 @@ def update_velocity(offset_vel):
9594
print("key bindings: ")
9695
print(" Esc: Quit")
9796
print(" ?: Help")
98-
for key, val in sorted(bindings.items(),
97+
for key, val in sorted(list(bindings.items()),
9998
key=lambda x: x[1][2]):
10099
print(" %s: %s" % (key, val[2]))
101100
# force shutdown call if caught by key handler

intera_examples/scripts/head_display_image.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/head_wobbler.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/ik_service_client.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -90,7 +89,7 @@ def ik_service_client(limb = "right", use_advanced_options = False):
9089
try:
9190
rospy.wait_for_service(ns, 5.0)
9291
resp = iksvc(ikreq)
93-
except (rospy.ServiceException, rospy.ROSException), e:
92+
except (rospy.ServiceException, rospy.ROSException) as e:
9493
rospy.logerr("Service call failed: %s" % (e,))
9594
return False
9695

@@ -104,7 +103,7 @@ def ik_service_client(limb = "right", use_advanced_options = False):
104103
rospy.loginfo("SUCCESS - Valid Joint Solution Found from Seed Type: %s" %
105104
(seed_str,))
106105
# Format solution into Limb API-compatible dictionary
107-
limb_joints = dict(zip(resp.joints[0].name, resp.joints[0].position))
106+
limb_joints = dict(list(zip(resp.joints[0].name, resp.joints[0].position)))
108107
rospy.loginfo("\nIK Joint Solution:\n%s", limb_joints)
109108
rospy.loginfo("------------------")
110109
rospy.loginfo("Response Message:\n%s", resp)

intera_examples/scripts/joint_position_file_playback.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,12 +39,12 @@ def clean_line(line, names):
4039
#convert the line of strings to a float or None
4140
line = [try_float(x) for x in line.rstrip().split(',')]
4241
#zip the values with the joint names
43-
combined = zip(names[1:], line[1:])
42+
combined = list(zip(names[1:], line[1:]))
4443
#take out any tuples that have a none value
4544
cleaned = [x for x in combined if x[1] is not None]
4645
#convert it to a dictionary with only valid commands
4746
command = dict(cleaned)
48-
right_command = dict((key, command[key]) for key in command.keys()
47+
right_command = dict((key, command[key]) for key in list(command.keys())
4948
if key[:-2] == 'right_')
5049
return (command, right_command, line)
5150

@@ -64,10 +63,10 @@ def map_file(filename, limb, loops=1):
6463
first column is the time stamp
6564
"""
6665
limb_interface = intera_interface.Limb(limb)
67-
has_gripper = True
66+
has_gripper = False
6867
try:
6968
gripper = intera_interface.Gripper(limb + '_gripper')
70-
except ValueError:
69+
except:
7170
has_gripper = False
7271
rospy.loginfo("Could not detect a gripper attached to the robot")
7372

@@ -109,7 +108,7 @@ def map_file(filename, limb, loops=1):
109108
if has_gripper and gripper.name in cmd:
110109
gripper.set_position(cmd[gripper.name])
111110
rate.sleep()
112-
print
111+
print()
113112
return True
114113

115114
def main():

intera_examples/scripts/joint_position_joystick.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/joint_position_keyboard.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -98,7 +97,7 @@ def set_g(action):
9897
print("key bindings: ")
9998
print(" Esc: Quit")
10099
print(" ?: Help")
101-
for key, val in sorted(bindings.items(),
100+
for key, val in sorted(list(bindings.items()),
102101
key=lambda x: x[1][2]):
103102
print(" %s: %s" % (key, val[2]))
104103

intera_examples/scripts/joint_position_waypoints.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/joint_recorder.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/joint_torque_springs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#! /usr/bin/env python
22

33
# Copyright (c) 2013-2018, Rethink Robotics Inc.
44
#
@@ -89,7 +89,7 @@ def _update_forces(self):
8989
cur_pos = self._limb.joint_angles()
9090
cur_vel = self._limb.joint_velocities()
9191
# calculate current forces
92-
for joint in self._start_angles.keys():
92+
for joint in list(self._start_angles.keys()):
9393
# spring portion
9494
cmd[joint] = self._springs[joint] * (self._start_angles[joint] -
9595
cur_pos[joint])

intera_examples/scripts/joint_trajectory_client.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

intera_examples/scripts/joint_trajectory_file_playback.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -135,7 +134,7 @@ def try_float(x):
135134
#convert the line of strings to a float or None
136135
line = [try_float(x) for x in line.rstrip().split(',')]
137136
#zip the values with the joint names
138-
combined = zip(joint_names[1:], line[1:])
137+
combined = list(zip(joint_names[1:], line[1:]))
139138
#take out any tuples that have a none value
140139
cleaned = [x for x in combined if x[1] is not None]
141140
#convert it to a dictionary with only valid commands
@@ -189,10 +188,10 @@ def find_start_offset(pos):
189188
cur.append(self.arm.joint_angle(name))
190189
prm = rospy.get_param(vel_param % name, 0.25)
191190
dflt_vel.append(prm)
192-
diffs = map(operator.sub, cmd, cur)
193-
diffs = map(operator.abs, diffs)
191+
diffs = list(map(operator.sub, cmd, cur))
192+
diffs = list(map(operator.abs, diffs))
194193
#determine the largest time offset necessary across all joints
195-
offset = max(map(operator.div, diffs, dflt_vel))
194+
offset = max(list(map(operator.div, diffs, dflt_vel)))
196195
return offset
197196

198197
for idx, values in enumerate(lines[1:]):

intera_examples/scripts/joint_velocity_wobbler.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -54,7 +53,7 @@ def __init__(self):
5453

5554
def _reset_control_modes(self):
5655
rate = rospy.Rate(self._rate)
57-
for _ in xrange(100):
56+
for _ in range(100):
5857
if rospy.is_shutdown():
5958
return False
6059
self._right_arm.exit_control_mode()
@@ -105,7 +104,7 @@ def make_cmd(joint_names, elapsed):
105104

106105
print("Wobbling. Press Ctrl-C to stop...")
107106
while not rospy.is_shutdown():
108-
self._pub_rate.publish(self._rate)
107+
self._pub_rate.publish(int(self._rate))
109108
elapsed = rospy.Time.now() - start
110109
cmd = make_cmd(self._right_joint_names, elapsed)
111110
self._right_arm.set_joint_velocities(cmd)

intera_examples/scripts/lights_blink.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
1+
#! /usr/bin/env python
32
# Copyright (c) 2013-2018, Rethink Robotics Inc.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)