Subject:
|
Re: NQC Code
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 4 Dec 1998 05:53:17 GMT
|
Original-From:
|
Nancy Evelyn Gold <nancyg@sgi&NoSpam&.com>
|
Viewed:
|
3316 times
|
| |
| |
John Donaldson wrote:
>
> I got two questions.
>
> 1. How do you use the timer() function under NQC?
> 2. What is best way to determine if bot is stuck in corner make it turn
> 180 deg to get out?
Based on the first question I would think you're on the right track.
Counting the number of turns in a given time period is key. It
impressed the hell out of the folks at the office when the rover
would back out of a corner and turn around.
The below code includes some crude semaphore code. The sound
was for debugging.
No rude comments, this was my first NQC code and the first C code
I've written in two years. :-)
--- Nancy
Some sample code:
#define FUTILE_INT 200
#define FUTILE 1
#define FUTILE_THRESH 4
task corner_detect
{
while (true)
{
// I added the OR while playing with the code, not sure why
//
if ( (Timer(FUTILE) > FUTILE_INT) || (turns > FUTILE_THRESH) )
{
if (turns > FUTILE_THRESH)
{
while (lock_turn != 0) Sleep(1);
lock_turn = 1;
stall = 1;
PlaySound(3);
timed_reverse();
about_face();
lock_turn = 0;
stall = 0;
}
turns = 0;
ClearTimer(FUTILE);
}
}
}
--
Nancy Evelyn Gold (nancyg@sgi.com)
1993 BMW K1100LT "Chloe" - DoD# 1184 - BMWMOA
++ Only Open DVD Delivers! Just say no to DIVX. ++
|
|
Message has 1 Reply: | | Re: NQC Code
|
| Nancy, Sorry for not getting back sooner. Been outof town. Anyway, thanks for the reply. This is what I am looking for. I am going to combine this wirh another routine. Basicly 1. Right Touch Sensor hits object. RCount += 1; IF RCount >= 2 { RCount (...) (26 years ago, 9-Dec-98, to lugnet.robotics)
|
Message is in Reply To:
| | NQC Code
|
| I got two questions. 1. How do you use the timer() function under NQC? 2. What is best way to determine if bot is stuck in corner make it turn 180 deg to get out? John A. Donaldson (26 years ago, 2-Dec-98, to lugnet.robotics)
|
5 Messages in This Thread:
- 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
|
|
|
|