NEED HELP! Target following webcam...
ksycheng
Posts: 11
Hi all,
My project is to make a webcam that is going to following a certain target wearing a certain color belt.· I used a webcam to obtain a unique set of RGB values and then process the values using C++ and find out the angle the webcam needs to rotate in order to get the target in the middle of the view...
I don't know how to obtain the angle information from C++ through the serial connection and how to get the servo motor to rotate accordingly...
PLEASE HELP!!!
My project is to make a webcam that is going to following a certain target wearing a certain color belt.· I used a webcam to obtain a unique set of RGB values and then process the values using C++ and find out the angle the webcam needs to rotate in order to get the target in the middle of the view...
I don't know how to obtain the angle information from C++ through the serial connection and how to get the servo motor to rotate accordingly...
PLEASE HELP!!!
Comments
Once you're able to export the data (RS232 or something), getting a basic stamp to control the servos is a breeze.
Dave
also...I am NOT using a Parallax servo motor and the pulsout command doesn't seem to work...do I HAVE TO have a Parallax servo motor? because now, I can't really control the servo motor how much to rotate...I have a Hitec servo motor now...
You need to figure out how to get your C++ program to communicate asyncronously (like RS232; i.e. 300bps-9600bps), and I'm not sure if many people that read these forums are experienced with that. Once you can output data from your C++ program, all you need to use is the SERIN command with the BS2 in order to receive the data from your C++ program.
but anyhow, I NEED TO have a Parallax Servo Motor in order to use the PULSOUT function, right?
Good to see you back Dave, haven't seen you in a while, though that may be due to me not having enough time to stay current with the Basic Stamp Forum.
<edit> Found it, here's the synopsis I was refering to: http://forums.parallax.com/showthread.php?p=566049·</edit>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is one giant teacup ride.
Post Edited (Paul Baker) : 7/7/2006 7:37:07 PM GMT
when I send a pulse let's say PULSOUT 13,650, it would just shake and wouldn't move at all.....even if I send a pulse of 600 it's the same...I don't know y...
I had to use for loops to control the movement of the motors...
I don't think there is anything wrong with my connection...
I connected the servo motors according to the colours given and the bottom (4th) pin to the I/O pin 13...
Please assist...
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is one giant teacup ride.
wouldn't the PULSOUT 13, 600 work?
This only solves part of the equation. In order for the servo's to be happy, you need to repeat the above command (or the alike) every
15mS to 25mS. So your code might look something like this...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
SERIN 16, 85,[noparse][[/noparse]SDEC3 myNum]
what does the first number (16) and second number (85) mean??? I want it to read in a signed 2 digit number, I just need the range of -90<-->90, however, I can't get it to work.......
SDEC3 is interpreting a signed 3 digit decimal number, right???
Thanks again for all your help~~
If you are using the latest PBASIC editor, you can type "SERIN" or any other command and highlight it by pressing 'SHIFT + HOME' and then press F1.
This should bring up a help screen with all of the information you should need.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is one giant teacup ride.
I don't want the webcam to go through steps...I want it to rotate smoothly, would it still rotate smoothly for the standard servo??
The only difference between the two types is the feedback in a continuous rotation servo is cut and set so that the servo always thinks it's centered. Read my post in the link provided to get an understanding of the mechanism.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is one giant teacup ride.