Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic python changes for Noetic #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.0.5)
project(baxter_tools)

find_package(catkin
Expand Down Expand Up @@ -26,11 +26,21 @@ catkin_package(
baxter_maintenance_msgs
)

install(
DIRECTORY scripts/
catkin_install_python(PROGRAMS
scripts/calibrate_arm.py
scripts/camera_control.py
scripts/enable_robot.py
scripts/smoke_test.py
scripts/tare.py
scripts/tuck_arms.py
scripts/update_robot.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
USE_SOURCE_PERMISSIONS
)
)
# install(
# DIRECTORY scripts/
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# USE_SOURCE_PERMISSIONS
# )

install(
DIRECTORY share/
Expand Down
4 changes: 2 additions & 2 deletions scripts/calibrate_arm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python

# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
Expand Down Expand Up @@ -101,7 +101,7 @@ def main():
error = None
try:
cat.run()
except Exception, e:
except Exception as e:
error = e.strerror
finally:
try:
Expand Down
2 changes: 1 addition & 1 deletion scripts/camera_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python

# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions scripts/enable_robot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python

# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
Expand Down Expand Up @@ -67,7 +67,7 @@ def main():
try:
for act in args.actions:
if act == 'state':
print rs.state()
print (rs.state())
elif act == 'enable':
rs.enable()
elif act == 'disable':
Expand All @@ -76,7 +76,7 @@ def main():
rs.reset()
elif act == 'stop':
rs.stop()
except Exception, e:
except Exception as e:
rospy.logerr(e.strerror)

return 0
Expand Down
4 changes: 2 additions & 2 deletions scripts/tare.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python

# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
Expand Down Expand Up @@ -102,7 +102,7 @@ def main():
error = None
try:
tt.run()
except Exception, e:
except Exception as e:
error = e.strerror
finally:
try:
Expand Down
2 changes: 1 addition & 1 deletion scripts/tuck_arms.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _move_to(self, tuck, disabled):
if any(disabled.values()):
[pub.publish(Empty()) for pub in self._disable_pub.values()]
while (any(self._arm_state['tuck'][limb] != goal
for limb, goal in tuck.viewitems())
for limb, goal in tuck.items())
and not rospy.is_shutdown()):
if self._rs.state().enabled == False:
self._enable_pub.publish(True)
Expand Down
12 changes: 6 additions & 6 deletions scripts/update_robot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python

# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
Expand Down Expand Up @@ -164,9 +164,9 @@ def on_shutdown():

try:
updater.command_update(uuid)
except OSError, e:
except OSError as e:
if e.errno == errno.EINVAL:
print e.strerror
print (e.strerror)
return 1
raise

Expand All @@ -176,9 +176,9 @@ def on_shutdown():
timeout=5 * 60,
timeout_msg="Timeout waiting for update to succeed"
)
except Exception, e:
except Exception as e:
if not (hasattr(e, 'errno') and e.errno == errno.ESHUTDOWN):
print e.strerror
print (e.strerror)
nl.rc = 1

return nl.rc
Expand Down Expand Up @@ -266,7 +266,7 @@ def main():
return 0
elif cmd == 'update':
if uuid == '':
print "Error: no update uuid specified"
print ("Error: no update uuid specified")
return 1
msg = ("NOTE: Please plug in any Rethink Electric Parallel Grippers\n"
" into the robot now, so that the Gripper Firmware\n"
Expand Down