Hello,
i have one ( i hope easy) question.
i have a pressure sensor.
Work fine on the ADC!
Now i have one problem.
If the value for the ADC port is under 180 the servo must stop ( hold his position)
my idea of a script :Code:
:loop
$CurrVoltage = GetADC(ADC0)
if ($CurrVoltage <= 180)
servo (d0, "stop")
sleep(300)
endif
goto (loop)
But the command servo (d0, "stop") dont exist
So with command i can take what tells the servo he must stop and HOLD his position.
Thanx a lot for helping
AND FOR ALL A HAPPY NEW YEAR!
AND BIGGER ROBOTS NEXT YEAR!
Asked
— Edited
My initial example was the best so far. Simply change the REPEAT to have the max and min values of the gripper.
Alan
@Alan You are right!
Boris
I get what is trying to be done, but I'm not sure I understand the programming part of the problem correctly, so I'll ask some questions.
Are there two separate scripts running? That is, one script which is making the servo move however it should, and a second script that is monitoring the pressure sensors voltage? Then, when the voltage drops below 180 (or whatever) the second, "stop" script, stops the servo and the servo then holds the position it has at the moment it is stopped?
Also, is the stopping script supposed to stop the servo even if it is currently moving due to being sent a servo() command (or whatever) to make it move? In other words, let's say the command Servo(D4, 155) is sent, and the servo is slowly moving to the 155 degree position, is the stop script supposed to stop it dead before it gets to 155?
HAPPY NEW YEAR TO YOU!
Long time not hearing from you! I am happy to see you again!
To you question.
Yes it will be the best if i will have a monitoring script to check out which value the ADC ports have and when the value reach his point the script will stop the servo.
To understand here is a photo from my Inmoov Palm with the first finger who has 2 pressure sensors.
DJ Script works, but first problem the move is not smooth, because the servo moves now in 15 steps every 50ms and this is not smooth! And the second problem, its better to have a monitoring script, now i must copy the DJ Script in every moving script for the fingers what i have.
I hope this explains what i want to do.
Boris
EDIT.... On second thought never mind my idea won't work
Happy new year!
How i slow down the servo in DJ´s Script?
Code:
Code:
And from where the Servo/the variable knows to move to which position?
($pos, 180, 0, 15 )
Boris
EDIT:
Or work your script like a monitoring script (i am not near my Inmoov)
Code:
i understand now!
I will try in 2-3 hours, then i am back!
Boris
PS. And then i tell you if it works!
sorry it not works. If the value for the ADC is under the servo release not HOLD the Position! So this means if the Hand will hold something it will fall down.
The servo must hold his postions!
The best way until now is still the way from DJ!
Boris
Everything OK! I never was thinking to get a completer Robot!
Thats why i am asking! Do you know "Sesame Street"? Who not ask, will stay stupid!
Again Everything ok, you understand something wrong! Relax!
Boris
The basic problem here is that there seems to be no way to stop a servo (and get it to hold position) once it has been given the command to move to a certain position. This is why the solutions given have all involved a loop that tests the status of the pressure sensor as the hand is closed one small step at a time.
So, it seems to me the best way to do this would be to call a "Close Hand" script to make the hand close via a CommandControl instruction. Something like this:
Code:
"Close Hand" would be the name of a Script Manager which contains the "Hand Close" script described below. But you could put it in any script manager you wish.
Then the "Hand Close" script would be something like the ones already shown. My own would be:
Code:
The Sleep(20) statement may not be needed at all. You could try it with and without it in there. Or at least play with different values of sleep.
I have tested this with a JD claw, but I don't have a pressure sensor so I don't know how well it will work with the hand.
i check you script and it works a little bit better then from DJ (smoother, but still not the best)
But i found out the problem. If i run you script without the ADC check, the finger moves best off! If i let check the ADC Ports the finger will move not so smooth.
So its the reaction time of reading the ADC, who is not the best. I think at this point nobody can make it better.
I am not lucky with the choppy/juddery way of closing the fingers, but on other hand i think its a soloution for a not profi Home-Robot-Builder.
If someone has a idea, to maybe source out the ADC reading or else, i am open everytime for new tests!
Boris
PS: I will got some new servo for the Hand and more pressure Sensor. If i finish one Hand i will post a video.
1. The port is reading too fast and flooding the commutations link.
2. The port is reading too slow and each time it checks the servo needs to jerk forward to catch up to the reading.
I'm not sure that this method will control the speed of the ADC check in EZ scripts that you write but; In each of the 3 ADC port controls there is a interval setting. It's usually set at 500 ms. setting. It's usually set at 500 ms. After adding that control to your project and setting it to the port, try adjusting that up and down.
There may be other ways to get the ADC port to check values at different intervals. The repeat script command comes to mind. It has a interval setting.
Also, I've found if you leave these ADC controls running and checking ADC status they will slow down your system. Keep them paused till you really need to see performance.
Just some random thoughts on a couple things to try. Good luck.
Anyway, I found that using the ADC_Wait gave me the best responce and got everything working smoothly.
Code:
Here's another one that may work for you:
Code:
I don't understand what the difference in the results using the Inmoov hand and my tests using JD's claw. In my tests the claw closes smoothly while checking ADC0 and ADC1 in the test loop. Are you moving several servos to close the Inmoov's hand or just one? Do you have other things running at the same time that may actually be causing the problem? You may want to make a new test project with just the hand closing script in it to see if it runs smoothly then.
Running speed trials, I see it takes a bit less than 14ms to execute a GetADC instruction. A little less than 27 ms to execute the test statement (GetADC(adc0) <= 75) or (GetADC(adc1) <= 175) checking the two ADC ports. That should be plenty fast enough for smooth hand closing.
Are you using the latest version of ARC? JD has recently made changes that make the script execution much faster?
NO, i use a complete new clean Project, no other scripts are running.
I think i will make a video, then you can see more.
But that you got a smooth closing with you JD claw, brings me again a little bit hope!
I will check tommorow afternoon and i will report you.
Thanx for your Help!
@Dave yes i am also not lucky with the speed from the ADC port! I will also check your scripts and i will report.
Boris