Subject:
|
Re: Competitive MINDSTORMS: try again...
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 20 Aug 2004 16:09:37 GMT
|
Viewed:
|
1213 times
|
| |
![Post a public reply to this message](/news/icon-reply.gif) | |
In lugnet.robotics, Steve Hassenplug wrote:
> In lugnet.robotics, David Perdue wrote:
>
> given this piece of code:
> ----
> > > > So let's look at this portion of code:
> > > >
> > > > /* if Input Port 1 is less than "thresh" or
> > > > * equal to 100*/
> > > > if(LBump<=thresh | LBump==100)
> > > > {
>
> <snip>
> > > > // ...attack!
> > > > until(LBump==thresh+5); // until sumo-bot goes away
>
> <snip>
> > > > }
>
> void Calibrate2()
> {
> <snip>
> thresh=LBump;
> <snip>
> }
>
> ----
>
> 'thresh' will be reading the ambient light in the room. (from the calibrate2
> function)
>
> The 'search' routine will immediately go into attack mode (low gear) because
> (LBump<=thresh) is true, because both LBump and thresh are both reading the
> ambient light in the room.
> At no point will the reading on LBump go above 'thresh', unless the light sensor
> is pointing towards a white robot. So, the loop:
> until(LBump==thresh+5);
> will never exit (unless you see a white robot, in which case you DON'T want it
> to exit, but it will)
This is actually incorrect - I see where you're getting confused. You are
thinking that the Calibrate2() function is always running, and the
"thresh=LBump;" is always being updated, correct? You see, Calibrate2() is only
run just once, and never again in the entire program. It provides the program
with a reading of the light in the room once, but never again. After the very
beginning of the program, Calibrate2() is completely ignored, and the value of
the variable thresh is never again changed.
Therefore, in this line of code:
if(LBump<=thresh | LBump==100)
the first part says that if LBump is less than the value of thresh--whose value
was adjusted only once, and will not change again--then we know we have the
opponent in sight. Likewise, if LBump starts to read that it is equal to
thresh+5--a value which is taken once and will never change--it knows that it
has lost sight of the opponent.
Thanks,
David J. Perdue
www.davidjperdue.com
www.davidjperdue.com/competitivemindstorms
|
|
Message has 1 Reply: ![](/news/x.gif) | | Re: Competitive MINDSTORMS: try again...
|
| (...) No, that's not what I was thinking. I see Calibrate and Calibrate2 only run at the beginning of the program. (...) Actually, it says that if LBump is less than OR EQUAL TO the value of thresh... Which means if the light in the room NOW is the (...) (20 years ago, 20-Aug-04, to lugnet.robotics)
|
Message is in Reply To:
![](/news/x.gif) | | Re: Competitive MINDSTORMS: try again...
|
| In lugnet.robotics, David Perdue wrote: given this piece of code: ---- (...) <snip> (...) <snip> (...) void Calibrate2() { <snip> thresh=LBump; <snip> } ---- 'thresh' will be reading the ambient light in the room. (from the calibrate2 function) The (...) (20 years ago, 20-Aug-04, to lugnet.robotics)
|
29 Messages in This Thread: ![Competitive MINDSTORMS: Now in a store near you! -David Perdue (17-Aug-04 to lugnet.announce, lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Steve Hassenplug (19-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/246.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (19-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/246.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Steve Hassenplug (19-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -Steve Hassenplug (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![You are here](/news/here.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -Steve Hassenplug (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -David Perdue (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -Steve Hassenplug (21-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -David Perdue (21-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -Steve Hassenplug (21-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -Chio Siong Soh (24-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: try again... -Steve Hassenplug (24-Aug-04 to lugnet.robotics)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Brian Davis (19-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/246.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Brian Davis (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/246.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Joe Strout (20-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (20-Aug-04 to lugnet.robotics)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (20-Aug-04 to lugnet.robotics)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Competitive MINDSTORMS - at Sumo-bot 6? -Steve Hassenplug (28-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/246.gif) ![Re: Competitive MINDSTORMS - at Sumo-bot 6? -Jon Gilchrist (28-Aug-04 to lugnet.robotics)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Competitive MINDSTORMS - at Sumo-bot 6? -David Perdue (1-Sep-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS - at Sumo-bot 6? -Steve Hassenplug (7-Sep-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS - NOT at Sumo-bot 6? -Steve Hassenplug (14-Sep-04 to lugnet.robotics)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Brian Davis (22-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (23-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -Brian Davis (23-Aug-04 to lugnet.robotics)](/news/x.gif) ![](/news/46.gif) ![Re: Competitive MINDSTORMS: Now in a store near you! -David Perdue (23-Aug-04 to lugnet.robotics)](/news/x.gif)
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|