_________________Sorry, your program could not be downloaded. Please reboot your computer.FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)

Quote:

What the world needs is more geniuses with humility, there are so few of us left.

Agreed

Tue Sep 23, 2008 3:33 pm

tfriez

Site Admin

Joined: Wed Jan 24, 2007 10:42 amPosts: 620

Re: Would this code work?

Few notes:

1. There are timers built into ROBOTC. You can access them with the time1[T1], time10[T1], time100[T1]... the number after the word time is the millisecond counter increment (1 = 1ms, 10 = 10ms, 100= 10ms). So for example, you wanted a loop to run for 30 seconds, you could use the following

Code:

ClearTimer(T1);

while(time1[T1] < 30000){

}

2. You have a double while loop at the bottom half of your code... this code will repeat forever. Not sure if this is the desired result.

3. This isn't how the "FTC" system should work. You have to wait for the field management system to "enable" your robot in autonomous. Look at the www.ftctraining.com website for sample code on how to do this.

getJoystickSettings(joystick); //Updates the game and joystick variables

while(joystick.StopPgm) //Continues this loop while the robot is disabled (StopPgm = true) { getJoystickSettings(joystick); //Checks to see if the robot has been enabled (StopPgm = false) wait1Msec(50); //Waits 50 milliseconds for a new BT packet to come. }

// Autonomous Code Below - You can put all of your autonomous program below

getJoystickSettings(joystick); //Updates the game and joystick variables

while(joystick.StopPgm) //Continues this loop while the robot is disabled (StopPgm = true) { getJoystickSettings(joystick); //Checks to see if the robot has been enabled (StopPgm = false) wait1Msec(50); //Waits 50 milliseconds for a new BT packet to come. }

// Autonomous Code Below - You can put all of your autonomous program below

getJoystickSettings(joystick); //Updates the game and joystick variables

while(joystick.StopPgm) //Continues this loop while the robot is disabled (StopPgm = true) { getJoystickSettings(joystick); //Checks to see if the robot has been enabled (StopPgm = false) wait1Msec(50); //Waits 50 milliseconds for a new BT packet to come. }

// Autonomous Code Below - You can put all of your autonomous program below

Btw, I prefer to have the timer code on the robot. It's just there so that I can make sure that the robot goes into tele-opp mode as soon as auto mode ends.

_________________Sorry, your program could not be downloaded. Please reboot your computer.FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)

Quote:

What the world needs is more geniuses with humility, there are so few of us left.

Agreed

Wed Sep 24, 2008 5:02 pm

Dick Swan

Creator

Joined: Fri Feb 09, 2007 9:21 amPosts: 616

Re: Would this code work?

You probably want to post a question on the "US First" site regarding whether it's a legal modifcation to use "continuous rotation" servos. I suspect the reply is no. At least that is what I recall when I informally asked this question earlier this summer.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum