|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Angle Calculation from image of goal
You need to know the specifics of the camera and lens you are using to be ultimately accurate. If you know the focal length of the lens and the size of the pickup device, you can make a calculation using trig, to determine the angle of the field of view. Once you have that, you need to know the distance to target or you can back into the distance by calculating a known target size as a percentage of the field of view. This might be a frustrating exercise since the pickup and focal length of these lenses is so small. That allows a lot of error to creep into the calculation.
|
|
#2
|
|||||
|
|||||
|
Re: Angle Calculation from image of goal
Quote:
![]() |
|
#3
|
|||||
|
|||||
|
Re: Angle Calculation from image of goal
Quote:
What's your setup for both the camera and processor? |
|
#4
|
||||
|
||||
|
Re: Angle Calculation from image of goal
Here is some LabVIEW code that tackles this problem...
The way the VI works is it takes your current gyro heading, and does some trigonometry to find the needed gyro heading and the current distance from the goal (might be helpful if you have a certain distance range you can shoot from). Make sure to set the constants in the code (I've commented it mostly, but the important ones are the goal target width (in feet), the camera's horizontal angle of view (in degrees), and the image width (in pixels)... Disregard the Disabled code at the bottom. Hope this is helpful, feel free to PM me with any questions. |
|
#5
|
||||
|
||||
|
Re: Angle Calculation from image of goal
I believe they are using a Nexus 5 with on-board vision processing
![]() |
|
#6
|
|||||
|
|||||
|
Re: Angle Calculation from image of goal
If you've found the answer above, please disregard, but this is how we've done well:
Position the robot roughly aligned with the goal (that is, eyeball it). Do a test launch. Note where the ball ends up, in terms of inches/feet to he left or right of the goal. Rotate the robot a known amount (probably measured in terms of encoder counts on the left and right drive systems). Do another test launch. Note where the ball ends up (same criteria). Based on the two measurements above, calculate a "target point" that will result in a goal, and a "proportionality constant" to get there wif the robot is pointed somewhere else. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|