add encoding=utf-8

This commit is contained in:
wangWking 2022-04-21 18:03:48 +08:00
parent e434301c17
commit eaa2e0592f
8 changed files with 16 additions and 11 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import rospy
import cv2 as cv
import numpy as np

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python2
# coding:utf-8
# -*- coding:utf-8 -*-
import rospy
from visualization_msgs.msg import Marker
import time

View file

@ -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

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
import time
import rospy

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
# license removed for brevity
import time
import math

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
import math
import rospy

View file

@ -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)

View file

@ -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")