Singapore
Asked — Edited
Resolved Resolved by Rich!

Reaction And Movement Of Robot

Hi Everyone,

I would like to enquire if the EZ-Script is able to program the robot in such a way that..

  1. Detect red/green object
  2. Move towards the object
  3. Stop before the object (Around 3-5cm where it will be able to grab hold of the object)

Is it possible? I would have to use the multi-color detection for detecting both colors (Red and Green).

Thanks and would really hope to receive a reply soon. :)


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

United Kingdom
#10  

It wouldn't load or you couldn't download it?

There is a problem with the link but it should be available here (took a bit of finding since the user details pages are also slightly broken too - a bug that has been reported previously).

Singapore
#11  

@Rich Does this script work this way?


Servo (D2, 70)
ControlCommand("Camera", CameraStart)

IF ($CameraIsTracking = 1)
  ControlCommand("Camera", CameraMotionTrackingEnable)
  
  :loop
  IF ($CameraVerticalQuadrant = "Middle")
    ControlCommand("Camera", CameraMotionTrackingDisable)
    ControlCommand("Camera", CameraMultiColorTrackingEnable)
    
    # Custom Color = Red
    IF ($CameraObjectColor = "Custom Color")
      SayEZB("There is a red object.")
      Move (D9, forward)
      Move (D12, forward)
      Move (D9, stop)
      Move (D12, stop)
      
      # open left gripper
      servo (D4, 150)
      # Lower Left Arm
      servo (D2, 40)
      # Close Left Gripper
      servo (D4, 30)
      
      # Color 2 = Green
    ELSEIF ($CameraObjectColor = "Green")
      SayEZB("There is a green object.")
      Move (D9, forward)
      Move (D12, forward)
      Move (D9, stop)
      Move (D12, stop)
      
      # open right gripper
      servo (D7, 150)
      # Lower Right arm
      servo (D5, 40)
      # Close right gripper
      servo (D7, 30)
    ENDIF 
      
    sleep(9000)
  ENDIF 
    
  Goto(loop)
  
ELSEIF ($cameraistracking = 0)
  SayEZB("I cannot see anything")
ENDIF 

Move the servo connected to D2 into position 70 [D2 is the left arm] Camera will start

It will enable the movement tracking if the camera is tracking. THEN :loop will be the start of the loop

If the image is vertical in the middle, the movement tracking will be disable, and the multicolor tracking will be enable.

(Ps because I do not have the camera rolling yet, so the name 'Custom Color' is Red) If the object is red, the servo D9 and D12 will be moved forward and stop before the object after which, it will then open D4 (which is the gripper) to position 150 then Move the servo connected to D2 into position 40 (to lower from position 70), D4 will then be close back to position 30.

Same for the green object, however, left arm will be used to pick up red object and right arm will be used to pick up green object.

Wait for 9 seconds and then loop back If it isn't vertically it will just loop back It will then repeat the IF nest.

Ps. Is my EZ-Script correct? The flow I wanted was to: Use the camera to track the environment and then detect the object. Next, move towards the object then pick up using either left or right arm depending on whether it is red or green in color.

Thank you very much.:)

United Kingdom
#12  

I only had chance to quickly scan over it but I think you've got the main idea.

One thing I noticed though,

      Move (D9, forward)
      Move (D12, forward)
      Move (D9, stop)
      Move (D12, stop)

This will not do anything, well, not for very long anyway. Almost immediately after moving the servos forwards it stops them. I didn't have chance to see what you are attempting to achieve so can't advise too well but either a sleep() to let it move forward for a set time or a WaitForChange() (or similar) to let it move until an event happens between the forward and stop commands should work.

When I get home I'll look properly. To be honest I don't think EZ-Script is needed since there are built in controls that may do it all for you, or at least the main parts. But I'll have a look later and post some more advice etc. :)

Singapore
#13  

@Rich Thanks for the reply! Roughly what I want to do is that, the robot will be able to detect the red/green object, and move towards that and after which pick the object up depending on which color. (left hand pick red object, right hand pick green object)

Looking forward to your guidance!;)

United Kingdom
#15  

Sorry, I haven't forgotten this I just haven't had chance to sit down with ARC and check it out properly - I will.