Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.13 KB | None | 0 0
  1. R = None
  2. G = None
  3. B = None
  4.  
  5.  
  6. dType.SetIOMultiplexingEx(api, 15, 1, 1)
  7. dType.SetIODOEx(api, 15, 1, 1)
  8. dType.SetInfraredSensor(api, 1 ,2, 1)
  9. current_pose = dType.GetPose(api)
  10. dType.SetPTPCmdEx(api, 2, 218,  15,  36, current_pose[3], 1)
  11. current_pose = dType.GetPose(api)
  12. dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 0, 1)
  13. for count2 in range(100):
  14.   while (dType.GetInfraredSensor(api, 2)[0]) == 0:
  15.     STEP_PER_CRICLE = 360.0 / 1.8 * 10.0 * 16.0
  16.     MM_PER_CRICLE = 3.1415926535898 * 36.0
  17.     vel = float(50) * STEP_PER_CRICLE / MM_PER_CRICLE
  18.     dType.SetEMotorEx(api, 0, 1, int(vel), 1)
  19.   for count in range(100):
  20.     while (dType.GetInfraredSensor(api, 2)[0]) == 1:
  21.       dType.SetWAITCmdEx(api, 0.25, 1)
  22.       STEP_PER_CRICLE = 360.0 / 1.8 * 10.0 * 16.0
  23.       MM_PER_CRICLE = 3.1415926535898 * 36.0
  24.       vel = float(0) * STEP_PER_CRICLE / MM_PER_CRICLE
  25.       dType.SetEMotorEx(api, 0, 0, int(vel), 1)
  26.       current_pose = dType.GetPose(api)
  27.       dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 95, 1)
  28.       current_pose = dType.GetPose(api)
  29.       dType.SetPTPCmdEx(api, 2, 234,  16,  (-48), current_pose[3], 1)
  30.       dType.SetEndEffectorSuctionCupEx(api, 1, 1)
  31.       current_pose = dType.GetPose(api)
  32.       dType.SetPTPCmdEx(api, 2, 218,  15,  36, current_pose[3], 1)
  33.       current_pose = dType.GetPose(api)
  34.       dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 0, 1)
  35.       current_pose = dType.GetPose(api)
  36.       dType.SetPTPCmdEx(api, 2, 148,  91,  (-37), current_pose[3], 1)
  37.       dType.SetColorSensor(api, 1 ,1, 1)
  38.       dType.SetWAITCmdEx(api, 1, 1)
  39.       R = dType.GetColorSensorEx(api, 0)
  40.       G = dType.GetColorSensorEx(api, 1)
  41.       B = dType.GetColorSensorEx(api, 2)
  42.       dType.SetWAITCmdEx(api, 0.3, 1)
  43.       dType.SetColorSensor(api, 0 ,1, 1)
  44.       current_pose = dType.GetPose(api)
  45.       dType.SetPTPCmdEx(api, 2, 218,  15,  36, current_pose[3], 1)
  46.       if R == 1:
  47.         current_pose = dType.GetPose(api)
  48.         dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 66, 1)
  49.         current_pose = dType.GetPose(api)
  50.         dType.SetPTPCmdEx(api, 2, 320,  22,  3, current_pose[3], 1)
  51.         dType.SetEndEffectorSuctionCupEx(api, 0, 1)
  52.       if B == 1:
  53.         current_pose = dType.GetPose(api)
  54.         dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 187, 1)
  55.         current_pose = dType.GetPose(api)
  56.         dType.SetPTPCmdEx(api, 2, 320,  22,  3, current_pose[3], 1)
  57.         dType.SetEndEffectorSuctionCupEx(api, 0, 1)
  58.       if G == 1:
  59.         current_pose = dType.GetPose(api)
  60.         dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 300, 1)
  61.         current_pose = dType.GetPose(api)
  62.         dType.SetPTPCmdEx(api, 2, 320,  22,  3, current_pose[3], 1)
  63.         dType.SetEndEffectorSuctionCupEx(api, 0, 1)
  64.       current_pose = dType.GetPose(api)
  65.       dType.SetPTPCmdEx(api, 2, 218,  15,  36, current_pose[3], 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement