View unanswered posts | View active topics It is currently Sun Sep 21, 2014 8:45 pm






Reply to topic  [ 15 posts ] 
IR seeker #include file not locating 
Author Message
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post IR seeker #include file not locating
can somebody please help me it's my first time using the IR seeker sensor. I'm trying to use Xander's 3rd party sensors but the #include file gives me errors when I compile it. I'm not sure what is wrong. could someone please help me?


Tue Feb 19, 2013 1:27 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: IR seeker #include file not locating
Did you follow all of the instructions here: http://botbench.com/blog/robotc-driver- ... ver-suite/

= 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]


Tue Feb 19, 2013 1:18 pm
Profile WWW
Moderator
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 198
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Post Re: IR seeker #include file not locating
Something that could be wrong is the name of the include file. Let's say you had the Dexter Industries IMU. The include file I'm told to use is "drivers/dexterind-imu.h", but that gets me an error. I changed it to "dexterind-imu.h" and it worked. It could be something as simple as that.

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot


Tue Feb 19, 2013 3:11 pm
Profile
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post Re: IR seeker #include file not locating
I got it working but now it says there is a duplicate definition for task 'main'. why is it saying that?


Tue Feb 19, 2013 6:32 pm
Profile
Moderator
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 198
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Post Re: IR seeker #include file not locating
Would you mind to copy and paste the code so we can see? I've had that problem before and I'm sure I can fix it if you show me the code.

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot


Tue Feb 19, 2013 8:16 pm
Profile
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post Re: IR seeker #include file not locating
#pragma config(Hubs, S1, HTServo, HTMotor, HTMotor, none)
#pragma config(Sensor, S2, HTIRS2, sensorI2CCustom)
#pragma config(Motor, mtr_S1_C2_1, rightside, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_2, leftside, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_1, ringlift, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_2, motorG, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C1_1, IRservo, tServoStandard)
#pragma config(Servo, srvo_S1_C1_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C1_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C1_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
#include "hitechnic-irseeker-v2-test1.c"


task main ()
{
waitForStart(); // Wait for the beginning of autonomous phase.

while (true)

motor[ringlift] = 10;

wait10Msec(200);


servo[IRservo] = 0;

wait10Msec(600);

while (SensorValue[HTIRS2]<5)
{
motor[rightside] = 75;
motor[leftside] = 75;
}
wait10Msec(1000);

while (SensorValue[HTIRS2]==5)
{
motor[rightside] = 50;
motor[leftside] = -50;
}
wait10Msec(2000);

servo[IRservo] = 127;
wait10Msec(600);

while (SensorValue[HTIRS2] ==5)
{
motor[rightside] = 30;
motor[leftside] = 30;
}
wait10Msec(5000);

motor[ringlift] = -10;
wait10Msec(2000);

motor[rightside] = -30;
motor[leftside] = -30;
wait10Msec(6000);
}


Wed Feb 20, 2013 12:47 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: IR seeker #include file not locating
You need to include the driver, not the test program :)
Change the include line to this:
Code:
#include "drivers/hitechnic-irseeker-v2.h"

= 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]


Wed Feb 20, 2013 1:17 pm
Profile WWW
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 578
Post Re: IR seeker #include file not locating
One other thing I saw that will cause you issues:

Code:
while (true)

motor[ringlift] = 10;


This will only run the motor[rightlift]=10; code continuously; to have the entire program run inside the infinite loop, you will need to use the opening and closing braces:

Code:
while(true)
{
//Code goes here
}

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Wed Feb 20, 2013 1:20 pm
Profile
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post Re: IR seeker #include file not locating
the same error comes up and when I put #include "drivers/hitechnic-irseeker-v2.h" the same error from before comes up also.


Wed Feb 20, 2013 1:27 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: IR seeker #include file not locating
Did you remove the erroneous line:
Code:
#include "hitechnic-irseeker-v2-test1.c"

= 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]


Wed Feb 20, 2013 3:31 pm
Profile WWW
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post Re: IR seeker #include file not locating
i put that up now and it didn't show any errors at all. I tried it on my robot but there is no response. I checked the NXT and the FMS messages are at zero. Could this be the problem?

MY code now looks like this:

