Lumpy
Canada
Asked
— Edited
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.
: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.
: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
The Speed of the dome might me too quick. Is it connected to an hbridge? If so, try slowing it down and see what the test results are. Slowly start speeding it up and until it begin missing again.
Prior to running this script it ramps down to the slowest speed possible. Still 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.
Sorry for your frustration. To the best of my knowledge finite control using a pot and a dc motor is not possible with EZ-Robot. Here's my theory: The only limitation of EZ-Robot that I have encountered is that it is based on client server architecture. As most programmers know that is frequently the slowest method of negotiation between two software programs. You need at minimum millisecond response time between the EZ-B and ARC for precise motor control. Your EZ-B communication is handled most likely using the Bluetooth stack and your windows environment. This setup is likely to induce small delays as there are a variety of factors competing for time in the control stack.
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:
https://synthiam.com/Community/Questions/3777
LOP,
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.
I think I found what I need! Crap, I just had an order shipped last week from them! ugghhh!
www.dimensionengineering.com/products/kangaroo
Hey Lumpy,
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:
This is an example of a script sending the stopping point varable. I also have PWM settings that provide ramping effects:
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):
Hope this helps. Let me know if I can help more.
Dave Schulpius
New feature: https://synthiam.com/Community/Questions/3883
You can do something like this now..
Do not use ADC_WAIT() because you won't always get the exact value for your application.
Thanks DJ for the tweak and pointing us to the new command. I probably would have missed it.
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.
It's working great so far. I'm still fiddling with the delay but it's making my script above 100 times better now!
Once again DJ rocks!
Kris
I think you offered cookies or beer to find a solution? I'll take both!
Next trip in. I'll bring you guys and gals some goodies.
Deal!