ROBOTC.net forums
http://robotc.net/forums/

Using Multiple IR Sensors
http://robotc.net/forums/viewtopic.php?f=52&t=5516
Page 1 of 1

Author:  grendel [ Tue Feb 19, 2013 5:11 am ]
Post subject:  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?

Author:  Robo5009 [ Wed Feb 20, 2013 2:36 pm ]
Post subject:  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).

Author:  grendel [ Wed Feb 20, 2013 3:04 pm ]
Post subject:  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?

Author:  Robo5009 [ Wed Feb 20, 2013 5:13 pm ]
Post subject:  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

Author:  merkez [ Fri Jul 26, 2013 11:50 am ]
Post subject:  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?

Author:  Ernest3.14 [ Fri Jul 26, 2013 7:11 pm ]
Post subject:  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.

Author:  MHTS [ Fri Jul 26, 2013 8:29 pm ]
Post subject:  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.

Author:  kkpanu9 [ Fri Nov 29, 2013 12:30 pm ]
Post subject:  Re: Using Multiple IR Sensors

Why and how would anyone use more than one IR Sensor? I don't think it is necessary.

Author:  BurningLights [ Sun Dec 01, 2013 5:53 pm ]
Post subject:  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.

Author:  kkpanu9 [ Sun Dec 01, 2013 9:39 pm ]
Post subject:  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.

Author:  MHTS [ Sun Dec 01, 2013 10:42 pm ]
Post subject:  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.

Author:  BurningLights [ Mon Dec 02, 2013 5:36 pm ]
Post subject:  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:

Author:  MHTS [ Mon Dec 02, 2013 11:43 pm ]
Post subject:  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

Author:  BurningLights [ Wed Dec 04, 2013 10:28 am ]
Post subject:  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.

Author:  dwarf9668 [ Tue Dec 10, 2013 7:32 pm ]
Post subject:  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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/