Asked
— Edited
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 :
: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!
that's not how servos work. There is a tutorial that explains how servos work in the learn section - it will be an important read. Here's the direct link: https://synthiam.com/Tutorials/Lesson/48?courseId=6
There have been discussions in the forum regarding this question in the past. Here is the most popular answer:
Will this work Boris?
Hello Richard,
thanx for your idea! It works a little bit.
The biggest problem the reaction time. If i press the Sensor it takes seconds until the script stop.
@DJ what this numbers ($pos, 0, 70, 5) here means
Min Pos/ Max Pos/Speed or what?
Happy new year! Boris
From the script cheat sheet:
Repeat( variableName, startValue, endValue, increment )
so this script will start a servo at 0, go to 70, in increments of 5 every 50 ms and stop if the ADC reads less than or equal to 180.
Alan
Hello Alan!
Ok now i understand this, but one question.
Now i have this script:
This means:
Start @ 180 End @ 0 in 15 Steps/increments every 50ms
now the question. The Step takes not 50ms - the steps take almoust 1 second each step/increment. Or it means that the ADC check every 50ms?
Is this correct?
Boris
It should be doing both every 50ms, but if your servo is moving slowly, you may have a servospeed() in another script that has slowed it down.
Alan
Hello Alan,
no i have extra a script for servoSpeed (d0, 0) what i run first.
On a normal servo position ( servo d0, 5) the servo runs his fastest speed.
Now i was also thinking every 50ms ( and 50 ms seconds its really fast - not a second or more)
Boris
I know what you are trying to do now....
This is for your inMoov's hand so he can grasp an object, sense his grip so as not to burn his servos out... Good idea man... Too bad there isn't an easy way to read the current the servos are using... That way you can stop the servo before it would normally over stress and burnout....