Unsuccessful Autonomous Programming

Is this possible for accomplishing the task that we want…(to turn the ring light on, to drive slowly until the camera is within 6 feet, then stop the robot, then fire the shooter for 2.5 seconds, then stop the shooter)…? Please let us know, we are welcome to any ideas at this point in time. Thank you in advance. :yikes:

maybe you can put a frame before the robot stops, and the arcade drive with the movement put it on the sequence case

I made some changes in the autonomous code will this work for a sequence ?

You need to put the functions that read the distance into a while loop. As it is, the distance is only read once. Set it up so that the loop runs until you reach the target distance. Use that loop exactly as if it were a timed delay, keeping the flat sequence from advancing to the next frame before the distance reaches the desired value.

Okay I believe were finally starting to see the light at the end of the tunnel. If we run this code the robot should travel at a slow pace for 10 seconds, and then the next frame the target distance information should terminate the while loop and move to the next sequence, which consequentially stops the robot’s movement. And then the last two frames shoot the basketball, and stops the shooter. PLEASE CORRECT ME IF I’M WRONG ??? :ahh:

Here’s how I would do it.

Place your Drive code within the first frame encased in a While loop. Have your motors run at a constant 0.7. Within this loop, get your camera distance, and wire the Stop condition to the comparison between the distance you are at and the distance you want. Once the ideal distance is achieved, the loop will terminate, moving onto the next frame containing the code which stops your drive motors.

Good luck!

Will this be successful in completing the task ? We added the drive code into the loop of our target and distance information. :yikes:

Target INformation.png

Target INformation.png

This seems like it will work!

Thank you, were going to test it first thing in the morning. ::safety:: ::ouch:: :wink:

Okay so we tested the code and we had a problem with the vision code. We get the images on the vision processing panels and everything, but in the autonomous shouldn’t the robot be getting the correct distance. ? 6 feet from the camera, is 21 feet on the target information updating on the front panel of the vision processing.

And another question the robot doesnt move forward in autonomous do we need to disable the safety config on the drive motors ?

Thank you,

The Vision Processing loop will estimate the distance and positions and publish them via the global variable. You should be able to read the global anywhere in the program you like.

You can certainly try disabling it. If you wrote code with extended delays between updates, this will provoke the safety to kick in. You can disable it, or change the code to update more frequently, even with the same value.

Greg McKaskle