|
Page 1 of 1
|
[ 15 posts ] |
|
IR seeker #include file not locating
Author |
Message |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 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 |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: IR seeker #include file not locating
_________________| 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 |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 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 |
|
 |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 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 |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 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 |
|
 |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 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 |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: IR seeker #include file not locating
You need to include the driver, not the test program Change the include line to this: = 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 |
|
 |
JohnWatson
Site Admin
Joined: Thu May 24, 2012 12:15 pm Posts: 722
|
 Re: IR seeker #include file not locating
One other thing I saw that will cause you issues: 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:
_________________Check out our Blog! And our Facebook page! Need help? Take a look at our updated help documentation and the ROBOTC Forums.
|
Wed Feb 20, 2013 1:20 pm |
|
 |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 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 |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: IR seeker #include file not locating
Did you remove the erroneous line: = 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 |
|
 |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 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 |
|
 |
JohnWatson
Site Admin
Joined: Thu May 24, 2012 12:15 pm Posts: 722
|
 Re: IR seeker #include file not locating
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). 
_________________Check out our Blog! And our Facebook page! Need help? Take a look at our updated help documentation and the ROBOTC Forums.
|
Wed Feb 20, 2013 5:52 pm |
|
 |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 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 |
|
 |
l0jec
Expert
Joined: Mon Oct 27, 2008 9:59 pm Posts: 139
|
 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. 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 |
|
 |
hrazo6332
Rookie
Joined: Sun Feb 17, 2013 11:27 pm Posts: 7
|
 Re: IR seeker #include file not locating
ok thank you I'll try it
|
Sun Mar 10, 2013 11:59 pm |
|
|
|
Page 1 of 1
|
[ 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
|
|