#pragma config(Hubs, S1, HTServo, HTMotor, HTMotor, none)
#pragma config(Sensor, S2, HTIRS2, sensorI2CCustom)
#pragma config(Motor, mtr_S1_C2_1, rightside, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_2, leftside, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_1, ringlift, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_2, motorG, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C1_1, IRservo, tServoStandard)
#pragma config(Servo, srvo_S1_C1_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C1_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C1_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
#include "drivers/hitechnic-irseeker-v2.h"

task main ()
{
waitForStart(); // Wait for the beginning of autonomous phase.

while (true)
{
motor[ringlift] = 10;

wait10Msec(200);
}

servo[IRservo] = 0;

wait10Msec(600);

while (SensorValue[HTIRS2]<5)
{
motor[rightside] = 75;
motor[leftside] = 75;
}
wait10Msec(1000);

while (SensorValue[HTIRS2]==5)
{
motor[rightside] = 50;
motor[leftside] = -50;
}
wait10Msec(2000);

servo[IRservo] = 127;
wait10Msec(600);

while (SensorValue[HTIRS2] ==5)
{
motor[rightside] = 30;
motor[leftside] = 30;
}
wait10Msec(5000);
{
motor[ringlift] = -10;
wait10Msec(2000);
}
motor[rightside] = -30;
motor[leftside] = -30;
wait10Msec(6000);
}


Wed Feb 20, 2013 5:31 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 578
Post Re: IR seeker #include file not locating
Code:
while (true)
{
motor[ringlift] = 10;

wait10Msec(200);
}


This is going to give you the same issues as before; only the motor[ringlift] = 10; and wait10Msec(200); commands will run repeatedly. To ensure that the entire program gets looped, make sure you place all of the code you want to run inside of the { and } of the 'while(true)' loop.

You can use ROBOTC's autoformat tool to automatically indent the code, which should make it a little bit easier to determine where the braces are (fourth icon from the left, the one that has the purple sparkles around it).

Image

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Wed Feb 20, 2013 5:52 pm
Profile
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post Re: IR seeker #include file not locating
I tried that out but the whole code gets highlighted. I'm not sure if that is what you meant. When I try it on my robot it responds but only the ring lift motor moves and the only way to stop it is to stop the whole program. is there I way I could replace the timing for the rotation statement instead?


Wed Feb 20, 2013 6:25 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 137
Post Re: IR seeker #include file not locating
As JohnWatson said, your code is stuck in the while(true) loop and never executes any statements beyond that.

Code:
   while (true)
   {
      motor[ringlift] = 10;

      wait10Msec(200);
   }

This while loop will never end; your code is stuck executing the two statements inside forever. This matches the behavior you describe.

This appears to be an autonomous routine to me, so there is no need for the while(true) loop in your code best I can tell. Simply remove it like below:
Code:
#pragma config(Hubs, S1, HTServo, HTMotor, HTMotor, none)
#pragma config(Sensor, S2, HTIRS2, sensorI2CCustom)
#pragma config(Motor, mtr_S1_C2_1, rightside, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_2, leftside, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_1, ringlift, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_2, motorG, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C1_1, IRservo, tServoStandard)
#pragma config(Servo, srvo_S1_C1_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C1_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C1_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
#include "drivers/hitechnic-irseeker-v2.h"

task main ()
{
   waitForStart(); // Wait for the beginning of autonomous phase.

   motor[ringlift] = 10;
   wait10Msec(200);

   servo[IRservo] = 0;
   wait10Msec(600);

   while (SensorValue[HTIRS2]<5)
   {
      motor[rightside] = 75;
      motor[leftside] = 75;
   }
   wait10Msec(1000);

   while (SensorValue[HTIRS2]==5)
   {
      motor[rightside] = 50;
      motor[leftside] = -50;
   }
   wait10Msec(2000);

   servo[IRservo] = 127;
   wait10Msec(600);

   while (SensorValue[HTIRS2] ==5)
   {
      motor[rightside] = 30;
      motor[leftside] = 30;
   }
   wait10Msec(5000);
   {
      motor[ringlift] = -10;
      wait10Msec(2000);
   }
   motor[rightside] = -30;
   motor[leftside] = -30;
   wait10Msec(6000);
}


Best of luck!


Fri Mar 08, 2013 11:01 am
Profile
Rookie

Joined: Sun Feb 17, 2013 11:27 pm
Posts: 7
Post Re: IR seeker #include file not locating
ok thank you I'll try it


Sun Mar 10, 2013 11:59 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:  
cron



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