Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Help !!! (http://www.chiefdelphi.com/forums/showthread.php?t=63157)

tdlrali 03-02-2008 00:03

Re: Help !!!
 
yeah, you're right, c18 doesn't give those errors, even though it should.

sonnguyen 03-02-2008 09:02

Re: Help !!!
 
void Teleop(void)
{
// enable this to use IFI's default robot code
// Default_Routine(); // located in ifi_code.c
pwm01 = 255 - Limit_Mix(2000 + p1_y + p1_x - 127);
pwm02 = Limit_Mix(2000 + p1_y - p1_x + 127);
pwm10=pwm11=p2_x;
// update the state of the LEDs on the operator interface
Update_OI_LEDs(); // located in ifi_code.c
}


Here is the part before the error. Can someone help me ?

Gamer930 03-02-2008 10:30

Re: Help !!!
 
void Teleop(void) is in teleop.c
void Autonomous_Spin(void) where you said the error is located in autonomous.c

your error is going to be in your void Autonomous(void) function. Maybe forgot to close a Bracket or semicolons

sonnguyen 03-02-2008 10:45

Re: Help !!!
 
Can someone check for me ?

void Autonomous(void)
{
/* Add your own autonomous code here. */

/*Bob's Code starts*/
/* SCENARIO 1 ----
step 1 grip keeper
step 2 raise arm
step 3 drive forward 3 seconds full
step 4 realease keeper and move backwards
step 5 wait
*/
// Autonomous_Code is determined by the position of the switch
// rc_dig_in16 switch on the robot rc AUTONOMOUS mode
// rc_dig_in15 switch on the robot rc AUTONOMOUS mode
//#define AUTO_MODE_DEFAULT 0 // NO switch on the Robot at all
// AUTO_MODE_DEFAULT 1 // if switch on rc_dig_in15
// AUTO_MODE_ARM 2 // if switch in the middle
// AUTO_MODE_DEFENSE 3 // if switch on rc_dig_in16

//#define AUTONOMOUS_GO_TO_Rack ( (int)rc_dig_in16 == 0)

/*set our default - no switch on bot */
Autonomous_Code = AUTO_MODE_DEFAULT ;

Finney_auto_counter++;

// we need to find out if the switch is installed on the RC in Digital IN/OUT
// if so, then run the appropriate Autonomos code
if ( (!rc_dig_in15) )
Autonomous_Code = AUTO_MODE_DEFAULT ; // run code for position 15
else if ( (!rc_dig_in16) )
Autonomous_Code = AUTO_MODE_DEFENSE ; // run code for position 16
else if ( (rc_dig_in16) && (rc_dig_in15) ) // run code for MIDDLE position
Autonomous_Code = AUTO_MODE_ARM ;

if ( (rc_dig_in16) && (rc_dig_in15) ) // switch is in middle or missing

{ // Going forward for three seconds.
left_drive = left2_drive = 210;
right_drive = right2_drive = 44;
if (Finney_auto_counter > 78) step++;
}
else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{
switch (step)
{
case 1:
/***** STEP 1 ******/
//grip keeper ring
// claw_close = 1;
// printf("auto step =%d \r\n", step);
if (Finney_auto_counter > 26) step++; //was 95
break;

case 2:
/***** STEP 2 ******/
// raise arm.
// arm = 90;
if (Finney_auto_counter > 78) step++;
break;

case 3: /***** STEP 3 ******/
// drive forward.
left_drive = left2_drive = 220;
right_drive = right2_drive = 60;
if (Finney_auto_counter > 95) step = 5;
break;

case 4: /***** STEP 4 ******/
// release keeper and drive backwards
// claw_open = 1;
//claw_close = 0;
left_drive = left2_drive = 69;
right_drive = right2_drive = 69;
if (Finney_auto_counter > 380) step++;
break;

case 5: /***** STEP 5 ******/
// stop and wait.
left_drive = left2_drive = 127;
right_drive = right2_drive = 127;
if (Finney_auto_counter > 131) step++;
break;

case 6: /***** STEP 6 ******/
// look for the light and move towards it
Process_Data_From_Master_uP();
if (Get_Tracking_State() == SEARCHING)
{
left_drive = left2_drive = right_drive = right2_drive = 127;
}

// This is so when it's not searching, it's moving towards the light
else
{
// turn robot right toward the light
if(PAN_SERVO < 124)
{
left_drive = left2_drive = 230;
right_drive = right2_drive = 128;
}
// turn robot left toward the light
else if(PAN_SERVO > 124)
{
left_drive = left2_drive = 128;
right_drive = right2_drive = 76;
}
// drive robot straight toward the light until 5 feet in front
else if((116/tan(180*(((TILT_SERVO-144)*25)/50)/3.1415)) > 5) // This converts the PWMs to radians and uses trig to find the distance
{
left_drive = left2_drive = 230;
right_drive = right2_drive = 76;
}
}

default:
left_drive = left2_drive = 127;
right_drive = right2_drive = 127;
// claw_close = 0;
break;

} /* End of Switch ( Finney_auto_counter) */

/*Bob's Code ends*/
}

jacobhurwitz 03-02-2008 12:06

Re: Help !!!
 
I know this may be a pain, but try commenting out blocks of your code at a time. Comment out a huge block that fixes the problem, then make the block smaller and smaller until you find the line that causes the problem.

psy_wombats 03-02-2008 12:15

Re: Help !!!
 
Just ran it through a formatting routine in Eclipse. It looks like this line is not closed:

Code:

else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{

Try adding the extra brace back wherever it should be, probably at the end. Either way, a brace is missing.

jacobhurwitz 03-02-2008 12:16

Re: Help !!!
 
Quote:

Originally Posted by psy_wombats (Post 691351)
Just ran it through a formatting routine in Eclipse. It looks like this line is not closed:

Code:

} else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
Try adding the extra brace back wherever it should be, probably at the end. Either way, a brace is missing.

Eclipse is... useful? On our school computers, it's just plain slow.

sonnguyen 03-02-2008 13:58

Re: Help !!!
 
The problem is actually, I have tried to compile on another laptop with the same codes and it worked.

What's the problem here ?

psy_wombats 03-02-2008 14:03

Re: Help !!!
 
Have you tried adding the extra brace right before the function? That code definitely will not compile as is. The syntax error just means the function before it never closed, so it isn't anything compiler specific at the moment.

Or are you getting a different error? If so, what is it?

sonnguyen 03-02-2008 14:18

Re: Help !!!
 
I mean that I use the same codes on the other laptop and it worked. Thus, It means there shouldn't be anything wrong with the codes

Why doesn't it work on my computer ?

psy_wombats 03-02-2008 14:23

Re: Help !!!
 
I'll assume you're talking about the syntax error. If not, say so.

The code on the other computer must not be identical, as it does not respond to the syntax error which is apparent. I am quite sure it will dissapear (and therefore compile) if you add the other brace. Try that, and see if the problem goes away. If you have already fixed the brace issue, is the syntax error still there?

sonnguyen 03-02-2008 14:32

Re: Help !!!
 
where should i put the brace ?

psy_wombats 03-02-2008 14:36

Re: Help !!!
 
The brace should close this line:

Code:

else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{

I think this ends at the end of the function? If I understand what your code does, put it before this, assuming its where that if ends:

Code:

/*Bob's Code ends*/
}


sonnguyen 03-02-2008 14:42

Re: Help !!!
 
there is another problem after I solved that problem

It says

[b]Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F8722 /i"C:\MCC18\h" "autonomous.c" -fo="autonomous.o" -k -mL -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 59
C:\ifi_frc_simple_30\autonomous.c:135:Error [1105] symbol 'left_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:135:Error [1105] symbol 'left2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:135:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:135:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:136:Error [1105] symbol 'right_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:136:Error [1105] symbol 'right2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:136:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:136:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:160:Error [1105] symbol 'left_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:160:Error [1105] symbol 'left2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:160:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:160:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:161:Error [1105] symbol 'right_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:161:Error [1105] symbol 'right2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:161:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:161:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:169:Error [1105] symbol 'left_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:169:Error [1105] symbol 'left2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:169:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:169:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:170:Error [1105] symbol 'right_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:170:Error [1105] symbol 'right2_drive' has not been defined
C:\ifi_frc_simple_30\autonomous.c:170:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:170:Error [1101] lvalue required
C:\ifi_frc_simple_30\autonomous.c:176:Error [1105] symbol 'left_drive' has not been defined
Halting build on first failure as requested.
BUILD FAILED: Sun Feb 03 14:40:41 2008

psy_wombats 03-02-2008 14:45

Re: Help !!!
 
Okay... Well, did you actually define those? If so, where? Did you include that file's header? You may want to just attach a zip of your entire code. And what are those two values? Are they supposed to be motor macros or actual variables? Where are they referred to?


All times are GMT -5. The time now is 19:09.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi