Subject:
|
Re: Short term memory ablut sensor input???
|
Newsgroups:
|
lugnet.robotics.rcx
|
Date:
|
Fri, 22 Sep 2000 07:05:24 GMT
|
Reply-To:
|
NOSPAM-DCCHEN@PACBELL.NET-nospamNOSPAM
|
Viewed:
|
2108 times
|
| |
| |
Gerry Normandin wrote:
>
> Can you remember a touch sensor reading? This way by using only one light
> sensor as an irpd, I can detect which way to turn to avoid the obstacle.
The program doesn't actually record in the Vectors array any information
about
where it saw an obstacle. It just records which direction the robot
went and
how far (according to the rotation sensor) during the last leg of the
journey.
Each time the robot changes direction (because of an Obstacle detection
event
triggered by the IRPD sensor), it records what new direction it turns to
and
then starts counting off distance again.
If I understand your question correctly, you are using IR Messages from
the
RCX along with the Lego Light Sensor to sense obstacles on one input,
and
an additional touch sensor on the remaining input. Sure just redefine
the
Interrupt routine Obstacle below.
Assuming you keep these definitions that indicate which way the obstacle
is
located up ahead...
> > #define OLeft 1
> > #define OBoth 2 /* Both Left Front and Right Front has an obstruction */
> > #define ORight 3
> > #define ONone 0
> > wakeup_t Obstacle(wakeup_t t) /* Check for IR Proximity detection */
> > {
> > ODir = LIGHT_2; /* Get a reading */
> > if(LIGHT_2 > 250)
> > ODir = OBoth;
> > else if(LIGHT_2 < 45)
> > ODir = OLeft;
> > else if (LIGHT_2 < 150)
> > ODir = ORight;
> > else ODir = ONone;
> > return (ODir); /* Returns location of Obstacle if any */
> > }
Instead of checking LIGHT_2 (which for me was the IRPD sensor), re-write
the code
how you want to return in ODir the direction of any oncoming
obstructions.
ie. If you are using 2 touch sensors on ports 2 + 3, you could change
the code
very easily.
Variations abound.
Dave
|
|
Message is in Reply To:
| | Re: Short term memory ablut sensor input???
|
| Can you remember a touch sensor reading? This way by using only one light sensor as an irpd, I can detect which way to turn to avoid the obstacle. (...) */ (...) turning */ (...) */ (...) travel */ (...) */ (...) ------ (...) */ (...) ------ (...) (...) (24 years ago, 21-Sep-00, to lugnet.robotics.rcx)
|
8 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|