[Robotgroup] Robot Head: BS2 Stamp programming Help?!
Gray Mack
gray_mack at yahoo.com
Tue Aug 5 11:06:30 PDT 2008
FOR p = 0 TO 255
PULSOUT PIN_PanTilt_Pan, POS_PanTilt_Pan
PULSOUT PIN_PanTilt_Tilt, POS_PanTilt_Tilt
NEXT
This seems to send pulses very rapidly which might confuse the servo.
Each servo needs a pulse every 10-30msec and about 20 is ideal so a pause may be needed in that loop.
But this still doesn't help the
DEBUGIN DEC COMDATA
I didn't see debugin in my manual but serin has a timeout option and without a timeout, this command will wait forever for data in and likely longer than 20 msec before your next packet arrives?
-Gray
--- On Tue, 8/5/08, LHudson <lhudson73 at yahoo.com> wrote:
> From: LHudson <lhudson73 at yahoo.com>
> Subject: Re: [Robotgroup] (no subject)
> To: "The Robot Group Mailing List" <robotgroup at puremagic.com>
> Date: Tuesday, August 5, 2008, 12:54 PM
> Right, that's why I added the two PULSOUT lines right
> before the "LOOP", to keep the servos refreshed.
> These two lines are actually what are causing the issue that
> I am having... it seems to be re-booting or re-starting
> continuously.
>
> --- On Tue, 8/5/08, Paul Atkinson
> <pmatkinson at gmail.com> wrote:
>
> From: Paul Atkinson <pmatkinson at gmail.com>
> Subject: Re: [Robotgroup] (no subject)
> To: "The Robot Group Mailing List"
> <robotgroup at puremagic.com>
> Date: Tuesday, August 5, 2008, 1:39 PM
>
> Scott,
>
> Most servos have to be "refreshed" every 20ms in
> order to work
> normally.
> There is a feature in the servo that stops applying voltage
> to the motor if
> an input pulse isn't seen. I don't think the BS2
> does this
> automatically, so
> you need to have a loop that will "feed" the
> servo.
>
> Paul
>
> On Tue, Aug 5, 2008 at 10:28 AM, LHudson
> <lhudson73 at yahoo.com> wrote:
>
> >
> > I've included my code module as an attachment.
> >
> > I have four pins connected to a "Mouth
> Module" with LEDs that
> light up.
> > The Serial Port is tied to a DOT NET speech
> programming API event. The
> BS2
> > "listens" for the Serial data inside of a
> DO...LOOP:
> >
> > DO
> > '~ SERIN 16\0, BAUD, [DEC COMDATA]
> > DEBUG CR, "Enter Command: "
> > DEBUGIN DEC COMDATA
> >
> > SELECT COMDATA
> > CASE CMD_Mouth_Pin2_ON: HIGH 2
> > CASE CMD_Mouth_Pin2_OFF: LOW 2
> > CASE CMD_Mouth_Pin1_ON: HIGH 1
> > CASE CMD_Mouth_Pin1_OFF: LOW 1
> > CASE CMD_Mouth_Pin4_ON: HIGH 4
> > CASE CMD_Mouth_Pin4_OFF: LOW 4
> > CASE CMD_Mouth_Pin5_ON: HIGH 5
> > CASE CMD_Mouth_Pin5_OFF: LOW 5
> > ENDSELECT
> > LOOP
> >
> > I am happy to report that the mouth movement is quite
> realistic and
> > entertaining, even when tied to the Speech API Events!
> I will bring this
> to
> > the Show & Tell on Thursday. Also, this is weird,
> but it doesn't
> matter if
> > you use the SERIN or the DEBUGIN Code, it still works
> the same whether you
> > are using the DOT NET Serial Interface or the Stamp
> Editor?!
> >
> > But okay here is my actual question: I am having
> problems with the Pan
> &
> > Tilt servos that are attached to the head. If you
> inspect the code
> > attachment, you can see the input processing to
> determine the servo
> > position. With some experimentation, I was able to
> engineer it so that by
> > inputting a command, e.g. "1010" or
> "2130" I was able
> to position the
> > head... not with 100% consistency, but it's a good
> start.
> >
> > The problem is that if there is no command to execute
> the Pan & Tilt,
> then
> > the servos receive no PULSOUT. With no charge to the
> motors, the
> slightest
> > bump can cause a severe case of whiplash. My
> tentative solution was to
> put
> > additional PULSOUT codes before the ...LOOP:
> >
> >
> > DO
> > '~ SERIN 16\0, BAUD, [DEC COMDATA]
> > DEBUG CR, "Enter Command: "
> > DEBUGIN DEC COMDATA
> >
> >
> > ENDIF
> >
> > PULSOUT PIN_PanTilt_Pan, POS_PanTilt_Pan
> > PULSOUT PIN_PanTilt_Tilt, POS_PanTilt_Tilt
> > LOOP
> >
> > However
> >
> > L. Scott Hudson
> >
> > "There are known knowns. These are things we know
> that we know. There
> are
> > known unknowns. That is to say, there are things we
> know we don't
> know. But,
> > there are also unknown unknowns. These are things we
> don't know we
> don't
> > know."
> >
> > -- Donald Rumsfeld, describing the IBM "Rational
> Software"
> Platform
> >
> >
> >
> > _______________________________________________
> > Robotgroup mailing list
> > Robotgroup at puremagic.com
> >
> http://lists.puremagic.com/cgi-bin/mailman/listinfo/robotgroup
> >
> _______________________________________________
> Robotgroup mailing list
> Robotgroup at puremagic.com
> http://lists.puremagic.com/cgi-bin/mailman/listinfo/robotgroup
>
>
>
>
> _______________________________________________
> Robotgroup mailing list
> Robotgroup at puremagic.com
> http://lists.puremagic.com/cgi-bin/mailman/listinfo/robotgroup
More information about the Robotgroup
mailing list