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

RobotC Autonomous Template Does not Recognize 'waitforstart'
http://www.robotc.net/forums/viewtopic.php?f=52&t=5182
Page 1 of 1

Author:  yay855 [ Wed Nov 28, 2012 4:02 pm ]
Post subject:  RobotC Autonomous Template Does not Recognize 'waitforstart'

I recently heard that the autonomous program required a certain template, so I decided to take a look at it. When I opened the program under my sample programs, it said under the errors tab:

**error**: Undefined procedure 'waitforstart'

I was told that wait for start is necessary for the autonomous part of the challenge. Does anyone know why this would happen?

Author:  MHTS [ Wed Nov 28, 2012 4:30 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

It is waitForStart, not waitforstart. Note: Upper/Lower case is significant in any C languages.

Author:  amcerbu [ Wed Nov 28, 2012 9:41 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

Also, make sure you're calling it like a function. The syntax would be
Code:
waitForStart();

Author:  yay855 [ Mon Dec 03, 2012 5:11 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

Sorry, i'm kinda new at this. The line of code I have is copied out of a template for FTC, so I don't know why it won't recognize it. I checked, and it is exactly like you two said it should be.

Author:  MHTS [ Mon Dec 03, 2012 5:19 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

Would you post your code and the error you got from the compiler?

Author:  yay855 [ Tue Dec 04, 2012 2:04 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

sure thing, here you go.

The Code:

[spoiler]#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Sensor, S2, touch, sensorNone)
#pragma config(Sensor, S3, light, sensorNone)
#pragma config(Sensor, S4, sonar, sensorNone)
#pragma config(Motor, motorA, LEGOmtr, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, motorB, CLAW, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, motorC, , tmotorNXT, openLoop)
#pragma config(Motor, mtr_S1_C1_1, rightmotor, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, leftmotor, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C2_1, bottemarm, tServoStandard)
#pragma config(Servo, srvo_S1_C2_2, toparm, tServoStandard)
#pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"

task main()
{

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



while (true)
{
//CONTROLS THE DRIVING
//,...........,............,...........,....................................................................................//
int threshold = 6; /* Int 'threshold' will allow us to ignore low */
/* readings that keep our robot in perpetual motion. */
while(true) // Infinite loop:
{
getJoystickSettings(joystick);
if(abs(joystick.joy1_y2) > threshold) // If the right analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorE] = (0.5*joystick.joy1_y2); // Motor D is assigned a power level equal to the right analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
motor[motorE] = -0; // Motor D is stopped with a power level of 0.
}
if(abs(joystick.joy1_y1) > threshold) // If the left analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorD] = (0.5*joystick.joy1_y1); // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
motor[motorD] = -0; // Motor E is stopped with a power level of 0.
}
//...................................................................................................................................................//
//BUTTONS TO CONTROL CLAW
if(joy1Btn(1))//
{
motor[motorB]= -75;//If Button 3 is pressed:"x button" blue
}
if(joy1Btn(3)) // If Button 3 is pressed:"B button" red
{
motor[motorB]= 75 ;
}
if(joystick.joy1_TopHat == 2)
{
motor[motorB] = -0; // stop
}
//.............................................................................................................................................//
// BUTTONS TO CONTOL BOTTEM SERVO ARM
// Control arm via shoulder buttons, 5 and 6... 5=up, 6=down 7 = extreme down button 8=extreme up/ in

if(joy1Btn(5)) // If Button 5 is pressed:
{
servo[servo1] = 225;// Raise Servo 1 to position 225.down
}
if(joy1Btn(6)) // If Button 6 is pressed:
{
servo[servo1] = 125; // Lower Servo 1 to position 125.up
}
if(joy1Btn(7)) // If Button -- is pressed:
{
servo[servo1] = 250; // Raise Servo 1 to position 250
}
if(joy1Btn(8)) // If Button -- is pressed:
{
servo[servo1] = 20; // Raise Servo 1 to position 20.in
}
//...............................................................................................................................................//
// CONTROLS TOP SERVO ARM
if(joy1Btn(2)) // If Button 2 is pressed:"A button" green
{
servo[servo2] = 15; // Lower Servo 1 to position down and in.
}
if(joy1Btn(4)) // If Button 1 is pressed:"Y button" yellow
{
servo[servo2] = 135; //Raise Servo 1 to position up.
//..............................................................................................................................................//
// controls for whatever lego motor//
}
if(joystick.joy1_TopHat == 0)
{
motor[motorA] = +75; //forward
}
if(joystick.joy1_TopHat == 4)
{
motor[motorA] = -75; // backwards
}
if(joystick.joy1_TopHat == 6)
{
motor[motorA] = -0; // stop
//............................................................................................................................
}// matches last left bracket to end that funtion.\\you can place more code after it
}//ends while statement.\\you can place another statement to continue building on your task main
}// ends task main.\\you cannot write more code after this right bracket
}
[/spoiler]

and the error message is this:

[spoiler]**Info***:Undefined procedure 'waitForStart'. Global subroutine assumed.
**Error**:Undefined procedure 'waitForStart'[/spoiler]

Author:  JohnWatson [ Tue Dec 04, 2012 2:29 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

I have just tested this and it works fine in ROBOTC version 3.54. Double check to make sure your Platform type is set to NXT/TETRIX (not just NXT) and that the Compiler Target is set to Physical Robot; the waitForStart(); command is not supported in Robot Virtual Worlds or the PC Based Emulator and will throw the error you are seeing.

Author:  yay855 [ Tue Dec 04, 2012 2:42 pm ]
Post subject:  Re: RobotC Autonomous Template Does not Recognize 'waitforst

Okay, I checked to see if that was the problem and it turns out that my compiler target was set to virtual worlds. I changed it to physical robot and the command checked out just fine. Thanks for the help!

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