Robot Picking up a ball vex v5

Hey there i made a robot that looks like a camel and I would like to code a way for it to find the ball pick it up and put it in the vex hoops. Does ANyone know how to code this?

1 Like

First of all, welcome to the forum. Secondly, I believe we’re going to need a bit more context in order to help you. Could you possibly explain the robot setup a bit more than it looks like a camel and maybe elaborate on what your goals for the robot are. Have you already tried to program the robot and are stuck, if so a picture of your code might help, or are you completely stumped with the code and need help determining how the logic should work. Thanks, -Hayden


Hi the robot has a simple plate with 4 wheles to drive and turn. then you got a belt going up with a claw attached to the belt. you have a vision sensor on the botton and thats the basics

What programming environment are you using, that would be useful to provide further help. Also what is your programming experience, do you know how to program a simple drive and need help integrating the vision sensor for automation or do you need help making a simple driver control program.

Im currently using block code and got this for tracking the ball

I dont have much experience i got this from a tutorial I found which somewhat works

I have nearly no experience with block coding but to me it looks like in the 4th if statement you have it backwards? I believe it should be < 100 and > 60. To define a zone in which you want the robot to drive towards the ball.

How would I work on grabing the ball and lifting it up to a hoop though? Could you do that through text code and if so could you do it for me?

I won’t write any direct code for you; however, I will write some pseudocode I believe might work and you can try to implement it yourself. It should give you a general idea of how the logic structure should probably work.

forever {
     take snapshot;
     if(objectexists) {
            if(object center greater than 100) {
                   turn robot right;
            if(object center less than 60) {
                   turn robot left;
            if(object center greater than 60 and less than 100) {
                   while(object width less than (some value) {
                           drive robot forward;
                   close claw;
           else {
                  stop robot;
     else {
         set drive velocity to some number;
         turn robot some direction;

Disclaimer: I do not promise that this works but it is what I came up with off the top of my head.

Edit: To add about the lift. All you should have to do is after the statement that closes the claw make the lift motor pull the claw up.

Thanks, ill try this when i have my class again