Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- R = None
- G = None
- B = None
- dType.SetIOMultiplexingEx(api, 15, 1, 1)
- dType.SetIODOEx(api, 15, 1, 1)
- dType.SetInfraredSensor(api, 1 ,2, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 218, 15, 36, current_pose[3], 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 0, 1)
- for count2 in range(100):
- while (dType.GetInfraredSensor(api, 2)[0]) == 0:
- STEP_PER_CRICLE = 360.0 / 1.8 * 10.0 * 16.0
- MM_PER_CRICLE = 3.1415926535898 * 36.0
- vel = float(50) * STEP_PER_CRICLE / MM_PER_CRICLE
- dType.SetEMotorEx(api, 0, 1, int(vel), 1)
- for count in range(100):
- while (dType.GetInfraredSensor(api, 2)[0]) == 1:
- dType.SetWAITCmdEx(api, 0.25, 1)
- STEP_PER_CRICLE = 360.0 / 1.8 * 10.0 * 16.0
- MM_PER_CRICLE = 3.1415926535898 * 36.0
- vel = float(0) * STEP_PER_CRICLE / MM_PER_CRICLE
- dType.SetEMotorEx(api, 0, 0, int(vel), 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 95, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 234, 16, (-48), current_pose[3], 1)
- dType.SetEndEffectorSuctionCupEx(api, 1, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 218, 15, 36, current_pose[3], 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 0, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 148, 91, (-37), current_pose[3], 1)
- dType.SetColorSensor(api, 1 ,1, 1)
- dType.SetWAITCmdEx(api, 1, 1)
- R = dType.GetColorSensorEx(api, 0)
- G = dType.GetColorSensorEx(api, 1)
- B = dType.GetColorSensorEx(api, 2)
- dType.SetWAITCmdEx(api, 0.3, 1)
- dType.SetColorSensor(api, 0 ,1, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 218, 15, 36, current_pose[3], 1)
- if R == 1:
- current_pose = dType.GetPose(api)
- dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 66, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 320, 22, 3, current_pose[3], 1)
- dType.SetEndEffectorSuctionCupEx(api, 0, 1)
- if B == 1:
- current_pose = dType.GetPose(api)
- dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 187, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 320, 22, 3, current_pose[3], 1)
- dType.SetEndEffectorSuctionCupEx(api, 0, 1)
- if G == 1:
- current_pose = dType.GetPose(api)
- dType.SetPTPWithLCmdEx(api, 1, current_pose[0], current_pose[1], current_pose[2], current_pose[3], 300, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 320, 22, 3, current_pose[3], 1)
- dType.SetEndEffectorSuctionCupEx(api, 0, 1)
- current_pose = dType.GetPose(api)
- dType.SetPTPCmdEx(api, 2, 218, 15, 36, current_pose[3], 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement