|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Vision Tracking Help
If you want to get a little better distance approximation on angled shots, you can switch the code to use the vertical measurements instead. For even better estimation, you may want to use the bounding box as a region of interest and do some edge detection or line fits.
Greg Mckaskle |
|
#2
|
||||
|
||||
|
Re: Vision Tracking Help
Would anyone mind posting some sample code for turret control. To begin I would be happy to just control the turret with the vision tracking, shooting distance would be a bonus. I have got all the vision processing working from the examples and can track the rectangles. I just need to know what to do with the output. It sounds like it isnt a lot of work, I just dont know where to start with it. We are going to have 2 limit switches on our turret so it doesnt try to do a 360, it could pull off a 360, but the wires would be a nightmare.
|
|
#3
|
|||||
|
|||||
|
Re: Vision Tracking Help
If you can track the rectangles, than you can find the x coordinate of the target you want to aim at. If your camera is mounted such that it turns with the turret, you need to establish what screen coordinate the turret actually is aiming at. Then you can find the difference between the desired coordinate and the tracked one, and use that to turn the turret and make the two values the same.
Do you understand that high-level description? |
|
#4
|
||||
|
||||
|
Re: Vision Tracking Help
I think I understand this in words, but putting it into labview is the difficulty. I think you are saying if the camera is mounted center on the turret then your target might have an coordinate of (0, 5) and as you move the coordinate would change but we want the program and the turret to do everything in its power to keep the X-Coordinate at 0. The Y may change as you get closer or move further away, but the program is trying to keep the X the same to keep it centered on the turret.
Now making that a reality is where I am going to struggle. |
|
#5
|
|||||
|
|||||
|
Re: Vision Tracking Help
Try something similar to this.
You'll want to use the X coordinate from the camera as the process variable to a PID controller (since this will change with the rotation of the turret). Your setpoint should be the center of the image (where you want the target to appear). This can be found by dividing the X resolution of the image by two. Note that this also assumes that the camera is mounted exactly on the center of the shooter - you might have to tweak the setpoint to make it mesh with your system. You'll need to tune the PID constants in my snippet - since they're the default values. There are other threads around for help on PID gain tuning (just search for them). |
|
#6
|
|||
|
|||
|
Re: Vision Tracking Help
If you are using the Target location from the LV example, it is a -1 to 1 coordinate with 0 in the center, not 80. If you are using a more raw version, width/2 would be the right target for the PID.
Greg McKaskle |
|
#7
|
|||
|
|||
|
Re: Vision Tracking Help
how do you add another camera that is not an axis camera. mine is a trendnet tv-IP110/A
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|