This commit is contained in:
2929ss 2022-08-04 13:56:15 +08:00
parent 5252c6a8e2
commit 252e89c9bb
4 changed files with 13 additions and 7 deletions

View file

@ -425,12 +425,16 @@ class Object_detect(Movement):
# The path to save the image folder # The path to save the image folder
def parse_folder(folder): def parse_folder(folder):
restore = [] restore = []
path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280' + folder path = ''
path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' + folder
path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' + folder path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' + folder
if os.path.exists(path1): if os.path.exists(path1):
path = path1 path = path1
elif os.path.exists(path2): elif os.path.exists(path2):
path = path2 path = path2
print("path:",path)
for i, j, k in os.walk(path): for i, j, k in os.walk(path):
for l in k: for l in k:
restore.append(cv2.imread(folder + '/{}'.format(l))) restore.append(cv2.imread(folder + '/{}'.format(l)))

View file

@ -5,13 +5,13 @@ from pymycobot import PI_PORT, PI_BAUD # 当使用树莓派版本的mycobot时
import time import time
# mc = MyCobot("/dev/ttyACM0", 115200) # mc = MyCobot("/dev/ttyACM0", 115200)
mc = MyCobot("/dev/ttyUSB0", 115200) # mc = MyCobot("/dev/ttyUSB0", 115200)
# mc = MyCobot("/dev/ttyAMA0", 1000000) mc = MyCobot("/dev/ttyAMA0", 1000000)
# mc.send_angles([0,0,0,0,0,0], 25) mc.send_angles([0,0,0,0,0,0], 25)
# print(mc.get_angles()) # print(mc.get_angles())
mc.send_angles([-7.11, -6.94, -55.01, -24.16, 0.0, -15], 30) # mc.send_angles([-7.11, -6.94, -55.01, -24.16, 0.0, -15], 30)
time.sleep(4) # time.sleep(4)
# print(mc.get_angles()) # print(mc.get_angles())
# mc.send_coords([120.8, -134.4, 258.0, -172.72, -5.31, -109.09], 30, 1) # red bucket # mc.send_coords([120.8, -134.4, 258.0, -172.72, -5.31, -109.09], 30, 1) # red bucket
@ -35,6 +35,8 @@ time.sleep(4)
# mc.release_all_servos() # mc.release_all_servos()
# mc.release_servo(1)
# mc.set_servo_calibration(1)
# time.sleep(1) # time.sleep(1)
# while True: # while True:
# print("angles:%s"% mc.get_angles()) # print("angles:%s"% mc.get_angles())

View file

@ -74,7 +74,7 @@ class MycobotTopics(object):
rospy.init_node("mycobot_topics_pi") rospy.init_node("mycobot_topics_pi")
rospy.loginfo("start ...") rospy.loginfo("start ...")
# problem # problem
port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1]") port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1])
baud = rospy.get_param("~baud", 1000000) baud = rospy.get_param("~baud", 1000000)
rospy.loginfo("%s,%s" % (port, baud)) rospy.loginfo("%s,%s" % (port, baud))
self.mc = MyCobotSocket(port, baud) # port self.mc = MyCobotSocket(port, baud) # port