Subject:
|
Re: January 2007 SMART meeting notes
|
Newsgroups:
|
lugnet.org.us.smart
|
Date:
|
Thu, 1 Feb 2007 00:52:16 GMT
|
Viewed:
|
6265 times
|
| |
| |
In lugnet.org.us.smart, Gus Jansson wrote:
> In lugnet.org.us.smart, Steve Hassenplug wrote:
> >
> > How well do the ears work? Could it turn towards sounds?
> I will let you know.
I did some testing with encouraging results and programmed the robot to respond
to sound this morning. My testing indicated that even if the sound was straight
ahead, one sensor gave a higher raw signal then the other so I came up with a
constant that I add in after I subtract one raw value from the other. The code
looked something like:
while (true) {
do {
LeftEar = Sensor(IN_LEFT_EAR);
RightEar = Sensor(IN_RIGHT_EAR);
} until ((LeftEar + RightEar) > 700); // until loud sound detected
d = LeftEar - RightEar + 60; // 60 is est. difference between sensors
// when subjected to relatively loud sounds
// from dead ahead
SetStepControl(120-d, 120+d);
RotateMotor (OUT_DRIVE, 100, 360*10); // Walk 10 steps
SetStepControl(0, 0);
}
(Note: actual code has a few details like Wait's that I have skipped)
SetStepControl is the cover for the servo code to set the step size for each
side. At some point the actual angle gets restricted to the range -130 to +130
so no harm passing very high or low values.
What happens is that if the sound is from the side the robot, the difference is
great enough that the robot does an about turn towards the sound and then stops.
If the sound is from dead ahead, it will walk 10 steps directly towards the
sound. If the sound comes from about 45 degrees, the difference is small enough
that the robot will take 10 steps with a somewhat gradual turn towards the
sound. If the sound is really loud from right behind, it gets so scared it
walks away :)
It is far from perfect and I think that it can be made much better with a little
smarter analysis of the sensor data but the effect is still pretty cool. Today
I brought the robot in to a 5th grade class where I have been teaching and it
was a pretty big hit.
Gus
|
|
Message is in Reply To:
| | Re: January 2007 SMART meeting notes
|
| (...) Thank you. (...) This robot was just finished before the meeting so the ears went on but I never got a chance to program them. The idea is just as you describe and I did try use the View feature to see how directional the sound sensor is. My (...) (18 years ago, 30-Jan-07, to lugnet.org.us.smart)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|