Question for Erco
neerdowell
Posts: 25
Erco, I saw a video you posted but now I can't find it again. It was using the blue scribbler and I think you called it something like "object following". You held your hand in front of the robot and it stopped; you moved your hand left and right and the robot turned in that direction. You moved your hand toward the robot and the robot went in reverse, away from your hand. You moved your hand away from the robot and it moved forward to follow your hand.
My question: do you have the scribbler 2 GUI file for that example? I think it was pretty cool and I'd like to use it during a demo.
My question: do you have the scribbler 2 GUI file for that example? I think it was pretty cool and I'd like to use it during a demo.
Comments
http://www.youtube.com/watch?v=_M4sPnuu37U
a:FREQOUT 14,1,38500
B0=IN6
LOW 14
FREQOUT 15,1,38500
B1=IN6
LOW 15
IF B0=0 THEN PULSOUT 12,1600
IF B0=1 THEN PULSOUT 12,2400
IF B1=0 THEN PULSOUT 13,1600
IF B1=1 THEN PULSOUT 13,2400
GOTO a
Scribbler has undergeared motors, so there's a lot of lag and overshoot, which limits the tracking speed. S2 supposedly has more powerful motors, so it may be able to track at higher speed.Let us know how you do!
I'm going to try to do this on the S2, but I'm really a newbie and have no experience with the BASIC stamp. I see that FREQUOT activates the speaker, but I didn't notice any sound on the video except the sound of the motors. I see that PULSOUT turns the wheels, but I haven't done any programs yet involving the IR sensors, so it's going to take me awhile to come up to speed on this. If anyone wants to take a stab at this and post the results, I would appreciate it as I try to learn it myself.
Thanks Erco.
Don
I'm not sure if you realize the S2 uses a Propeller while erco's code is for a Basic Stamp used by the S1. If you look in the OBEX for BS2_Functions, you'll see how to translate erco's code to Propellerese (aka Spin).
OK, thanks Duane, I wasn't aware of that resource. Yes, I did know that S2 is propeller-based while S1 is Basic Stamp-based.
I see how BS2_Functions allows you to essentially convert Basic Stamp commands to Spin code. I'm just starting out with S2, using the GUI, and I'm preparing to teach my middle school students something about programming by using the S2. I want to start out with just the GUI this year, and maybe next year get into Spin, so what I really had in mind here is the GUI equivalent of Erco's Basic Stamp code. I started that last night and was able to get the robot to turn left or right based on seeing an object either with the left or right IR sensor, but now I need to figure out how to make it go forward (or backward) to "follow" the object. I've only had the S2 for a few weeks now, so I'm trying to learn the tricks of how it works.
Thanks for pointing me to that resource.
Don
Don: Great job, you're almost done then! All my program does is test each two IR sensors and drive the wheels forward or backward accordingly:
Left wheel drives reverse if left IR sensor detects anything, drives forward if nothing detected.
Right wheel drives reverse if right IR sensor detects anything, drives forward if nothing detected.
Lather
Rinse
Repeat!
I experimented and selected one wheel speed (same forward and reverse) for best tracking.
So many variables here: how many consecutive times does it need to see the object, what speed to use (I've tried 100, 50, and 20 and none seem to be ideal), when I set the speed of the left and right wheels, do I need to provide a time?
I'll keep plugging away.
Thanks for your help.
Don
1. no obstacles reported on either IR sensor
2. obstacle reported on both sensors
3. obstacle reported on the left sensor only
4. obstacle reported on the right sensor only
I know how to test for these 4 cases, what I don't know is what to do in each case in terms of wheel movement. And when the obstacle gets too close to the robot, the robot needs to move backwards. I don't know how to test for that condition, unless it involves how many consecutive times the obstacle must be observed in order for it to be true.
I'd appreciate any enlightenment here. Thanks.
@neerdowell - great project converting this to the S2, I will check it out...
Don
This has been a fun learning experience. Thanks for your great example with S1.
Don
Yes, I also see see see see that pretty often.
It does happen at the end of a line.