In LV with the example code the camera is able to track where the trailer is in screen and if its friend or foe but when its not in frame it doesn’t pass on to the servos to search for it and the camera doesn’t fallow it if it moves
Be sure you have the jumper attached next to the PWM slot being used for the servo on your Digital Sidecar. Learned that lesson myself the long way. :rolleyes:
already had checked that
ok i tweaked the code a little and now it does the searching and locks on the target… but only follows the target a little bit not it full range
Determine whether it is a full range issue or a speed of response issue. If you can move the target slow enough and it will follow the target to full range, it is a problem with speed. If the slow movement also stops, then it is range.
My guess is that it is speed, in which case the first thing I’d do is to insert a WPI camera VI after the open to set the image size to 320 or 160 size. Also close any front panels you have open for debugging.
If it really is a range thing, make sure it isn’t mechanical. Can you manually turn the gimbal that far? If it works manually, but not via SW, the example VI for moving the servo has SW limits which can be used to keep the camera from looking at the ceiling or floor for example. The initial limits were wide open for horizontal (0 - 169), but limited the vertical between 60 and 120 or something. If those have been changed and made default, they will limit the values sent to the servos.
My team has a similar problem as penguain does with the camera tracking.
Our camera has live feed when we run the Two Color Servo Camera Examplev1.vi or the Servo Camera Example.vi However our camera does not track when it is in Camera Display nor Gimbal Track.
For the Two Color Servo Camera Examplev1.vi our camera searches for the colors during Camera Display and the SERVOS can be manually moved when the knobs are turned in the Front Panel. However, when we switch to Gimbal Track, the camera is moving by itself searching for the colors but will never lock onto the specific color. (We have our fabric wrapped around a POOL NOODLE similarly to the trailer pipe.) We tried giving it some range and placed the colors vertically up as if it were on a trailer but the camera is not able to lock on and track it. What is my problem here?
For the Servo Camera Example.vi our camera is able to lock onto the Pink Color and track it according to the Front Panel of the VI. However, the camera does not physically move and the SERVOS are not responding. From browsing through Chief Delphi, I found out that this example needs a Watchdog to be added. My question is, will adding the Watchdog solve my problem or do I have to add/alter anything else? Also, how will I be able to track the Green Color??
Any comments or advice would be appreciated… THANKS!!
Are you trying to show it just one color at a time? The Two Color Servo Camera Example looks for one color immediately above the other as a target.
…will adding the Watchdog solve my problem or do I have to add/alter anything else?
Feeding the watchdog will keep it from disabling the PWM outputs. If your problem is that the servos don’t move, this should solve it.
Use the Radio button to stop the servo and determine if the vision portion is working well. What you want to see is pinkish red and green in the mask one above the other. If you aren’t picking up on both colors, you may need to find better lighting or adjust the numbers a bit.
If the colors mask well, then there are two possible problems.
You have build the gimbal differently than the code expected. It might be useful to disconnect one of the servos and test them independently with simple movements. If the gimbal seems to move opposite the direction it needs to, you can either fix it mechanically or open up the gimbal control VI and negate the proportion value on the panel. Make sure to make current values default when done.
It is also possible that you are holding the target upside down. the gimbal code only tracks the opposite color combination from what you say your robot is.
I successfully got both VIs tracking however at times it seems to lose its tracking. It would continuously search and will never lock until I specifically put the color in front of the camera. Can anyone tell me why this is happening?? Thanks a lot.
The previous debugging approach should work on this too.
Determine if it is the camera thresholds or not. I’m assuming it is from your description. Turn off the gimbal and watch the mask to get a feel for when it loses the target. If it is because of poor lighting, you may not want to fix it, just find a better place to test. If it is because of tilting the target, ditto. If it seems like a desired case to track, you can open up the two color subVI, click on the debug HSL button and put the mouse over the image to see what part of the HSL threshold doesn’t fit and by how much. You can then tweak the threshold numbers if you need to for that lighting.
Thanks a lot, it seems to be working better now.