diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e4be64..56b5714 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.0.5) project(baxter_tools) find_package(catkin @@ -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/ diff --git a/scripts/calibrate_arm.py b/scripts/calibrate_arm.py index d5257c6..f93fff6 100755 --- a/scripts/calibrate_arm.py +++ b/scripts/calibrate_arm.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python # Copyright (c) 2013-2015, Rethink Robotics # All rights reserved. @@ -101,7 +101,7 @@ def main(): error = None try: cat.run() - except Exception, e: + except Exception as e: error = e.strerror finally: try: diff --git a/scripts/camera_control.py b/scripts/camera_control.py index f69d6e3..b8bc26d 100755 --- a/scripts/camera_control.py +++ b/scripts/camera_control.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python # Copyright (c) 2013-2015, Rethink Robotics # All rights reserved. diff --git a/scripts/enable_robot.py b/scripts/enable_robot.py index 3d73156..ea9f179 100755 --- a/scripts/enable_robot.py +++ b/scripts/enable_robot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python # Copyright (c) 2013-2015, Rethink Robotics # All rights reserved. @@ -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': @@ -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 diff --git a/scripts/tare.py b/scripts/tare.py index b230ccf..fdcfef0 100755 --- a/scripts/tare.py +++ b/scripts/tare.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python # Copyright (c) 2013-2015, Rethink Robotics # All rights reserved. @@ -102,7 +102,7 @@ def main(): error = None try: tt.run() - except Exception, e: + except Exception as e: error = e.strerror finally: try: diff --git a/scripts/tuck_arms.py b/scripts/tuck_arms.py index f123f8c..64ea622 100755 --- a/scripts/tuck_arms.py +++ b/scripts/tuck_arms.py @@ -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) diff --git a/scripts/update_robot.py b/scripts/update_robot.py index 70c1cac..4ceb245 100755 --- a/scripts/update_robot.py +++ b/scripts/update_robot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python # Copyright (c) 2013-2015, Rethink Robotics # All rights reserved. @@ -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 @@ -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 @@ -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"