diff --git a/mycobot_ai/ai_mecharm_270/scripts/combine_detect_obj_color.py b/mycobot_ai/ai_mecharm_270/scripts/combine_detect_obj_color.py index d164f82..3339011 100644 --- a/mycobot_ai/ai_mecharm_270/scripts/combine_detect_obj_color.py +++ b/mycobot_ai/ai_mecharm_270/scripts/combine_detect_obj_color.py @@ -20,7 +20,7 @@ __version__ = "1.0" class Object_detect(Movement): - def __init__(self, camera_x = 145, camera_y = -5): + def __init__(self, camera_x = 140, camera_y = -5): # inherit the parent class super(Object_detect, self).__init__() # get path of file @@ -51,6 +51,7 @@ class Object_detect(Movement): self.raspi = False if "dev" in self.robot_m5: self.Pin = [2, 5] + # self.Pin = [5] elif "dev" in self.robot_wio: self.Pin = [20, 21] for i in self.move_coords: @@ -162,7 +163,7 @@ class Object_detect(Movement): self.mc.send_coords([x, y, 140, 179.12, -0.18, 179.46], 30, 0) time.sleep(3) - self.mc.send_coords([x, y, 110, 179.12, -0.18, 179.46], 30, 0) # -178.77, -2.69, 40.15 + self.mc.send_coords([x, y, 90, 179.12, -0.18, 179.46], 30, 0) # -178.77, -2.69, 40.15 time.sleep(3) # open pump diff --git a/mycobot_ai/ai_mecharm_270/scripts/test.py b/mycobot_ai/ai_mecharm_270/scripts/test.py index a8e2a3f..b35137d 100755 --- a/mycobot_ai/ai_mecharm_270/scripts/test.py +++ b/mycobot_ai/ai_mecharm_270/scripts/test.py @@ -7,13 +7,14 @@ from pymycobot import PI_PORT, PI_BAUD # 当使用树莓派版本的mycobot时 import time,os mc = MyCobot(os.popen("ls /dev/ttyUSB*").readline()[:-1], 115200) +# mc = MyCobot(os.popen("ls /dev/ttyACM*").readline()[:-1], 115200) # mc = MyCobot("/dev/ttyAMA0", 1000000) -mc.send_angles([0,0,0,0,90,0],20) # coords:[95.6, 0.5, 166.4, 179.12, -0.18, 179.46] -# # mc.send_angles([-3.25, 17.22, -32.51, 2.37, 92.54, -36.21],30) +# mc.send_angles([0,0,0,0,90,0],20) # coords:[95.6, 0.5, 166.4, 179.12, -0.18, 179.46] +# time.sleep(4) -time.sleep(4) +# mc.send_angles([-3.25, 17.22, -32.51, 2.37, 92.54, -36.21],30) # mc.send_coords([92.3, -104.9, 211.4, -179.6, 28.91, 131.29], 30, 0) # above the red bucket # time.sleep(4) @@ -40,10 +41,22 @@ time.sleep(4) # print("\n") # mc.release_all_servos() -# mc.release_servo(3) +# mc.release_servo(1) # mc.set_servo_calibration(1) # mc.set_servo_calibration(2) # mc.set_servo_calibration(3) # mc.set_servo_calibration(4) # mc.set_servo_calibration(5) # mc.set_servo_calibration(6) + + +mc.set_basic_output(2, 0) +mc.set_basic_output(5, 0) +time.sleep(3) + +mc.set_basic_output(2, 1) +mc.set_basic_output(5, 1) +time.sleep(3) + +# print(mc.get_basic_input(2)) +# print(mc.get_basic_input(5))