View unanswered posts | View active topics It is currently Wed Sep 17, 2014 9:33 am






Reply to topic  [ 8 posts ] 
RobotC Autonomous Template Does not Recognize 'waitforstart' 
Author Message
Rookie

Joined: Wed Nov 28, 2012 3:57 pm
Posts: 4
Post 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?


Wed Nov 28, 2012 4:02 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: RobotC Autonomous Template Does not Recognize 'waitforst
It is waitForStart, not waitforstart. Note: Upper/Lower case is significant in any C languages.


Wed Nov 28, 2012 4:30 pm
Profile
Novice

Joined: Sun Oct 21, 2012 10:01 pm
Posts: 76
Post Re: RobotC Autonomous Template Does not Recognize 'waitforst
Also, make sure you're calling it like a function. The syntax would be
Code:
waitForStart();


Wed Nov 28, 2012 9:41 pm
Profile
Rookie

Joined: Wed Nov 28, 2012 3:57 pm
Posts: 4
Post 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.


Mon Dec 03, 2012 5:11 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: RobotC Autonomous Template Does not Recognize 'waitforst
Would you post your code and the error you got from the compiler?


Mon Dec 03, 2012 5:19 pm
Profile
Rookie

Joined: Wed Nov 28, 2012 3:57 pm
Posts: 4
Post 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]


Tue Dec 04, 2012 2:04 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 575
Post 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.

_________________
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


Tue Dec 04, 2012 2:29 pm
Profile
Rookie

Joined: Wed Nov 28, 2012 3:57 pm
Posts: 4
Post 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!


Tue Dec 04, 2012 2:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 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:  



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