To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.spyboticsOpen lugnet.robotics.spybotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Spybotics / *411 (-5)
Subject: 
Re: Spybot studies: seek a world object
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Tue, 18 Oct 2005 13:20:47 GMT
Viewed: 
10355 times
  
On Tue, October 18, 2005 5:05 am, Allen Benter wrote:
perhaps you can help me with the directional capabilities.  I have attached a
copy of my code below.

I am reading the direction to another spybot/beacon and putting it through a
simple least squares adjustment.  I find over short distance (HERE and maybe
THERE) I can get very good directions with as little as 5 consecutive sensor
readings.  But when I extend this beyond the there zone (about 1m/3ft) I find
the spybot always reports direction as CENTER.

I can't find it right now, but I thought I read somewhere that if the direction is
"anywhere", it will not have a direction.  I believe that's consistant with what
you're seeing.

Steve


Subject: 
Re: Spybot studies: seek a world object
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Tue, 18 Oct 2005 10:13:49 GMT
Viewed: 
10400 times
  
Sorry,

I forgot to mention I am using nqc 3.1r4

Allen




In lugnet.robotics.spybotics, Allen Benter wrote:
John,

perhaps you can help me with the directional capabilities.  I have attached a
copy of my code below.



Subject: 
Re: Spybot studies: seek a world object
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Tue, 18 Oct 2005 10:05:51 GMT
Viewed: 
10399 times
  
John,

perhaps you can help me with the directional capabilities.  I have attached a
copy of my code below.

I am reading the direction to another spybot/beacon and putting it through a
simple least squares adjustment.  I find over short distance (HERE and maybe
THERE) I can get very good directions with as little as 5 consecutive sensor
readings.  But when I extend this beyond the there zone (about 1m/3ft) I find
the spybot always reports direction as CENTER.

Do you get different results?  I have 4 beacons and 5 spybots, and basically get
the same results each time.  The batteries I am using are NiMH and fully
charged.  The beacon light appears strong (if that is any indication of battery
strength).

I have wondered how much my floor type & room size affects the IR sensor.

Any tips you have on the IR sensor readings would be very much appreciated.

Cheers,

Allen

#pragma reserve 0 20

#define sum_x (@12)
#define sum_y (@13)
#define sum_x_2 (@14)
#define sum_xy (@15)
#define intercept (@16)
#define updated (@17)

task main()
{
  int spy_direction;
  int TARGET;
  sum_x = 0;
  sum_y = 0;
  sum_xy = 0;
  sum_x_2 = 0;

  start display;
  SetPingInterval(1);
  ClearCounter(0);
  spy_direction = 0;
  TARGET = -1;
  ClearWorld();
  Wait(500);

  FindWorld(TARGET, SPY_RANGE, REL_GT, RANGE_NOWHERE);
  while(TARGET < 0)
    FindWorld(TARGET, SPY_RANGE, REL_GT, RANGE_NOWHERE);
  SetTargetID(TARGET);

  while(true)
  {
     //PlaySound(SOUND_CLICK);
     spy_direction = Target(SPY_DIRECTION);
     if(spy_direction > -1 && spy_direction < 5)
     {
       IncCounter(0);
       sum_x_2 = sum_x_2 + Counter(0)*Counter(0);
       sum_x = sum_x + Counter(0);
       sum_xy = sum_xy + Counter(0) * spy_direction;
       sum_y = sum_y + spy_direction;
       least_square();
     }

     //Wait(50);

     if(sum_x_2 > 25000)
     {
      sum_x = 0;
      sum_y = 0;
      sum_xy = 0;
      sum_x_2 = 0;
      ClearCounter(0);
      //PlaySound(SOUND_DOUBLE_BEEP);
     }
  }
}

task display()
{
  int state;

  while(true)
  {

     // put direction on green LEDs & distance on red LEDs

     //state = (spy_distance & 0x7) | ((avg_dir & 0x7) << 3) ;
     until(updated);

     SetLED(LED_MODE_ON, intercept);
   }
}

void least_square()
{
  int ssx;
  int ssxy;
  int b1;

  updated = false;
  ssx = sum_x_2 - ((sum_x * sum_x)/Counter(0));
  ssxy = sum_xy - ((sum_x * sum_y)/Counter(0));
  b1 = ssxy / ssx;
  intercept = (sum_y / Counter(0)) - (b1 * (sum_x / Counter(0)));
  updated = true;
}




In lugnet.robotics.spybotics, John Hansen wrote:
In lugnet.robotics.spybotics, Daniel Wittenaar wrote:
In lugnet.robotics.spybotics, Daniel Wittenaar wrote:
In lugnet.robotics.spybotics, Brian B. Alano wrote:
/*
beacon.nqc  <<



There was a bug in the code generated by NQC for the find opcode prior to
version 3.1r2.  If you are using a version of NQC older than 3.1r2 then that
*might* explain why Brian's beacon.nqc program fails to work sometimes.


John Hansen


Subject: 
Re: Spybot studies: seek a world object
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Thu, 13 Oct 2005 23:02:01 GMT
Viewed: 
10035 times
  
In lugnet.robotics.spybotics, John Hansen wrote:
There was a bug in the code generated by NQC for the find opcode prior to
version 3.1r2.  If you are using a version of NQC older than 3.1r2 then that
*might* explain why Brian's beacon.nqc program fails to work sometimes.

I will try to find a copy of the MindScript code for the default program and
port it to NQC if possible for you.

I have found a copy of the MindScript code for the default program (sort of) and
I have ported it to NQC.

Here's the default program in MindScript:

program SpybotDefaultProgram
{
  main
  {
    start 0
  }
}


And here is its NQC equivalent:

#pragma noinit

task main()
{
  StartTask(0);
}


Unfortunately, these programs don't help much since all either one does is start
Task 0 in the Spybot ROM.  It is possible if you are really clever to write an
NQC program which cooperates with the built-in ROM tasks and subroutines.  But
it is not an easy road to take and may not be possible given the specific
requirements of your robot.

John Hansen


Subject: 
Re: Spybot studies: seek a world object
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Tue, 4 Oct 2005 17:10:01 GMT
Viewed: 
9804 times
  
In lugnet.robotics.spybotics, Daniel Wittenaar wrote:
In lugnet.robotics.spybotics, Daniel Wittenaar wrote:
In lugnet.robotics.spybotics, Brian B. Alano wrote:
/*
beacon.nqc  <<

Nobody who can help us out on this one??  I'm looking for the NQC comando's that
can control (readout) the sensor on the rear of the spybot.. This can be used as
told above to determen if the beacon is in front of the spybot.. Or behind the
spybot..  That all to give the spybot a better left right sense..

The sensor that is in the back is SENSOR_2 And can be used for IR comunication
trough air..  But i'm not pretty sure how to put things together..

There was a bug in the code generated by NQC for the find opcode prior to
version 3.1r2.  If you are using a version of NQC older than 3.1r2 then that
*might* explain why Brian's beacon.nqc program fails to work sometimes.

I will try to find a copy of the MindScript code for the default program and
port it to NQC if possible for you.

John Hansen



Next Page:  5 more | 10 more | 20 more

Redisplay Messages:  Brief | Compact

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR