diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 09a709585b..d43bcbac2f 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -38,11 +38,16 @@ jobs: - ROS_DISTRO: noetic CONTAINER: jskrobotics/ros-ubuntu:20.04-pcl EXTRA_DEB : "python3-rospkg python3-rospkg-modules" # drc_task_common need rospkg, but not installed + USE_DEB : false container: ${{ matrix.CONTAINER }} steps: - name: Install latest git ( use sudo for ros-ubuntu ) run: | + # https://github.com/osrf/docker_images/issues/697#issuecomment-1819626877 + sudo apt-key del 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA || echo "OK" + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA || echo "OK" + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys AD19BAB3CBF125EA || echo "OK" [ -e /etc/apt/sources.list.d/ubuntu-esm-infra-$(lsb_release -cs).list ] && sudo rm /etc/apt/sources.list.d/ubuntu-esm-infra-$(lsb_release -cs).list ## fix Err https://esm.ubuntu.com trusty-infra-security/main amd64 Packages, gnutls_handshake() failed: Handshake failed (apt-get update && apt-get install -y sudo) || echo "OK" sudo apt-get update diff --git a/.travis.rosinstall.noetic b/.travis.rosinstall.noetic new file mode 100644 index 0000000000..c68eca523b --- /dev/null +++ b/.travis.rosinstall.noetic @@ -0,0 +1,5 @@ +# this should be removed after updating .rosinstall for each robot +- git: + local-name: jsk_planning + uri: https://github.com/jsk-ros-pkg/jsk_planning.git + version: master diff --git a/elevator_move_base_pr2/src/matchtemplate.py b/elevator_move_base_pr2/src/matchtemplate.py index 3914e6f1cc..cf0cb8bce4 100755 --- a/elevator_move_base_pr2/src/matchtemplate.py +++ b/elevator_move_base_pr2/src/matchtemplate.py @@ -65,8 +65,8 @@ def process_msg (): try: cv_image = imgmsg_to_cv(msg, "mono8") - except CvBridgeError, e: - print e + except CvBridgeError as e: + print(e) reslist = [] for template in templates: @@ -94,7 +94,7 @@ def process_msg (): reslist += [(tempname,(status[1],status[3],tempthre,found))] if found : result.data += tempname+' ' - print reslist + print(reslist) result_pub.publish(result) publish_debug(cv_image, reslist) @@ -120,7 +120,7 @@ def publish_debug(img, results): #cv.PutText(output, tempname, (0,size[1]-16), font, cv.CV_RGB(255,255,255)) #cv.PutText(output, str(tempthre)+'<'+str(status[1]), (0,size[1]-8), font, cv.CV_RGB(255,255,255)) for _,status in [s for s in results if s[0] == template[3]]: - print status + print(status) cv.PutText(output, template[3], (0,size[1]-42), font, cv.CV_RGB(255,255,255)) cv.PutText(output, "%7.5f"%(status[0]), (0,size[1]-24), font, cv.CV_RGB(255,255,255)) cv.PutText(output, "%7.5f"%(status[2]), (0,size[1]-8), font, cv.CV_RGB(255,255,255)) diff --git a/elevator_move_base_pr2/test/test-color-point-detector.py b/elevator_move_base_pr2/test/test-color-point-detector.py index 3f5b35cc5f..9e7e8bfd83 100755 --- a/elevator_move_base_pr2/test/test-color-point-detector.py +++ b/elevator_move_base_pr2/test/test-color-point-detector.py @@ -10,7 +10,7 @@ ## A sample python unit test class TestColorPointDetector(unittest.TestCase): def callback(self, msg): - print "msg.data = ", msg.data, " should be 1.5" + print("msg.data = ", msg.data, " should be 1.5") self.assert_( abs( msg.data - 1.5 ) < 0.1 ) def test_light_button(self): diff --git a/jsk_2013_04_pr2_610/euslisp/put-cloth-into-laundry.l b/jsk_2013_04_pr2_610/euslisp/put-cloth-into-laundry.l index a5d73669d4..3c4b61462b 100644 --- a/jsk_2013_04_pr2_610/euslisp/put-cloth-into-laundry.l +++ b/jsk_2013_04_pr2_610/euslisp/put-cloth-into-laundry.l @@ -10,6 +10,21 @@ (load "package://jsk_demo_common/euslisp/pr2-action.l") (load "package://jsk_2013_04_pr2_610/euslisp/objectdetection.l") +;; use simple boundingbox for :gripper :link, to avoid 'error: float vector expected in (convex-hull-3d ...' +(unless (assoc :gripper-org (send pr2-robot :methods)) + (rplaca (assoc :gripper (send pr2-robot :methods)) :gripper-org)) +(defmethod pr2-robot + (:gripper + (limb &rest args) + (cond + ((memq :links args) + (let (vert-list) + (setq vert-list (list (flatten (send-all (flatten (send-all (send self :gripper-org limb :links) :bodies)) :vertices)))) + (mapcar #'(lambda (v) (instance bodyset-link :init (make-cascoords) :bodies (list (send (make-bounding-box v) :body)))) vert-list) + )) + (t + (send* self :gripper-org limb args) + )))) (ros::roseus "laundry_button_marker_publisher") (ros::advertise *pub-laundry-button-topic* visualization_msgs::Marker 5) @@ -332,4 +347,4 @@ (defun push-button-laundry () (warn "There is Nothing to do at func:push-button-laundry") t - ) \ No newline at end of file + ) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_client.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_client.py index f880729d8d..b36af00652 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_client.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_client.py @@ -193,7 +193,7 @@ def b_control_joy_cb(msg): # erase_all_marker() try: ik_arm = get_ik_arm_srv().ik_arm - except rospy.ServiceException, e: + except rospy.ServiceException as e: ik_arm = ":rarm" end_effector_pose=Pose(orientation=Quaternion(x=0.0, y=0.0, z=0.0, w=1.0)) if (ik_arm==":rarm"): @@ -368,8 +368,8 @@ def selected_box_cb(msg, points_msg): set_dim_srv(dimensions=resp1.dim) rospy.loginfo("icp succeeded") return - except rospy.ServiceException, e: - print "ICP Service call failed: %s"%e + except rospy.ServiceException as e: + print("ICP Service call failed: %s"%e) # pose selected_only_box_cb(msg) def marker_info_cb(msg): @@ -465,15 +465,15 @@ def erase_all_marker_cb(req): def insert_marker(shape_type=TransformableMarkerOperate.BOX, name='default_name', description='default_description', mesh_resource='', mesh_use_embedded_materials=False): try: req_marker_operate_srv(TransformableMarkerOperate(type=shape_type, action=TransformableMarkerOperate.INSERT, frame_id=default_frame_id, name=name, description=description, mesh_resource=mesh_resource, mesh_use_embedded_materials=mesh_use_embedded_materials)) - except rospy.ServiceException, e: - print 'insert_marker service call failed: %s'%e + except rospy.ServiceException as e: + print('insert_marker service call failed: %s'%e) def erase_all_marker(): try: req_marker_operate_srv(TransformableMarkerOperate(type=TransformableMarkerOperate.BOX, action=TransformableMarkerOperate.ERASEALL)) - except rospy.ServiceException, e: - print 'insert_marker service call failed: %s'%e + except rospy.ServiceException as e: + print('insert_marker service call failed: %s'%e) if __name__ == '__main__': b_control_client_init() diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_dummy_server.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_dummy_server.py index 4e0e766a3b..07d7d38bac 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_dummy_server.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/b_control_dummy_server.py @@ -49,7 +49,7 @@ def reconfigure_callback(self, config, level): return config def pub_joy(self): - print self.joy + print(self.joy) self.joy_pub.publish(self.joy) def u1_cb(self, req): self.joy.axes[8] = reverse_f(self.joy.axes[8]) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/calc_drive_tf.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/calc_drive_tf.py index e7579cb894..558db08703 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/calc_drive_tf.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/calc_drive_tf.py @@ -35,8 +35,8 @@ def pose_cb(pose_msg): try: transed_pose = listener.transformPose("BODY", pose_msg) - except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException), e: - print "tf error: %s" % e + except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException) as e: + print("tf error: %s" % e) return trans.header = transed_pose.header trans.child_frame_id = "handle" diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_data.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_data.py index 81f82bcee3..1fcaf26bc5 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_data.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_data.py @@ -22,7 +22,7 @@ def save_cb(float_msg): global flug if flug: - print "save cb driven %s" % flug + print("save cb driven %s" % flug) spamWriter.writerow([flug]+list(float_msg.data)) flug = None if __name__ == "__main__": @@ -35,7 +35,7 @@ def save_cb(float_msg): if(input_string == "exit"): exit() if(not input_string.isdigit()): - print "input num only" + print("input num only") next flug = input_string time.sleep(1) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_decision.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_decision.py index d3cf56e70b..5e20da8b03 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_decision.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/fft_decision.py @@ -21,13 +21,13 @@ def load_data(filename): Y.append([float(x) for x in row[1:]]) return (X, Y) def disc_cb(msg): - print clf.predict(msg.data) + print(clf.predict(msg.data)) if __name__ == "__main__": rospy.init_node('fft_data', anonymous=True) x, y = load_data("fft_data.csv") - print "tests" - print x - print y + print("tests") + print(x) + print(y) clf = svm.SVC(kernel="rbf") clf.fit(y, x) rospy.Subscriber("input", Float32ArrayStamped, disc_cb) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/front_plane_extractor.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/front_plane_extractor.py index 6797385b27..d658614ed2 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/front_plane_extractor.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/front_plane_extractor.py @@ -8,7 +8,7 @@ import tf def callback(polygon_msg, coeff_msg): - print "callback" + print("callback") # odom->ground max_val = -1.0; max_index = None diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/gen_hosts.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/gen_hosts.py index 38cab4dafc..aedeabb296 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/gen_hosts.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/gen_hosts.py @@ -3,7 +3,7 @@ import sys def usage(): - print "gen_hosts.py TEAM_NO(13) MY_HOSTNAME(fc20)" + print("gen_hosts.py TEAM_NO(13) MY_HOSTNAME(fc20)") def gen_hosts(team_no, my_hostname): hosts_str =""" @@ -21,7 +21,7 @@ def gen_hosts(team_no, my_hostname): ocs_hostnames = "\n".join(["10.%s.2.%s ocs%s" % (team_no, i, i) for i in range(10, 255) if not "ocs%s" % i == my_hostname]) - print hosts_str % (my_hostname, fc_hostnames, ocs_hostnames) + print(hosts_str % (my_hostname, fc_hostnames, ocs_hostnames)) if __name__ == "__main__": diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/hand_box_publisher.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/hand_box_publisher.py index 12ec1424f1..59423e9689 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/hand_box_publisher.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/hand_box_publisher.py @@ -25,8 +25,8 @@ try: listener.waitForTransform('left_camera_optical_frame', pose_stamped.header.frame_id, now, rospy.Duration(1)) transed_pose = listener.transformPose('left_camera_optical_frame', pose_stamped) - except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException, tf.Exception), e: - print "tf error: %s" % e + except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException, tf.Exception) as e: + print("tf error: %s" % e) r.sleep() continue box = BoundingBox(Header(stamp=rospy.Time.now(), frame_id='left_camera_optical_frame'), transed_pose.pose, Vector3(0.15, 0.15, 0.32)) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/imprecise_scheduler.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/imprecise_scheduler.py index 9b0c0da849..67d0b4689c 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/imprecise_scheduler.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/imprecise_scheduler.py @@ -80,7 +80,7 @@ def error_func(steps): initial_speed_factor = 5 steps = args.distance / 0.2 distance_factor = error_func(steps) - print >> sys.stderr, "distance_factor:", distance_factor + print("distance_factor:", distance_factor, file=sys.stderr) p0_table = QualityTable("q_{p0}", "package://drc_task_common/profile_data/recognition/valve_detection.csv", args.p0 * distance_factor) m0_table = QualityTable("q_{m0}", "package://drc_task_common/profile_data/motion/jaxon_valve_ik_stand2_average_mono.csv", args.m0 * distance_factor) m0_all_table = QualityTable("q_{m0}", "package://drc_task_common/profile_data/motion/jaxon_valve_ik_stand2_average.csv", args.m0 * distance_factor) @@ -101,7 +101,7 @@ def error_func(steps): args.m0 = 0.1 args.p1 = 1.0 args.m1 = 1.0 - print >> sys.stderr, "distance_factor:", distance_factor + print("distance_factor:", distance_factor, file=sys.stderr) p0_table = QualityTable("q_{p0}", "package://drc_task_common/profile_data/recognition/valve_detection.csv", args.p0 * distance_factor) p1_table = QualityTable("q_{p1}", "package://drc_task_common/profile_data/recognition/valve_detection.csv", 1.0) m0_table = QualityTable("q_{m0}", "package://drc_task_common/profile_data/motion/jaxon_valve_ik_stand2_average_mono.csv", args.m0 * distance_factor) @@ -129,7 +129,7 @@ def error_func(steps): args.m0 = 0.2 args.p1 = 1.0 args.m1 = 0.5 - print >> sys.stderr, "distance_factor:", distance_factor + print("distance_factor:", distance_factor, file=sys.stderr) p0_table = QualityTable("q_{p0}", "package://drc_task_common/profile_data/recognition/door_detection.csv", args.p0 * distance_factor) p1_table = QualityTable("q_{p1}", "package://drc_task_common/profile_data/recognition/door_detection.csv", 1.0) m0_table = QualityTable("q_{m0}", "package://drc_task_common/profile_data/motion/jaxon_door_ik_stand2_average_mono.csv", args.m0 * distance_factor) @@ -153,7 +153,7 @@ def error_func(steps): initial_speed_factor = 5 steps = args.distance / 0.2 distance_factor = error_func(steps) - print >> sys.stderr, "distance_factor:", distance_factor + print("distance_factor:", distance_factor, file=sys.stderr) p0_table = QualityTable("q_{p0}", "package://drc_task_common/profile_data/recognition/door_detection.csv", args.p0 * distance_factor) m0_table = QualityTable("q_{m0}", "package://drc_task_common/profile_data/motion/jaxon_door_ik_stand2_average_mono.csv", args.m0 * distance_factor) m0_all_table = QualityTable("q_{m0}", "package://drc_task_common/profile_data/motion/jaxon_door_ik_stand2_average.csv", args.m0 * distance_factor) @@ -262,7 +262,7 @@ def error_func(steps): break container.draw(ax) if args.save_img: - print 'image_{0:0>3}.png'.format(counter) + print('image_{0:0>3}.png'.format(counter)) plt.savefig('image_{0:0>3}.png'.format(counter)) counter = counter + 1 if args.incremental: diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/joy_to_twist.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/joy_to_twist.py index e1f8dcc034..1bb8214300 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/joy_to_twist.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/joy_to_twist.py @@ -56,7 +56,7 @@ def joy_cb(msg): factor_flag_b = True if factor < 0.6: factor*=1.2 - print "factor: %f" % factor + print("factor: %f" % factor) else: factor_flag_b = False @@ -65,7 +65,7 @@ def joy_cb(msg): factor_flag_s = True if factor > 0.01: factor/=1.2 - print "factor: %f" % factor + print("factor: %f" % factor) else: factor_flag_s = False if msg.buttons[8]: diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/move_marker_with_point.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/move_marker_with_point.py index a5ea426b7e..48a132c939 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/move_marker_with_point.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/move_marker_with_point.py @@ -17,19 +17,19 @@ def point_cb(point_msg): try: pose = get_pose("").pose_stamped - except rospy.ServiceException, e: - print "Service fail: %s" % e + except rospy.ServiceException as e: + print("Service fail: %s" % e) return try: transed_point = listener.transformPoint(pose.header.frame_id, point_msg) pose.pose.position = transed_point.point - except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException), e: - print "tf error: %s" % e + except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException) as e: + print("tf error: %s" % e) return try: set_pose(target_name="", pose_stamped=pose) - except rospy.ServiceException, e: - print "Service fail: %s" % e + except rospy.ServiceException as e: + print("Service fail: %s" % e) return if __name__ == "__main__": diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/ocs_reconfigure.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/ocs_reconfigure.py index 66ec474a63..34567a35da 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/ocs_reconfigure.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/ocs_reconfigure.py @@ -5,4 +5,4 @@ from drc_task_common.cfg import DRCParametersConfig for (name, type) in DRCParametersConfig.type.items(): - print name, type + print(name, type) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/request_handle_marker.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/request_handle_marker.py index f66328df30..583137179c 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/request_handle_marker.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/request_handle_marker.py @@ -20,15 +20,15 @@ def request_handle_marker(): handle_request = rospy.ServiceProxy('/drive/handle_server/request_marker_operate', RequestMarkerOperate) try: handle_request(jsk_rviz_plugins.msg.TransformableMarkerOperate(2, 0, "BODY", "handle_marker", "")) - except rospy.ServiceException, e: - print "Service fail: %s" % e + except rospy.ServiceException as e: + print("Service fail: %s" % e) return rospy.wait_for_service("/drive/handle_server/set_dimensions") handle_size_request = rospy.ServiceProxy('/drive/handle_server/set_dimensions', SetMarkerDimensions) try: handle_size_request("", jsk_interactive_marker.msg.MarkerDimensions(0, 0, 0, 0.14, 0.01, 0)) - except rospy.ServiceException, e: - print "Service fail: %s" % e + except rospy.ServiceException as e: + print("Service fail: %s" % e) return diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/Magnetometer2Direction.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/Magnetometer2Direction.py index 67b0c7c590..fd9623342b 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/Magnetometer2Direction.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/Magnetometer2Direction.py @@ -19,7 +19,7 @@ def __init__(self): try: self.offset_ang = float(self.argv[1]) * pi / 180 except: - print "DATA(1st Argument) Should Be Float, So Default (0.0) Is Used." + print("DATA(1st Argument) Should Be Float, So Default (0.0) Is Used.") self.offset_ang = 0.0 else: self.offset_ang = 0.0 diff --git a/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/car_path_visualizer.py b/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/car_path_visualizer.py index 7db9675483..f41cef7980 100755 --- a/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/car_path_visualizer.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/scripts/vehicle/car_path_visualizer.py @@ -41,8 +41,8 @@ def execute(self): self.R = quaternion_matrix(quat)[0:3,0:3] # print self.R self.marker_publisher() - except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException), e: - print "tf error: %s" % e + except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException) as e: + print("tf error: %s" % e) pass self.r.sleep() diff --git a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/drc_teleop_interface.py b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/drc_teleop_interface.py index be2be1670e..30c689834e 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/drc_teleop_interface.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/drc_teleop_interface.py @@ -24,8 +24,8 @@ def __init__(self, context): help="Put plugin in silent mode") args, unknowns = parser.parse_known_args(context.argv()) if not args.quiet: - print 'arguments: ', args - print 'unknowns: ', unknowns + print('arguments: ', args) + print('unknowns: ', unknowns) # Create QWidget self._widget = QWidget() @@ -106,44 +106,44 @@ def __init__(self, context): # Robot Pose Button Callback def reset_pose_cb(self, checked): eus_commmand_srv(command='(send *ri* :angle-vector (send *robot* :reset-pose) 5000)') - print 'send reset_pose command' + print('send reset_pose command') def reset_manip_pose_cb(self, checked): eus_commmand_srv(command='(send *ri* :angle-vector (send *robot* :reset-manip-pose) 5000)') - print 'send reset_manip_pose command' + print('send reset_manip_pose command') def init_pose_cb(self, checked): eus_commmand_srv(command='(send *ri* :angle-vector (send *robot* :init-pose) 5000)') - print 'send init_pose command' + print('send init_pose command') # Hand Pose Button Callback def hand_reset_pose_cb(self, checked): eus_commmand_srv(command='(progn (send *robot* :hand :arms :reset-pose) (send *ri* :hand-angle-vector (apply #\'concatenate float-vector (send *robot* :hand :arms :angle-vector))))') - print 'send hand_reset_pose command' + print('send hand_reset_pose command') def hand_hook_pose_cb(self, checked): eus_commmand_srv(command='(progn (send *robot* :hand :arms :hook-pose) (send *ri* :hand-angle-vector (apply #\'concatenate float-vector (send *robot* :hand :arms :angle-vector))))') - print 'send hand_hook_pose command' + print('send hand_hook_pose command') def hand_grasp_pose_cb(self, checked): eus_commmand_srv(command='(progn (send *robot* :hand :arms :grasp-pose) (send *ri* :hand-angle-vector (apply #\'concatenate float-vector (send *robot* :hand :arms :angle-vector))))') - print 'send hand_grasp_pose command' + print('send hand_grasp_pose command') # Hrpsys Button Callback def hrpsys_start_abc_cb(self, checked): eus_commmand_srv(command='(send *ri* :start-auto-balancer)') - print 'send hrpsys_start_abc command' + print('send hrpsys_start_abc command') def hrpsys_start_st_cb(self, checked): eus_commmand_srv(command='(send *ri* :start-st)') - print 'send hrpsys_start_st command' + print('send hrpsys_start_st command') def hrpsys_start_imp_cb(self, checked): eus_commmand_srv(command='(send *ri* :start-impedance :arms)') - print 'send hrpsys_start_imp command' + print('send hrpsys_start_imp command') def hrpsys_stop_abc_cb(self, checked): eus_commmand_srv(command='(send *ri* :stop-auto-balancer)') - print 'send hrpsys_stop_abc command' + print('send hrpsys_stop_abc command') def hrpsys_stop_st_cb(self, checked): eus_commmand_srv(command='(send *ri* :stop-st)') - print 'send hrpsys_stop_st command' + print('send hrpsys_stop_st command') def hrpsys_stop_imp_cb(self, checked): eus_commmand_srv(command='(send *ri* :stop-impedance :arms)') - print 'send hrpsys_stop_imp command' + print('send hrpsys_stop_imp command') def shutdown_plugin(self): eus_commmand_srv.close() diff --git a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/optimization_container.py b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/optimization_container.py index 39eed25a26..d5c24463a5 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/optimization_container.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/optimization_container.py @@ -166,31 +166,31 @@ def proc(self): # print "choose", min_table.name return True def printOverview2Column(self): - print "time,q" + print("time,q") def printOverview2(self, deadline): - print "{0},{1}".format(self.current_time(), self.current_q()) + print("{0},{1}".format(self.current_time(), self.current_q())) def printOverview(self, deadline): - print "initial condition:" - print " all time:", self.initial_time() - print " all q:", self.initial_q() + print("initial condition:") + print(" all time:", self.initial_time()) + print(" all q:", self.initial_q()) for t, s in zip(self.tables, self.initial_times): - print " " + t.name - print " time:", s - print " q:", t.time2q(s) + print(" " + t.name) + print(" time:", s) + print(" q:", t.time2q(s)) for p in t.other_params(): - print " {0}: {1}".format(p, t.lookup_value("time",s, p)) - print "deadline time:", deadline - print "minimum time:", sum([t.min_time() for t in self.tables]) - print "final result:" - print " all time:", self.current_time() - print " all q:", self.current_q() - print " rel q", self.current_q() / self.max_q() + print(" {0}: {1}".format(p, t.lookup_value("time",s, p))) + print("deadline time:", deadline) + print("minimum time:", sum([t.min_time() for t in self.tables])) + print("final result:") + print(" all time:", self.current_time()) + print(" all q:", self.current_q()) + print(" rel q", self.current_q() / self.max_q()) for t, s in zip(self.tables, self.current_times): - print " " + t.name - print " time:", s - print " q:", t.time2q(s) + print(" " + t.name) + print(" time:", s) + print(" q:", t.time2q(s)) for p in t.other_params(): - print " {0}: {1}".format(p, t.lookup_value("time",s, p)) + print(" {0}: {1}".format(p, t.lookup_value("time",s, p))) def draw(self, ax): if self.no_gui and not self.save_img: return diff --git a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/robot_head_ui.py b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/robot_head_ui.py index e910d395b3..0835fbf31b 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/robot_head_ui.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/robot_head_ui.py @@ -36,7 +36,7 @@ def __init__(self): self.lock = Lock() try: robot_model = URDF.from_xml_string(rospy.get_param("/robot_description")) - except Exception, e: + except Exception as e: self.showError("Failed to load /robot_description: " + e.message) return # Parse urdf @@ -47,7 +47,7 @@ def __init__(self): self.yaw_lower = rad2deg(yaw_joint.limit.lower) self.pitch_upper = rad2deg(pitch_joint.limit.upper) self.pitch_lower = rad2deg(pitch_joint.limit.lower) - except Exception, e: + except Exception as e: self.showError("Failed to load correct min/max joint angles: " + e.message) return vsplitter = QtGui.QSplitter(QtCore.Qt.Vertical) diff --git a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/vehicle_ui.py b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/vehicle_ui.py index b8ad6d94d2..07c2161dd1 100644 --- a/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/vehicle_ui.py +++ b/jsk_2015_06_hrp_drc/drc_task_common/src/drc_task_common/vehicle_ui.py @@ -85,20 +85,20 @@ def serviceEmptyImpl(self, name): srv = rospy.ServiceProxy(name, Empty) try: srv() - except rospy.ServiceException, e: + except rospy.ServiceException as e: self.showError("Failed to call %s" % name) def synchronizeJoyController(self, target): try: sync_joy = rospy.ServiceProxy('drive/operation/synchronize', StringRequest) sync_joy(target) - except rospy.ServiceException, e: + except rospy.ServiceException as e: self.showError("Failed to call drive/operation/synchronize " + target) def setControllerMode(self, target, mode): try: update_mode = rospy.ServiceProxy("drive/controller/set_" + target + "_mode", StringRequest) update_mode(mode) - except rospy.ServiceException, e: + except rospy.ServiceException as e: self.showError("drive/controller/set_" + target + "_mode") def handleModeClickedCallback(self, item): @@ -789,7 +789,7 @@ def callSetValueService(self, service_name, value): update_value = rospy.ServiceProxy(service_name, SetValue) next_value = update_value(value) return next_value.set_value - except rospy.ServiceException, e: + except rospy.ServiceException as e: self.showError("Failed to call " + service_name) return None @@ -798,7 +798,7 @@ def callUint8RequestService(self, service_name, value): update_value = rospy.ServiceProxy(service_name, Uint8Request) update_value(value) return - except rospy.ServiceException, e: + except rospy.ServiceException as e: self.showError("Failed to call " + service_name) return diff --git a/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/DriveCmdPublisher.py b/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/DriveCmdPublisher.py index dd920bcd7c..14c20c0a36 100755 --- a/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/DriveCmdPublisher.py +++ b/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/DriveCmdPublisher.py @@ -16,8 +16,8 @@ def __init__(self): elif self.argc == 4: self.time_flag = True else: - print "The Number of Command-Line Arguments Is Unsuitable" - print "Usage: ./DriveCmdPublisher.py TYPE DATA (TIME)" + print("The Number of Command-Line Arguments Is Unsuitable") + print("Usage: ./DriveCmdPublisher.py TYPE DATA (TIME)") sys.exit(1) # argv[1] is the type of topic @@ -36,14 +36,14 @@ def __init__(self): rospy.init_node("drive_steering_publisher", anonymous=True) self.pub = rospy.Publisher("/drc_vehicle_xp900/hand_wheel/cmd", Float64, queue_size=10) else: - print "TYPE(1st Argument) Means \"a\"(Accelerator Pedal), \"b\"(Brake Pedal), \"d\"(Direction Gear) or \"h\" (Steering Wheel)" + print("TYPE(1st Argument) Means \"a\"(Accelerator Pedal), \"b\"(Brake Pedal), \"d\"(Direction Gear) or \"h\" (Steering Wheel)") sys.exit(1) # argv[2] is the data the topic has try: self.data = float(self.argv[2]) except: - print "DATA(2nd Argument) Should Be Float Type" + print("DATA(2nd Argument) Should Be Float Type") sys.exit(1) # argv[3] is the time @@ -51,7 +51,7 @@ def __init__(self): try: self.pub_time = float(self.argv[3]) except: - print "TIME(3rd Argument) Should Be Float Type" + print("TIME(3rd Argument) Should Be Float Type") sys.exit(1) self.r = rospy.Rate(30) # 30hz @@ -86,7 +86,7 @@ def cmd_publisher(self): pub_msg = 0.0 self.pub_finish.publish(pub_msg) else: - print "Publish %s For %f Seconds & Publish b For 1.5 Seconds" % (self.argv[1], self.pub_time) + print("Publish %s For %f Seconds & Publish b For 1.5 Seconds" % (self.argv[1], self.pub_time)) sys.exit(0) else: pub_msg = Float64() @@ -106,7 +106,7 @@ def callback_obstacle_stop(self, msg): pub_msg = Float64() pub_msg = 0.0 self.pub.publish(pub_msg) - print "Obstacle Detection Activated!!" + print("Obstacle Detection Activated!!") sys.exit(0) if __name__ == '__main__': diff --git a/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/atlas_look_around.py b/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/atlas_look_around.py index 1478b93393..5a2228081b 100644 --- a/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/atlas_look_around.py +++ b/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/atlas_look_around.py @@ -20,7 +20,7 @@ def jointTrajectoryCommandCallback(msg): with lock: if currentJointState == None: - print "/atlas/joint_states is not published" + print("/atlas/joint_states is not published") return atlasJointNames = [ diff --git a/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/traj_yaml.py b/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/traj_yaml.py index 22b2a566bb..6377b27d57 100755 --- a/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/traj_yaml.py +++ b/jsk_2015_06_hrp_drc/gazebo_drive_simulator/src/traj_yaml.py @@ -28,13 +28,13 @@ def jointStatesCallback(msg): if __name__ == '__main__': # first make sure the input arguments are correct if len(sys.argv) != 3: - print "usage: traj_yaml.py YAML_FILE TRAJECTORY_NAME" - print " where TRAJECTORY is a dictionary defined in YAML_FILE" + print("usage: traj_yaml.py YAML_FILE TRAJECTORY_NAME") + print(" where TRAJECTORY is a dictionary defined in YAML_FILE") sys.exit(1) traj_yaml = yaml.load(file(sys.argv[1], 'r')) traj_name = sys.argv[2] if not traj_name in traj_yaml: - print "unable to find trajectory %s in %s" % (traj_name, sys.argv[1]) + print("unable to find trajectory %s in %s" % (traj_name, sys.argv[1])) sys.exit(1) traj_len = len(traj_yaml[traj_name]) diff --git a/jsk_2022_08_miraikan_demo/scripts/episode_motion.py b/jsk_2022_08_miraikan_demo/scripts/episode_motion.py index 8fe293ba2b..22a60bbe93 100644 --- a/jsk_2022_08_miraikan_demo/scripts/episode_motion.py +++ b/jsk_2022_08_miraikan_demo/scripts/episode_motion.py @@ -21,33 +21,33 @@ def __init__(self, pepper_ip): #pepper_proxy try: self.tts = ALProxy("ALTextToSpeech",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.ans = ALProxy("ALAnimatedSpeech",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.pos = ALProxy("ALRobotPosture", self.PEPPER_IP, self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.mo = ALProxy("ALMotion",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.led = ALProxy("ALLeds",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) #set init posture # self.pos.goToPosture("StandInit", 1.0) diff --git a/jsk_2022_08_miraikan_demo/scripts/explanation_motion.py b/jsk_2022_08_miraikan_demo/scripts/explanation_motion.py index 715b2207e6..0051fb2e6e 100644 --- a/jsk_2022_08_miraikan_demo/scripts/explanation_motion.py +++ b/jsk_2022_08_miraikan_demo/scripts/explanation_motion.py @@ -19,33 +19,33 @@ def __init__(self, pepper_ip): #pepper_proxy try: self.tts = ALProxy("ALTextToSpeech",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.ans = ALProxy("ALAnimatedSpeech",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.pos = ALProxy("ALRobotPosture", self.PEPPER_IP, self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.mo = ALProxy("ALMotion",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) try: self.led = ALProxy("ALLeds",self.PEPPER_IP,self.PORT) - except Exception, e: - print "Error:" - print str(e) + except Exception as e: + print("Error:") + print(str(e)) #set init posture self.set_init_posture() diff --git a/jsk_maps/tools/yaml2owl.py b/jsk_maps/tools/yaml2owl.py index f4d2ee8766..b8f6975118 100755 --- a/jsk_maps/tools/yaml2owl.py +++ b/jsk_maps/tools/yaml2owl.py @@ -172,7 +172,7 @@ def get_depth(r): ### OWL stuff ### def create_header(): - print ''' + print(''' @@ -201,56 +201,56 @@ def create_header(): - ''' + ''') def create_footer(): - print ''' + print(''' -''' +''') def create_timepoint(t): - print '' - print ''.format(t) - print ' ' - print '' - print '' + print('') + print(''.format(t)) + print(' ') + print('') + print('') def create_instance(inst, type): - print '' - print ''.format(inst) - print ' '.format(type) - print '' - print '' + print('') + print(''.format(inst)) + print(' '.format(type)) + print('') + print('') def create_spot(inst,types,width,height,depth, x, y, z, props=None): global map_inst - print '' - print ''.format(inst) + print('') + print(''.format(inst)) for t in types: create_type(t) - print ' {0}'.format(width) - print ' {0}'.format(depth) - print ' {0}'.format(height) - print ' '.format(map_inst) + print(' {0}'.format(width)) + print(' {0}'.format(depth)) + print(' {0}'.format(height)) + print(' '.format(map_inst)) if props is not None: for p in props: create_prop(p[0], get_name(p[1])) - print '' - print '' + print('') + print('') def create_object(inst,types,width,height,depth, prop=None, objs=None, x=0.0, y=0.0, z=0.0, data_props=None): global map_inst - print '' - print ''.format(inst) + print('') + print(''.format(inst)) for t in types: create_type(t) - print ' {0}'.format(width) - print ' {0}'.format(depth) - print ' {0}'.format(height) - print ' '.format(map_inst) + print(' {0}'.format(width)) + print(' {0}'.format(depth)) + print(' {0}'.format(height)) + print(' '.format(map_inst)) if objs is not None: if objs.has_key(inst): @@ -260,109 +260,109 @@ def create_object(inst,types,width,height,depth, prop=None, objs=None, x=0.0, y= for p in data_props: create_data_prop(p[0], p[1], p[2]) - print '' - print '' + print('') + print('') def create_room(inst,types,width,height,depth, prop=None, objs=None, x=0.0, y=0.0, z=0.0): global map_inst - print '' - print ''.format(inst) + print('') + print(''.format(inst)) for t in types: create_type(t) - print ' {0}'.format(width) - print ' {0}'.format(depth) - print ' {0}'.format(height) - print ' '.format(map_inst) + print(' {0}'.format(width)) + print(' {0}'.format(depth)) + print(' {0}'.format(height)) + print(' '.format(map_inst)) - print ' {0}'.format(get_room_number(inst)) + print(' {0}'.format(get_room_number(inst))) if objs is not None: if objs.has_key(inst): create_props(prop, objs[inst]) - print '' - print '' + print('') + print('') def create_level(inst,types,width,height,depth, prop=None, objs=None, x=0.0, y=0.0, z=0.0): global map_inst - print '' - print ''.format(inst) + print('') + print(''.format(inst)) for t in types: create_type(t) - print ' {0}'.format(width) - print ' {0}'.format(depth) - print ' {0}'.format(height) - print ' '.format(map_inst) + print(' {0}'.format(width)) + print(' {0}'.format(depth)) + print(' {0}'.format(height)) + print(' '.format(map_inst)) - print ' {0}'.format(get_floor_number(inst)) + print(' {0}'.format(get_floor_number(inst))) if objs is not None: if objs.has_key(inst): create_props(prop, objs[inst]) - print '' - print '' + print('') + print('') def create_type(type): - print ' '.format(type) + print(' '.format(type)) def create_bldg(inst,types,width,height,depth, prop=None, objs=None, x=0.0, y=0.0, z=0.0): global map_inst - print ''.format(inst) + print(''.format(inst)) for t in types: create_type(t) - print ' {0}'.format(width) - print ' {0}'.format(depth) - print ' {0}'.format(height) - print ' '.format(map_inst) + print(' {0}'.format(width)) + print(' {0}'.format(depth)) + print(' {0}'.format(height)) + print(' '.format(map_inst)) if objs is not None: if objs.has_key(inst): create_props(prop, objs[inst]) - print '' + print('') def create_props(prop, objs): for o in objs: create_prop(prop,o) def create_prop(prop, obj): - print ' '.format(prop,obj) + print(' '.format(prop,obj)) def create_data_prop(prop, type, val): - print ' {2}'.format(prop,type,val) + print(' {2}'.format(prop,type,val)) def create_perception_event(obj,mat3d_name,time=0): - print '' - print ''.format(get_id()) - print ' ' - print ' '.format(obj) - print ' '.format(mat3d_name) - print ' '.format(time) - print '' - print '' + print('') + print(''.format(get_id())) + print(' ') + print(' '.format(obj)) + print(' '.format(mat3d_name)) + print(' '.format(time)) + print('') + print('') def create_rot_mat3d(m): name = 'RotationMatrix3D-{0}'.format(get_id()) - print '' - print ''.format(name) - print ' ' - print ' {0}'.format(m[0][0]) - print ' {0}'.format(m[0][1]) - print ' {0}'.format(m[0][2]) - print ' {0}'.format(m[0][3]) - print ' {0}'.format(m[1][0]) - print ' {0}'.format(m[1][1]) - print ' {0}'.format(m[1][2]) - print ' {0}'.format(m[1][3]) - print ' {0}'.format(m[2][0]) - print ' {0}'.format(m[2][1]) - print ' {0}'.format(m[2][2]) - print ' {0}'.format(m[2][3]) - print ' {0}'.format(m[3][0]) - print ' {0}'.format(m[3][1]) - print ' {0}'.format(m[3][2]) - print ' {0}'.format(m[3][3]) - print '' - print '' + print('') + print(''.format(name)) + print(' ') + print(' {0}'.format(m[0][0])) + print(' {0}'.format(m[0][1])) + print(' {0}'.format(m[0][2])) + print(' {0}'.format(m[0][3])) + print(' {0}'.format(m[1][0])) + print(' {0}'.format(m[1][1])) + print(' {0}'.format(m[1][2])) + print(' {0}'.format(m[1][3])) + print(' {0}'.format(m[2][0])) + print(' {0}'.format(m[2][1])) + print(' {0}'.format(m[2][2])) + print(' {0}'.format(m[2][3])) + print(' {0}'.format(m[3][0])) + print(' {0}'.format(m[3][1])) + print(' {0}'.format(m[3][2])) + print(' {0}'.format(m[3][3])) + print('') + print('') return name ### CREATING OWL FROM YAML ### @@ -625,8 +625,8 @@ def main(argv=None): create_footer() except Usage, err: - print >>sys.stderr, err.msg - print >>sys.stderr, "for help use --help" + print(err.msg, file=sys.stderr) + print("for help use --help", file=sys.stderr) return 2 if __name__ == "__main__":