View unanswered posts | View active topics It is currently Tue Jul 29, 2014 1:51 pm






Reply to topic  [ 15 posts ] 
Using Multiple IR Sensors 
Author Message
Rookie

Joined: Mon Feb 18, 2013 6:16 am
Posts: 5
Post Using Multiple IR Sensors
I set up my robot to use 2 ir sensors (Hitech 1200) for my autonomous program. Unfortunately, only 1 of them works. I tried swapping out the sensor ports and ir sensors - everything. Is it possible to use multiple IR sensors (successfully) on a robot?


Tue Feb 19, 2013 5:11 am
Profile
Rookie

Joined: Tue Feb 19, 2013 4:11 pm
Posts: 8
Post Re: Using Multiple IR Sensors
In theory, there should be no problem in installing two Hitechnic IR seekers on your robot. It is however possible that you have two different versions of the IR seeker (Hitechnic has a v1 and v2) which would each require seperate drivers and might cause problems when calling driver functions. In order to fix this, you may need to fiddle with the code in the drivers (i.e changing function names or number of parameters) in order to differentiate which driver your calling a function from (since they both probably have identical function names and parameters).


Wed Feb 20, 2013 2:36 pm
Profile
Rookie

Joined: Mon Feb 18, 2013 6:16 am
Posts: 5
Post Re: Using Multiple IR Sensors
Both IR Seekers are v2 so, unfortunately, that doesn't explain the problem. Here is some sample code:

#pragma config(Sensor, S2, IRSeeker, sensorHiTechnicIRSeeker1200)
#pragma config(Sensor, S3, IRSeeker2, sensorHiTechnicIRSeeker1200)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
int IRZone = 0;
int IRZone2 = 0;


while(true)
{
IRZone = SensorValue[IRSeeker];
IRZone2 = SensorValue[IRSeeker2];

// Strafe right //
if(IRZone > 5 && IRZone2 > 5)
{
nxtDisplayTextLine(2, "Strafe Right");

}
else if(IRZone < 5 && IRZone2 < 5)
{
nxtDisplayTextLine(2, "Strafe Left");
}
else
{
nxtDisplayTextLine(2, "'Forward");
}
}
}

One sensor works (IRSeeker), the other doesn't. Swapping out the sensor ports doesn't work or swapping out the sensors themselves. Any ideas?


Wed Feb 20, 2013 3:04 pm
Profile
Rookie

Joined: Tue Feb 19, 2013 4:11 pm
Posts: 8
Post Re: Using Multiple IR Sensors
Not sure why you're using the SensorValue for your IRSeekers. Maybe that's because I defined my IR sensor as I2CCustom. Maybe try something like this (will need the IRSv2 driver):

Code:
int intIrBeaconDir(tsensors link) {
   int intDirDC = HTIRS2readDCDir(link); //Read IRS value
   return intDirDC; //Return the value of IR sensor (emitter direction)
}

task main {

int irZone, irZone2;

  while(true) {
     irZone = intIrBeaconDir(IRSeeker);
     irZone2 = intIrBeaconDir(IRSeeker2);

     nxtDisplayCenteredTextLine(3, "%d %d", irZone, irZone2); //Update display
  }

}


Kinda made this in 1 min so hopefully it works.

Hope it helps,

Team 5009


Wed Feb 20, 2013 5:13 pm
Profile
Rookie

Joined: Fri Jul 26, 2013 11:15 am
Posts: 1
Post Re: Using Multiple IR Sensors
Wow. This is what I call an innovation thought. Using 2 IR sensors is a really brilliant idea. @ grendel: Did you succeed in adding 2 IR sensors? If you were, what did you configure in the code? How did you handle the hardware configurations? Also while using 2 IR sensors, do we need to keep in mind about the frequency?

_________________
printed circuits assembly


Last edited by JohnWatson on Wed Dec 11, 2013 10:07 am, edited 2 times in total.

Removed spam link from comment.



Fri Jul 26, 2013 11:50 am
Profile
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post Re: Using Multiple IR Sensors
For FTC, there's usually only one frequency you have to deal with, so you can set it once and forget about it.

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Fri Jul 26, 2013 7:11 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Using Multiple IR Sensors
Our team used two IR seekers to triangulate the IR beacon. It worked very well. So it is possible to use 2 IR seekers.


Fri Jul 26, 2013 8:29 pm
Profile
Rookie

Joined: Fri Nov 29, 2013 12:12 pm
Posts: 14
Post Re: Using Multiple IR Sensors
Why and how would anyone use more than one IR Sensor? I don't think it is necessary.


