|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Shooter Targeting with Camera
Hey guys, my team is interested in programming our robot to track the rectangles. As of right now we plan to use mecanum wheels, so we are only programming to track the rectangles to give us height to adjust our shooter. We figure with the mecanum wheels, we will be able to rotate towards the target on our own. How would we be able to use the camera to adjust the height of our shooter during teleop? Let's say for example we plan to use a motor like window motor for this function. We want to program our shooter to be a turret only the left to right would be left out of the program. I have no experience with the any of the camera programming from years past. Can someone please help with how to begin this program?
|
|
#2
|
|||
|
|||
|
Re: Shooter Targeting with Camera
The camera defaults to using a coordinate system where 0,0 is in the top right of the image and the sizeX,sizeY is in the bottom right. Since this is pretty meaningless for driving a robot, the example code scales it to be 0,0 in the center with negative 1 at the top edge and positive 1 at the bottom edge.
Since this is somewhat like a joystick, it or the inverse of it should work better to move motors or servos. The first thing I'd do is hold it by hand and plot the position on a chart or at least display it on the screen. Get a sense of what it outputs. Then pretend to be the motor, moving it according to the output number. This helps you to learn the relative magnitude, directions, and numeric signs of the values involved. To control the motor, you have several options. Bang-bang control- Your camera is either above, below, or on target. If below, turn motor at a fixed speed to move it up. If above, move the other way at a fixed speed. If on target (generally less than delta away), leave it there. Proportional- Similar, but you use the distance away from the target to scale your motor speed to get there faster and slow down as you approach. PID and other variations - An even more complex method of approaching the target faster but trying not to overshoot and trying to overcome nonlinear elements like stiction. I don't think it is necessary here. My recommendation is to choose a slow to moderate speed and start with bang-bang or proportional. Greg McKaskle |
|
#3
|
|||
|
|||
|
Re: Shooter Targeting with Camera
Thanks Greg, will try this soon.
|
|
#4
|
||||
|
||||
|
Re: Shooter Targeting with Camera
Even though your original question was answered, I would like to take this time to point out that the camera's ability to track improves dramatically with the addition of an LED ring around the camera's lens to illuminate the reflective tape. In addition, the website below provides some helpful walkthrough's if you have trouble setting up the camera:
http://wpilib.screenstepslive.com/s/3120/m/8731 |
|
#5
|
|||
|
|||
|
Re: Shooter Targeting with Camera
Thanks. Will order the LED ring this weekend.
|
|
#6
|
||||
|
||||
|
Re: Shooter Targeting with Camera
Tip: Our team found blue and green to be the best colors to use in terms of LabVIEW being able to isolate the color/luminosity. They are relatively cheap however, and you may as well buy a number of different kinds.
|
|
#7
|
||||
|
||||
|
Re: Shooter Targeting with Camera
Quote:
So I'd generally go with green as it seems to be the safest choice in any case.Either way, when you go with intensity in the Monochrome options of Vision processing, it'd usually be the most "intense" color in the arena one way or another...though it seems to me that choosing a specific color in the monochrome tab eliminates other colors in the frame much better than intensity. |
|
#8
|
||||
|
||||
|
Re: Shooter Targeting with Camera
Quote:
|
|
#9
|
|||
|
|||
|
Re: Shooter Targeting with Camera
I have noticed in some of the other threads here and on the vision proscessing section of the screensteps page that I should use the example "Rectangular Target- 2013.lvproj. The way I'm planning to track the center rectangle is to create what states the camera is at in the vision processing vi based on where it is located on the coordinate system (ex. center, above, below, notfound) and pass this info through the robot global data vi for use in my teleop or autonomous vi. I noticed from frcmastery.com videos that was the way they did vision processing in the past competitions. Am I right to think this way or is there an easier way of doing this?
|
|
#10
|
||||
|
||||
|
Re: Shooter Targeting with Camera
Hopefully I'm getting your post correct: You are going to integrate the Rectangular Vision Tracking VI into your robot project, store the target coordinates in global variables, and then use those coordinates to adjust the shooter in Auton/Teleop?
Sounds like the correct approach to me! Good luck. |
|
#11
|
|||
|
|||
|
Re: Shooter Targeting with Camera
yeah the one thing I noticed though, when I integrated the rectangular target example, the robot global data vi. in my project was overwritten with the one from the example. This created a problem in my code because the Robot Mode global variable no longer existed. Could I just copy the vision processing vi. from that example and overwrite the one in my project?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|