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

3rd Party IR sensor acting strange
http://www.robotc.net/forums/viewtopic.php?f=41&t=10961
Page 1 of 1

Author:  Ssuperbull [ Tue Apr 21, 2015 1:38 pm ]
Post subject:  3rd Party IR sensor acting strange

Hey everyone,

I have been toying around with the 3rd party hightechnic IR sensor for the EV3 and it seems to only be registering the very first value that it is exposed to, i.e. if I start the program and the sensor registers the the infared ball is front of it it will move toward it as intended. However, it will ignore any changes in direction of the infared ball and still treat it as if it was still in front ( Even when the ball is directly behind it!).

I have activated the required directories to use the sensor and I am fairly sure the code is useable. I have worked with the same sensor using the NXT 2.x and it was running fine until I used it for EV3. Is there something I'm missing or neglecting to do? I apologize for any vagueness but any help is appreciated!

Thanks,
Ssuperbull

Author:  mightor [ Tue Apr 21, 2015 1:55 pm ]
Post subject:  Re: 3rd Party IR sensor acting strange

You are using the latest version of the driver suite from https://github.com/botbench/robotcdriversuite?
If you are, please make sure you're also using ROBOTC 4.30. Let me know which one of the example programs you're having this issue with. If it's your own code, please verifiy that you have the same issue with the examples. Otherwise, attach your program to the next post.

Regards,
Xander

Author:  Ssuperbull [ Tue Apr 21, 2015 2:26 pm ]
Post subject:  Re: 3rd Party IR sensor acting strange

Thanks for the quick reply! I'm fairly new to coding so please go easy on me, haha. Also, something worth noting, when i go to port view on my EV3 it does not show the values of the infared detection unless I unplug the sensor and plug it back in. I just thought was strange.



Code:
#pragma config(Sensor, S1,     lightSensor1,   sensorEV3_Color)
#pragma config(Sensor, S2,     infraredSensor, sensorI2CCustom)
#pragma config(Sensor, S4,     sonarSensor,    sensorSONAR)
#pragma config(Motor,  motorB,           ,             tmotorEV3_Large, PIDControl, reversed, encoder)
#pragma config(Motor,  motorC,           ,             tmotorEV3_Large, PIDControl, reversed, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*!!Code automatically generated by 'ROBOTC' configuration wizard               !!
Code courtesy of ******************
The #pragma is an automatically generated piece of code that is created when you
activate a sensor in the "Motor and Sensor Setup"
*/
#include "hitechnic-irseeker-v2.h" //This is the library for the IR sensor

task main()//this is the main function of the program
{
   nMotorPIDSpeedCtrl[motorB]=mtrSpeedReg;//Initializes the motor B
   nMotorPIDSpeedCtrl[motorC]=mtrSpeedReg;//Initializes the motor C

   // next several lines set up the IR sensor

   tHTIRS2 irSeeker; //Create struct (of type tHTIRS2) to hold sensor data
   initSensor(&irSeeker, S2); // Initialise and configure struct and port

   irSeeker.mode=DSP_1200; //Sets the frequency the IR sensor picks up "1200 Hz"

   int dirAC = 0; //Creates a local variable and initializes it at zero
   readSensor(&irSeeker); //??
   dirAC = irSeeker.acDirection; //??

   while(true)//A continuous loop
   {   if (SensorValue(lightSensor1) >= 10) //Keeps the robot on the board
      {   //motor[motorB] = -50;
         //motor[motorC] = 50;

         if (dirAC < 5 && dirAC >= 0)
         {   motor[motorB] = 60;
            motor[motorC] = 40;
         }
         else if (dirAC > 5 && dirAC <= 9)
         {   motor[motorB] = 40;
            motor[motorC] = 60;
         }
         else
         { motor[motorB] = 100;
            motor[motorC] = 100;
        }
      }
      else //In any other circumstance the robot will reverse direction and rotate
      { motor[motorB] = -100;
         motor[motorC] = -100;
         wait1Msec(2000);

         motor[motorB] = 50;
         motor[motorC] = -50;
         wait1Msec(500);
      }
}
}

Author:  mightor [ Tue Apr 21, 2015 2:41 pm ]
Post subject:  Re: 3rd Party IR sensor acting strange

Hey there,

Could you answer these two questions for me as well?
Are you using the latest version of the driver suite from https://github.com/botbench/robotcdriversuite?
Does it work properly with the examples?

= Xander

Author:  Ssuperbull [ Thu Apr 23, 2015 2:28 pm ]
Post subject:  Re: 3rd Party IR sensor acting strange

Hey again,
I don't believe I have the driver downloaded. I have been going through the directory files to grab the Hightechnic file to use, but it seems glitchy. What exactly should I download to get this working?

Author:  mightor [ Thu Apr 23, 2015 3:54 pm ]
Post subject:  Re: 3rd Party IR sensor acting strange

Scroll down a bit on https://github.com/botbench/robotcdriversuite and follow the instructions :)

= Xander

Author:  jbernhardt [ Fri May 01, 2015 9:11 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

After downloading the drivers..
How do I install them?

Author:  mightor [ Fri May 01, 2015 9:19 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

It's on that page in the section titled "How to install it?"

= Xander

Author:  jbernhardt [ Fri May 01, 2015 9:25 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

Could you send me a link. I did not get that file when I unzipped.

Author:  mightor [ Fri May 01, 2015 9:32 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

It's not a file. It's on the same page as where you donwloaded the zip file: https://github.com/botbench/robotcdriversuite. Just scroll down a bit. You can't miss it.

= Xander

Author:  jbernhardt [ Fri May 01, 2015 9:48 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

Okay. Having a few problems in my school district.
First, for some reason we cannot open any of the links you have. I was able to use my personal computer and my phone to get to the page.
Second, the only direction id see is to "expand on you system, somewhere"
How do I get the driver from the computer to the EV3

Author:  mightor [ Fri May 01, 2015 9:54 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

Quote:
How do I get the driver from the computer to the EV3

You don't. The compiler will take care of that when you upload your program to the brick. After you have installed the drivers according to the instructions, take a look at some of the examples that are included with the suite. They will explain how to use the drivers.

= Xander

Author:  mightor [ Fri May 01, 2015 9:56 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

Quote:
Second, the only direction id see is to "expand on you system, somewhere"

What about the rest of the text:
Quote:
If you're keen to try out these bleeding edge drivers, navigate to this page and follow the instructions. Simply substitute the repository in that text with this current one.


= Xander

Author:  jbernhardt [ Fri May 01, 2015 10:29 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

okay thanks anyway

Author:  millahjovich [ Mon Jun 13, 2016 6:40 am ]
Post subject:  Re: 3rd Party IR sensor acting strange

After downloading the drivers..
How do I install them????????

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