Fri Nov 29, 2013 12:30 pm
Profile
Novice

Joined: Sat Aug 31, 2013 9:15 am
Posts: 97
Post Re: Using Multiple IR Sensors
kkpanu9 wrote:
Why and how would anyone use more than one IR Sensor? I don't think it is necessary.


Like MHTS said, using more than one IR sensor allows you to triangulate on the beacon, which I assume allows you to better figure out where the beacon is in relation to the robot. On the other hand, if you design your autonomous program to run parallel to the pendulum with either side facing it, you might want to have one IR sensor on each side of the robot, instead of having one sensor total that you switch between sides. However, if you're a low budget team like we are, it is completely possible to make a very accurate and reliable autonomous program using only one IR sensor.

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Sun Dec 01, 2013 5:53 pm
Profile
Rookie

Joined: Fri Nov 29, 2013 12:12 pm
Posts: 14
Post Re: Using Multiple IR Sensors
Yeah we are doing the same thing with the autonomous program run parallel to the pendulum and only using one IR Sensor.


Sun Dec 01, 2013 9:39 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Using Multiple IR Sensors
For this year's game, it may not be as bad. For last year, you really needed accuracy in order to be able to hang the ring on the peg. So two IR seekers will give you that accuracy. For this year, if you are off a little bit, chances are you still score fine.


Sun Dec 01, 2013 10:42 pm
Profile
Novice

Joined: Sat Aug 31, 2013 9:15 am
Posts: 97
Post Re: Using Multiple IR Sensors
MHTS wrote:
For last year, you really needed accuracy in order to be able to hang the ring on the peg. So two IR seekers will give you that accuracy.


That may be, but last year my team was able to achieve the needed amount of accuracy using an encoder on one of our four drive wheels. We had a very accurate autonomous program that worked perfectly when we set it up correctly. :wink:

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Last edited by BurningLights on Wed Dec 04, 2013 10:28 am, edited 1 time in total.



Mon Dec 02, 2013 5:36 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Using Multiple IR Sensors
BurningLights wrote:
That may be, but last year my team was able to achieve the needed amount of accuracy using an encoder on one of our four drive wheels. We had a very accurate autonomous program that worked perfectly when we set it up correctly. :wink:

Encoder does not detect IR. How do you use encoder alone to score on the IR peg? Are you talking about scoring on non-IR pegs? If so, that's a lot easier than scoring the IR peg where you need to turn accurately to align with the peg that has the IR beacon. Even with one IR seeker, it is very difficult to achieve because of the wide zone 5.

For example, our robot accurately scored the IR peg 5 out of 6 matches in the district championship. The one match that we missed was because we forgot to change the battery and it was low so it stopped short in front of the peg.
http://www.youtube.com/watch?v=ou8zFzWXQ7I
http://www.youtube.com/watch?v=tSgsu24BEd8
http://www.youtube.com/watch?v=XFNdUPryXh4
http://www.youtube.com/watch?v=QJxVKs7WrBg


Mon Dec 02, 2013 11:43 pm
Profile
Novice

Joined: Sat Aug 31, 2013 9:15 am
Posts: 97
Post Re: Using Multiple IR Sensors
MHTS wrote:
Encoder does not detect IR. How do you use encoder alone to score on the IR peg? Are you talking about scoring on non-IR pegs? If so, that's a lot easier than scoring the IR peg where you need to turn accurately to align with the peg that has the IR beacon. Even with one IR seeker, it is very difficult to achieve because of the wide zone 5.


I know that. I didn't say we only used an encoder, I said we used the encoder to achieve the needed amount of accuracy. Of course we used an IR sensor to detect the IR beacon. But after we detected it, we used all encoder for positioning and turning.

_________________
Burning Lights Programming
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
Check out our team website at http://cof7468.weebly.com/.


Wed Dec 04, 2013 10:28 am
Profile
Rookie

Joined: Mon Jun 24, 2013 5:15 pm
Posts: 16
Post Re: Using Multiple IR Sensors
I'm on a FTC team (6347) and we have an autonomous program that works very well. It places the cube in the bin and moves on to get on the ramp.
This is done in under 12 seconds using no encoders and one IR seeker. Last year I helped another team (4082) that was preparing for worlds and they were testing this two seeker idea. What we found is that if you position the sensors side by side they will not work well at all. We decided to scrap this idea and put two strips of electrical tape over the sensor except for the very front on the sensor (zone 5). Then the seeker could only see out of the front zone; this proved to be very effective. Because of these improvements they ended up getting 25th place at worlds!

Just my 2 cents,
Dwarf


Tue Dec 10, 2013 7:32 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 15 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.