Using PULSOUT & PAUSE 1 for Motor Control
the_professor
Posts: 7
So I recently found out about pairing PULSOUT and PAUSE to get more precise control of the motors on my Scribbler. First PULSOUT determines the speed,·PAUSE 1 tells the motor that the next·PULSOUT·indicates time duration.·Here's my question: I found the following code as an example from Parallax:
‘ Drive in an arc to the right for 3 seconds
PULSOUT MotorRight, 2400
PAUSE 1
PULSOUT MotorRight, 2200
PULSOUT MotorLeft, 2600
PAUSE 1
PULSOUT MotorLeft, 2200
Only thing I'm not clear on is how/why a duration of 2200·ms corresponds to a drive time of ~ 3 seconds (I tested this and it is about 3 seconds). I understand there's probably some lag time between the first PULSOUT·command and the second, but considering that all the of the·right motor commands go before the left, it can't be that significant (at least·not about 800 ms worth).·Thoughts?
‘ Drive in an arc to the right for 3 seconds
PULSOUT MotorRight, 2400
PAUSE 1
PULSOUT MotorRight, 2200
PULSOUT MotorLeft, 2600
PAUSE 1
PULSOUT MotorLeft, 2200
Only thing I'm not clear on is how/why a duration of 2200·ms corresponds to a drive time of ~ 3 seconds (I tested this and it is about 3 seconds). I understand there's probably some lag time between the first PULSOUT·command and the second, but considering that all the of the·right motor commands go before the left, it can't be that significant (at least·not about 800 ms worth).·Thoughts?
Comments
What type of controller are you using with this? For example, BS2, BS2pe, BS2sx?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
·
My apologies, I didn’t catch that the first time I read it. The Scribbler uses an H-Bridge to controller the motors; which normally you would see a value of 1 - 2 ms for the pulse. There is a small amount of tolerance outside the 1 – 2 ms pulse, but I don’t see how the second PULSOUT is controlling the pulse duration.
·
The PULSOUT command is formatted like the following:
Command, Pin#, Duration
With that, you can determine that the PULSOUT command is given, it waits 1ms, and then sends a slightly different pulse as though it were ramping or something like that.
·
Can you upload the whole code with the attachment manager? Perhaps the program around that routine will help explain more about the program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/scribbler/HackersHintsWithCode-v1.zip
The included PDF lists this functionality on pages 5-6.·I attached my own .bs2 file that does this. Could the PDF that's included there be erroneous (IE whoever was writing just wasn't thinking at the time?)
Thanks in advance for your help!
That is the additional way to program the scribbler; let me speak with the instructor which wrote that application note and I will get back with on that. I have not personally programmed the Scribbler in that manor.
Thanks for your patience,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
I have contacted our editors, and it turns out the material in question was made by an engineer of the manufacturer. Unfortunately that person is no longer with Element (the manufacturer of the Scribbler). The Scribbler has a co-processor that ultimately allows for that alternative programming, but there is not a great deal of supporting documentation other than what you have already·found.·I have sent off for any materials that might help, and I will be sure to post them as I get them.
Sorry for any inconvenience,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
Please update this thread with any details·when·you get them.·Whit and I will be checking back!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
There is a missing carburetor, but it is inconclusive as to its where abouts.
I will be sure to update this thread with any docs that I get that will help this subject.
Thank you all for your patience.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
The first pulsout sets the motor speed and direction.· If the second pulsout is sent, it sets a motor run time.· The second pulsout is optional, if it isn't sent then the motor just run forever.· This lets the user program more precise movements but still do other things with the stamp like watch the sensor while the robot is running. See page 5 of the hacker hints for more info
Here is the PDF that is referenced; however this is the same PDF that is in the zip file above. Please let me know if you have questions.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
As the_professor·stated, the PDF "Hacker's Hints for the Scribbler Robot" has·some minimal·info on this "special function" as it is called. The second pulsout (after the 1 ms pause) uses duration values of 1000 to 3000, where 1000=zero seconds and 3000=five seconds. Proportional values give proportional durations: 1400=1 second, and·per the_professor's findings, 2000=~3 seconds.·Maybe closer to 2.5 seconds if·it's linearly proportional.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
The gents over at Element said that was all the docs they had for this alternative to programming the scribbler, so I dont see an addition to the doc anytime in the near future.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."