From 2a3ecb24fdcf33dd486320f75cad6e2a64ea73d9 Mon Sep 17 00:00:00 2001 From: wangWking <842749351@qq.com> Date: Thu, 28 Apr 2022 17:45:10 +0800 Subject: [PATCH] fix bug --- .../scripts/mycobot_320_follow_display.py | 9 ++++----- .../new_mycobot_320/scripts/mycobot_320_slider.py | 2 +- .../scripts/mycobot_320_teleop_keyboard.py | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_display.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_display.py index f579dd3..fdd5423 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_display.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_display.py @@ -15,7 +15,7 @@ def talker(): rospy.init_node("display", anonymous=True) print("Try connect real mycobot...") - port = rospy.get_param("~port", "/dev/ttyACM0") + port = rospy.get_param("~port", "/dev/ttyUSB0") baud = rospy.get_param("~baud", 115200) print("port: {}, baud: {}\n".format(port, baud)) try: @@ -65,14 +65,14 @@ def talker(): data_list = [] for index, value in enumerate(angles): data_list.append(value) - # print('data_list=======================>',data_list) + # rospy.loginfo('{}'.format(data_list)) joint_state_send.position = data_list pub.publish(joint_state_send) coords = mycobot.get_coords() - # print('coords=========================>',coords) + # marker marker_.header.stamp = rospy.Time.now() marker_.type = marker_.SPHERE @@ -82,10 +82,9 @@ def talker(): marker_.scale.z = 0.04 # marker position initial - print('coordscoords------------->',coords) if not coords: coords = [0, 0, 0, 0, 0, 0] - # print('coordscoordscoords====----==========>',coords) + rospy.loginfo("error [101]: can not get coord values") marker_.pose.position.x = coords[1] / 1000 * -1 diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_slider.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_slider.py index a3725c0..ac0c929 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_slider.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_slider.py @@ -35,7 +35,7 @@ def listener(): rospy.init_node("control_slider", anonymous=True) rospy.Subscriber("joint_states", JointState, callback) - port = rospy.get_param("~port", "/dev/ttyACM0") + port = rospy.get_param("~port", "/dev/ttyUSB0") baud = rospy.get_param("~baud", 115200) print(port, baud) mc = MyCobot(port, baud) diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_teleop_keyboard.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_teleop_keyboard.py index 50dc874..048aea3 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_teleop_keyboard.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_teleop_keyboard.py @@ -11,7 +11,7 @@ import time import roslib - +# Terminal output prompt information. 终端输出提示信息 msg = """\ Mycobot Teleop Keyboard Controller --------------------------- @@ -64,7 +64,7 @@ def teleop_keyboard(): change_angle = 180 * change_percent / 100 change_len = 250 * change_percent / 100 - rospy.wait_for_service("get_joint_ang cles") + rospy.wait_for_service("get_joint_angles") rospy.wait_for_service("set_joint_angles") rospy.wait_for_service("get_joint_coords") rospy.wait_for_service("set_joint_coords") @@ -88,8 +88,8 @@ def teleop_keyboard(): while True: res = get_coords() + # print(res) if res.x > 1: - print("joint1's angle : "+str(res.x)+"is not > 1,please calibrate the joint1's angle") break time.sleep(0.1) @@ -99,6 +99,7 @@ def teleop_keyboard(): try: print(msg) print(vels(speed, change_percent)) + # Keyboard keys call different motion functions. 键盘按键调用不同的运动功能 while 1: try: # print("\r current coords: %s" % record_coords, end="")