>
> I'm working on a program to pan back and forth with a sensor, scanning
> constantly and stopping the pan every time the sensor detects
> something. The scanning and analysis of the scan are oEvents (where
> the scanning is activated by ooPIC.Hz1 for the time being), while the
> current panning code is below (and in the main subprocedure):
> Do
> Servo=10 ' Turn to roughly 30 degrees
> ooPIC.Delay=2000
> Servo=53 'Turn to 150 degrees
> ooPIC.Delay=2000
> Loop
> The code is functional, but there are a number of kinks I'm
> still trying to work out. For one thing, I'm almost positive the way
> I'm controlling the servo can be done more efficiently, but I'm not
> sure how:
>
> -Right now the speed of the pan is fairly fast. I know oServoSP will
> allow for speed adjustments, but the servo has limits (it can turn
> past these limits, apparently, but makes very angry grinding noises
> beyond a certain point). In addition, the angle of the pan is
> important, although I'd be willing to sacrifice a little accuracy as
> long as it doesn't start shifting its pan range in a circle. Is there
> a way to adjust the speed with oServo, or to adapt oServoSP for my
needs?
>
> -Checking the sensor once per second is kind of slow for what we're
> trying to do. That's not a problem - I've figured out how to use
> oClock to change the timing of the sensing. This problem arose for
> more frequent checks. Every time the servo stops in the middle of its
> arc on the detection and then begins moving again, it restarts the
> do-loop code. This means it is moving in a larger arc than 120
> degrees, which eventually means grinding noises and the sensor begins
> to turn around to look in the complete opposite direction of where
> it's supposed to. Is there a way around this, so that the servo pauses
> in the middle of its arc instead of restarting?
>
oServoSP outputs regular servo pulses and is really just another way
of looking at controlling the pulse width. For a normal servo, a
pulse of 1.5 mS every 20 mS results in the servo being centered in its
movement. A pulse of 1.0 mS moves the servo some angular distance in
one direction and a pulse of 2.0 mS movers the servo a similar
distance in the other direction. On some servos the pulses can range
from 0.5 mS to 2.5 mS and the servo will rotate nearly 180 degrees.
So, hitting the end of the range is something you need to address in
your code. Find out where the oServo settings hit the limit and don't
go there.
oServoSP is designed to use with a modified servo. In this case, the
servo internal electronics does what it usually does, attempting to
balance the feedback position as indicated by an internal
potentiometer with the command position based on pulse width. But a
modified servo disconnects the feedback potentiometer so the internal
electronics just keeps trying to get a match. Speed control is based
on the fact that the internal controller rotates the motor faster when
the error (difference between pulse width {commanded position} and
current position {potentiometer}) is large.
About the only way you can control the speed of a servo with the OOPic
is to make small steps with delays between each step being mindful of
the end points. Since this will be in a loop, it should be possible
to get your sensor event to pause the loop using some kind of flag.
Richard
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment