View unanswered posts | View active topics It is currently Wed Jun 26, 2019 8:26 am






Reply to topic  [ 6 posts ] 
Help Understanding the Infrared Sensor and Seeker 
Author Message
Rookie

Joined: Mon Jan 26, 2015 2:59 pm
Posts: 4
Post Help Understanding the Infrared Sensor and Seeker
Hi all,
I'm having a bit of trouble understanding the Infrared sensor and seeker (quite new to robotics.) From what I've read, the seeker has 9 different sections, even numbers being the overlapping, 5 degree sectors. What i'd like to do is place the sensor so that sector 4 facing forward, and if the infrared sensor detects the beacon, the robot will act. If no beacon is detected in that sector, then the robot will do nothing. I have no clue, however, how to go about doing this. Any help would be appreciated. I've looked through the sample programs on RobotC but can't make heads or tails of it. All I really want to do is, at the start of the program, just check if the beacon is straight in front of the robot, and act accordingly.
Thanks so much.


Mon Jan 26, 2015 3:12 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Help Understanding the Infrared Sensor and Seeker
Hi Rkage,

Could you tell me which IR Seeker you are talking about? The one made by HiTechnic or the one made by LEGO for the EV3?

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Jan 29, 2015 1:53 am
Profile WWW
Rookie

Joined: Mon Jan 26, 2015 2:59 pm
Posts: 4
Post Re: Help Understanding the Infrared Sensor and Seeker
I'm talking about the hitechnic ir seeker that I'll be using for the FTC competition. Thanks for replying.


Thu Jan 29, 2015 11:40 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Help Understanding the Infrared Sensor and Seeker
OK, from that I will assume you are using the NXT platform and not EV3.
Try this little program and look at the different values that are displayed, depending on where the beacon is, and let me know what your findings are.
Code:
#pragma config(Sensor, S1,     IRSEEKER,       sensorHiTechnicIRSeeker1200)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  while(true)
  {
    displayBigTextLine(3, "%d", SensorValue[IRSEEKER]);
    sleep(50);
  }
}

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Jan 30, 2015 1:37 am
Profile WWW
Rookie

Joined: Wed Jan 28, 2015 7:39 pm
Posts: 5
Post Re: Help Understanding the Infrared Sensor and Seeker
We need help finding the signal strength coming from a hitechnic irseeker v2 1200
Code:
#pragma config(Sensor, S1, hitechnicirseekerv2, sensorI2CCustom)
//6
// RoboSeek.c - This program uses the HiTechnic IR Seeker V2
// sensor to follow an IR source. This program requires the
// hitechnic-irseeker-v2-driver.h driver provided with RobotC.
//
// You can copy the "drivers" subdirectory and place it
// in the same directory as this source file. if you do,
// you can use the following #include statement to specify
// the path to the driver.
  //  #include "drivers/hitechnic-irseeker-v2-driver.h"
// if you use the "drivers/hitechnic-irseeker-v2-driver.h" line,
// then you should comment out the following line.
#include "hitechnic-irseeker-v2.h"
// main task
task main ()
{
 int _dirAC = 0;
int acS1, acS2, acS3, acS4, acS5 = 0;
int maxSig = 0; // the max signal strength from the seeker.
int val = 0; // the translated directional value.
// we are going to set DSP mode to 1200 Hz.
 hitechnicirseekerv2= DSP_1200;
 // attempt to set to DSP mode.
 if (hitechnic-irseeker-v2setDSPMode(hitechnic-irseeker-v2, _mode) == 0)
 {
 // unsuccessful at setting the mode.
 // display error message.
 eraseDisplay();
 nxtDisplayCenteredTextLine(0, "ERROR!");
 nxtDisplayCenteredTextLine(2, "Init failed!");
 nxtDisplayCenteredTextLine(3, "Connect sensor");
 nxtDisplayCenteredTextLine(4, "to Port 1.");
 // make a noise to get their attention.
 PlaySound(soundBeepBeep);
 // wait so user can read message, then leave main task.
 wait10Msec(300);
 return;
 }
 eraseDisplay();
 // loop continuously and read from the sensor.
 while(true)
 {
 // read the current modulated signal direction
 _dirAC = hitechnic-irseeker-v2readACDir(hitechnic-irseeker-v2);
 if (_dirAC < 0)FTC-TD-0004-Rev-001-IRSeeker Page 15 of 16 9/14/2012 10:54:00 AM
 {
 // error! - write to debug stream and then break.
 writeDebugStreamLine("Read dir ERROR!");
 break;
 }
 // Get the AC signal strength values.
 if (!hitechnic-irseeker-v2readAllACStrength(hitechnic-irseeker-v2, acS1, acS2, acS3, acS4, acS5 ))
 {
 // error! - write to debug stream and then break.
 writeDebugStreamLine("Read sig ERROR!");
 break;
 } else {
 // find the max signal strength of all detectors.
 maxSig = (acS1 > acS2) ? acS1 : acS2;
 maxSig = (maxSig > acS3) ? maxSig : acS3;
 maxSig = (maxSig > acS4) ? maxSig : acS4;
 maxSig = (maxSig > acS5) ? maxSig : acS5;
 }
 // display info
 nxtDisplayCenteredBigTextLine(1, "Dir=%d", _dirAC);
 nxtDisplayCenteredBigTextLine(4, "Sig=%d", maxSig);
 // figure out which direction to go...
 // a value of zero means the signal is not found.
 // 1 corresponds to the far left (approx. 8 o'clock position).
 // 5 corresponds to straight ahead.
 // 9 corresponds to far right.
 // first translate directional index so 0 is straight ahead.

 }
}


Fri Jan 30, 2015 4:22 pm
Profile
Rookie

Joined: Mon Jan 26, 2015 2:59 pm
Posts: 4
Post Re: Help Understanding the Infrared Sensor and Seeker
After testing today, when the beacon was directly in front, it said 5, and as we moved to the left, it went down from there. 4, 3, etc and vice versa going to the right. I have a better understanding now so thank you!! My question is, how would I take the data (ie. if the robot reads 5, do a certain action) and program it. I'm unclear as to the syntax. Thanks so much again!


Fri Jan 30, 2015 11:21 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.