From eaa2e0592f9f89c0cfdfba1912e676243eba07ff Mon Sep 17 00:00:00 2001 From: wangWking <842749351@qq.com> Date: Thu, 21 Apr 2022 18:03:48 +0800 Subject: [PATCH] add encoding=utf-8 --- .../scripts/mycobot_320_detect_marker.py | 1 + .../scripts/mycobot_320_follow_and_pump.py | 2 +- .../scripts/mycobot_320_follow_display.py | 10 +++++----- .../scripts/mycobot_320_following_marker.py | 1 + .../new_mycobot_320/scripts/mycobot_320_listen_real.py | 1 + .../scripts/mycobot_320_listen_real_of_topic.py | 1 + .../new_mycobot_320/scripts/mycobot_320_slider.py | 8 ++++---- .../scripts/mycobot_320_teleop_keyboard.py | 3 ++- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_detect_marker.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_detect_marker.py index 04ca483..42bde89 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_detect_marker.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_detect_marker.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding:utf-8 -*- import rospy import cv2 as cv import numpy as np diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_and_pump.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_and_pump.py index f26b669..ef07a9b 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_and_pump.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_follow_and_pump.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2 -# coding:utf-8 +# -*- coding:utf-8 -*- import rospy from visualization_msgs.msg import Marker import time 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 7f1498c..f579dd3 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 @@ -1,4 +1,5 @@ #!/usr/bin/env python2 +# -*- coding:utf-8 -*- from cgi import print_environ import time @@ -14,7 +15,7 @@ def talker(): rospy.init_node("display", anonymous=True) print("Try connect real mycobot...") - port = rospy.get_param("~port", "/dev/ttyUSB0") + port = rospy.get_param("~port", "/dev/ttyACM0") baud = rospy.get_param("~baud", 115200) print("port: {}, baud: {}\n".format(port, baud)) try: @@ -61,18 +62,17 @@ def talker(): joint_state_send.header.stamp = rospy.Time.now() angles = mycobot.get_radians() - print('angels=====================>',angles) data_list = [] for index, value in enumerate(angles): data_list.append(value) - print('data_list=======================>',data_list) + # 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) + # print('coords=========================>',coords) # marker marker_.header.stamp = rospy.Time.now() marker_.type = marker_.SPHERE @@ -85,7 +85,7 @@ def talker(): print('coordscoords------------->',coords) if not coords: coords = [0, 0, 0, 0, 0, 0] - print('coordscoordscoords====----==========>',coords) + # 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_following_marker.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_following_marker.py index 4afe3f9..6de2427 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_following_marker.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_following_marker.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 +# -*- coding:utf-8 -*- import time import rospy diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real.py index d022c72..1ec7872 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 +# -*- coding:utf-8 -*- # license removed for brevity import time import math diff --git a/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real_of_topic.py b/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real_of_topic.py index 169567a..5e7ffa6 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real_of_topic.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_listen_real_of_topic.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 +# -*- coding:utf-8 -*- import math import rospy 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 9c92e48..a3725c0 100755 --- a/mycobot_320/new_mycobot_320/scripts/mycobot_320_slider.py +++ b/mycobot_320/new_mycobot_320/scripts/mycobot_320_slider.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2 - +# -*- coding:utf-8 -*- """[summary] This file obtains the joint angle of the manipulator in ROS, and then sends it directly to the real manipulator using `pymycobot` API. @@ -20,13 +20,13 @@ mc = None def callback(data): # rospy.loginfo(rospy.get_caller_id() + "%s", data.position) - print('data_position======================>',data.position) + # print('data_position======================>',data.position) data_list = [] for index, value in enumerate(data.position): data_list.append(value) mc.send_radians(data_list, 80) - print('data_list=====================>',data_list) + # print('data_list=====================>',data_list) # time.sleep(0.5) @@ -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/ttyUSB0") + port = rospy.get_param("~port", "/dev/ttyACM0") 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 77d7d13..50dc874 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 @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding:utf-8 -*- from __future__ import print_function from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus import rospy @@ -63,7 +64,7 @@ def teleop_keyboard(): change_angle = 180 * change_percent / 100 change_len = 250 * change_percent / 100 - rospy.wait_for_service("get_joint_angles") + rospy.wait_for_service("get_joint_ang cles") rospy.wait_for_service("set_joint_angles") rospy.wait_for_service("get_joint_coords") rospy.wait_for_service("set_joint_coords")