S2 internal Pen Lifter and a couple questions for Phil
First, here's the Pen Lifter, it works awesomely well if I do say so myself...
See the blog entry for more details.
Now for some questions;
1. The speaker makes a constant but quiet tick tick tick at about 10 hz. Is that normal?
2. Could you take a look at this code? The goal is to control the S2 using my XBee equipped remote controller. The goal is met, it does control it quite well. The problem however is that I cannot get the S2 to maintain a perfectly steady speed. It is as if every second or two the motors will stutter for just a moment even though they are receiving a steady move value.
3. Related to the above perhaps, if I stop the S2 suddenly and then very gently reverse direction, it will lurch slightly.
If I have not described the issues adequately I can put a video on YouTube.
Rich H
See the blog entry for more details.
Now for some questions;
1. The speaker makes a constant but quiet tick tick tick at about 10 hz. Is that normal?
2. Could you take a look at this code? The goal is to control the S2 using my XBee equipped remote controller. The goal is met, it does control it quite well. The problem however is that I cannot get the S2 to maintain a perfectly steady speed. It is as if every second or two the motors will stutter for just a moment even though they are receiving a steady move value.
3. Related to the above perhaps, if I stop the S2 suddenly and then very gently reverse direction, it will lurch slightly.
If I have not described the issues adequately I can put a video on YouTube.
Rich H
spin
8K
Comments
Very nice pen lifter! And a beautiful installation! (I'm amazed it all fit.) In response to your questions:
1. No, the ticking is not normal. (At least I've never noticed it.) Does it do it all the time? What about if you don't start the audio cog?
2. The "stuttering" you observe is related to the encoder resolution and the way wheel movements are coordinated. In the motor driver object, the motion of each wheel is monitored in relation to the other one. If one wheel should get ahead, it will not receive PWM pulses until the other wheel has caught up with it. That way, if you grip one of the wheels during a movement to slow it down, the other will slow proportionally. Now, if the motion values going to the two wheels differ by a small number, say, two (e.g. 1000 and 1002), there will be two points along the trajectory where one wheel will appear to get ahead of the other (just due to the encoder math) and will hesitate while the other "catches up". This may be the "stutter" that you notice.
One may also notice a stutter during the drawing routines when drawing arcs. For example, when drawing a full circle, it is necessary to break it into two arcs. Sometimes the correct ending point for the first arc will not have integer coordinates, and you have to round them to integers. If, when the second arc begins, the arc radius is deemed too small for the distance to the ending point, the drawing software will move toward the ending point in a straight line, far enough to make up the extra distance, then draw the arc.
3. The lurching you see upon reversing direction may be related to backlash in the gearbox, but I'm not sure. If you post an example program that produces this behavior, I'll have a look at it.
-Phil
I've just discovered that the ticking vanishes completely when I turn off the remote controller and returns after it has turned back on and booted up - and is in sync with the XBee TX Led on the controller.
Looking at the well documented PASM motor code it looks like there should be something that I could do to disable the encoders, or at least the part where one is compared against the other. But since I don't really know PASM I do not know how to accomplish that.
I doubt that the lurching is gear backlash. It only occurs after the S2 is stopped abruptly while moving at faster than half speed. As soon as it begins to move again it appears to be trying to make up some encoder counts.
Rich H
Something about the problem with circles....(from LOGO Theory)
Try this algorithm: REPEAT(36) FORWARD (5 cm or any distance) ROTATE-RIGHT (10 degrees)
When I say Forward I mean both whees must have the same direction and velocity. If the s2 can rotate precisely 10 degrees you 'll have a perfect circle after the 36 steps.
I have tried this method 6 years ago with a homemade robot (with very cheap DC motors with no accuracy) and I had great results.
Unfortunately I don't have a s2 to try this but I believe that you 'll have result.
Nikos Giannakopoulos
Not sure why I didn't go that direction, maybe it's because I was hoping to use as much of the 'native' S2 code as possible. I think using a separate driver object is very sensible.
Rich H
Thanks,
Rich H
Here's a direct link.
http://www.youtube.com/watch?v=FqahLvqI-dk
Rich H
The controller is described in this thread.
RIch H
Here's another;
Rich H
That's even better repeatability than I would've guessed possible. Did you use the drawing commands in the S2 object? Did you have to tweak the calibration coefficients? (And what's with "SAINTS"? For Whit's benefit, I hope! Go Seahawks! Not that I give a rip. It's just for editorial balance. )
-Phil
"Saints" is for the Interlake Saints Robotics Team.
Rich H
Nice save! Um, go Saints! Yeah!
-Phil
http://forums.parallax.com/entry.php?89-Parallax-S2-writes-quot-Saints-quot-in-big-letters
And here is the code for the "A", any idea why it messed it up? It seems like it lost some encoder counts on the first two arcs.
Rich H
To properly scribble about my saints, you will need to scribble "Who Dat?" The church's saints are another matter.
Great job Rich!
who dat??? :frown:
-Phil
Hi Rich,
Inspired from your pen lifter I created an advanced Internal pen lifter. Althought the pen lifter lifts the pen Up and down perfect using the spin code: "s2_pen_lifter_test" it is not work in conjunction with the S2 Object. When the robot moves straight or makes arcs it is not able to move the pen up and down. I would be thankful if you could give some information about the methods "pen_up" and "pen_down" that you use in your code (above). Do you use multitasking for those methods?
Thank you
Nikos Giannakopoulos.
con
pen = 1
up = 1200
pen_up
servo.set(pen, up)
It will only work this way between line segments.
If you wanted to create dots or dashes during the line segment I think you could write a method that moves the pen based upon encoder counts - or at the minimum, time based.
I had already tried your advice but nothing....
here is the code:
I'm trying to draw this square with no continues sides using my S2 but the pen stays down...
On the other hand, the following code can lift up and down the pen without problem:
I use a Hitec Hs 55 servo connected on Pin P5 on hacker Port and the following motor characteristic
So the question is how can I make the S2 manipulate the Pen-servo while it moves using the S2 object commands?
What goes wrong with the first code?
Phil can you Help Please?
edit: I see you have multiple Servo.starts. you only need to call it once at the beginning of your program.
Try it without the begin_path and end_path commands, then call wait_stop before issuing a pen-up or pen-down. The reason for this is that drawing commands are semi-buffered to be executed in the background. A pen-up/draw-command/pen-down sequence is likely to be executed in rapid sequence before the draw command even has a chance to get started.
-Phil
Nothing again.....
The servo makes only a small reaction in the first command (Pen_Down) end then nothing. It is like doesn't exist....
I wrote the following: Unfortunatelly the problem remains.
-Phil