
Lumpy
Hey All,
Trying to tweak my dome control scripts.
My Hot Pot potentiometer outputs a number from 0-212 on ADC7
Here is a few variations of the script I'm trying to use.
My main goal is to have the dome spin and stop on or close to the number I desire.
There is some momentum delay to stop but I can work that out.
Here are the scripts snipped from my main scripts *Notes* Added for clarification.Code:
:CenterR
$DomePosition=GetADC(adc7)
ADC_Wait(adc7, EQUALS, 106) *Dome Center is 106*
Servo(D3, 50) *Sets servo Control for Syren10 Full Stop*
Sleep(500)
Release(D3)
$DomeDirection=3 *Control Variable*
$DomeServo=50 *Control Variable*
Goto(Stop)
I've also tried with a little more luck.Code:
:CenterR
$DomePosition=GetADC(adc7)
ADC_Wait_Between(adc7, 104, 107) *Dome Center is 106*
Servo(D3, 50) *Sets servo Control for Syren10 Full Stop*
Sleep(500)
Release(D3)
$DomeDirection=3 *Control Variable*
$DomeServo=50 *Control Variable*
Goto(Stop)
The ADC_Wait never seems to catch the reading from ADC7 the
first go around. I'm lucky if it catches it on spin 2 but sometimes
it goes 3-4 times around before it catches it.
What am I doing wrong?
Am I going about this all wrong?
Suggestions? Cookies? Beer?
Kris
misses the mark quite often.
I have a script that I can run to monitor position and at full speed it can keep
up and show the dome position accurately.
Just seems like the ADC_Wait / ADC_Wait_Between are "sleeping" and missing
their mark.
When I asked a very similar question to this one, a couple of weeks ago, in regards to controlling a MR. Clock Radio modded robot head the only response I received was that a servo controllers somehow needed to be hacked/wired to the DC motors and pots. There was no additional instruction or documentation on how to accomplish this. The idea was at best described vaguely in a causal non-technical approach.
So for the sake of brevity, the best advice I can give when using dc motors, pots and the EZ-B: Abandon all hope ye who enter here. Use a servo
Should you continue down the low road, see this code for additional insights:
http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=3777
DJ was discussing the possibility of using the pot with a servo controller board
and an H-Bridge to make a giant servo like setup.
I'm going to go back and review that thread. My only issue was using an H-Bridge,
I wasn't quite sure if my Syren10 would work with what he described.
I'll tinker and see what I can come up with.
www.dimensionengineering.com/products/kangaroo
I wish I had more time to spend with you on this but lots of family stuff going on right now. I'll try to help as mush as possible and I'll have move time this weekend if you need.
I was having this exact same problem. I could not get my DC rotation motors to stop at a stated point using ADC feedback of a pot. Any method I tried in a script of trying to stop at an exact point failed. It would shoot right past where I wanted to stop most of the time. So here's what I did with both the waist and radar section on my B9. I used math and a spread of the pots output numbers so if it would pass the given variable by a few points it would still stop. I know this is not an exact and finite stopping point control but I'm OK with the outer stopping places being close. The only real place I wanted them to stop almost exact way on center (looking forward) and that was even OK to be a little off. Anyway, I wrote a movement script (with help from others on this forum) that would receive a variable number that represented a stopping point on my turning radius. The variable number would be read from the pot connected to an ADC port. Then I could write another script that would send that variable or and number of variables and I would get my rotation animation. Now for the centering of the motors I would have a centering script that could be run that would move the motors to center no matter where the rotation stopped along the radius. I usually send the centering script twice with a sleep command between them just incase it doesn't end up centered the first time. Sounds complicated but it's really simple and works great. So here is an example of the movement script:
Code:
This is an example of a script sending the stopping point varable. I also have PWM settings that provide ramping effects:
Code:
Here is an example of a centering script (as you can see in the above script I have it being called at the end of the script):
Code:
Hope this helps. Let me know if I can help more.
Dave Schulpius
You can do something like this now..
Code:
Do not use ADC_WAIT() because you won't always get the exact value for your application.
I need to study how this will work. Not really sure right now. However once I figure it out it looks like this may make my scripts much simpler.
Once again DJ rocks!
Kris