Since I found this problem from the website I am posting this here. Here is my situation. I am teaching RobotC using Vex to my robotics class. I have no prior experience in programming or robotics, but I am learning as we go. So far robotC lessons have been going good. We have built the squarebot 3.0 with an arm that moves up and down in conjunction with limit switches. We have encoders on the wheels and are going through the Autonomy lessons from the website.

In the PDF file from the website, on page 32 it talks about using variables to control the direction of the arm yet the graphic shows this code in lines 1-9 of the code. This is certainly confusing as we just wrote a function to move straight and placed it BEFORE task main. The code to control the arm using a button on channel six is certainly NOT on lines 1-9 as the graphic shows.

Then on page 34, it tells us to place the variable "isMovingStraight" in an outer else statement in line 90. But if you watch the VIDEOS also available on the website, they place the "isMovingStraight == False" in line 86 after we called our "move straight" function. This "else" belongs to a nested if statement we are using to make sure we can move straight when we press the lower channel 5 button. So the PDF says one thing and the video says another. VERY CONFUSING!!!

So far we followed the lessons perfectly and now when we download and compile the program, our robots do not behave as they should. I am sure we will figure out HOW the code should work. Has anybody else had problems with this?

You're right, the numbering on page 32 should start on a line further down than "1".

In general, when copying, pasting, adding, or removing code based on the VEX lessons, I'd recommend using the "landmarks" in the code, rather than the actual line numbers (which can honestly get confusing). By landmarks, I mean the surrounding lines of code, that we always show in the PDF's and videos. For example, on page 34 we have the following code:

The PDF version tells you to add the "bool isMovingStraight;" and "isMovingStraight = false;" which have surrounding code, or landmarks. The reason that I recommend this is because ROBOTC does not renumber your code until you recompile, so your program (which is what the video shows) may have any number of duplicate lines (eight lines beginning with "75", for instance).

There's a reason for that too - when debugging programs, ROBOTC lets the user know which lines have bugs. If the programmer fixes a bug on line #1 by adding another line or two, subsequent bug reports would off, making it harder to track down and fix them.

If you're still having trouble with your code, feel free to actually post it to the ROBOTC forums so others (myself included) can take a look at it.

Well, the kids say that by pressing the top channel 5 button they are able to disengage the idle loop so as to not start prematurely. So that is good. They also say that when they press the lower channel 5 button the move straight program is working. The problem is that RC control is not working. I am pretty sure the arm is working too by using the channel 6 buttons. Basically, the kids need to be able to use the operator assist function called movestraight if they need it. They need to be able to control the robot via RC as long as the lower channel 5 is not pressed. My hopes is to use the code to do the mine field challenge.

Thu Feb 12, 2009 8:20 am

jbflot

Site Admin

Joined: Tue May 15, 2007 9:02 amPosts: 409

Re: Discrepancy with Autonomy from website

Hi Ken -

I think I've found the source of your problems. In your program, you have two if statements that don't get closed until almost the very end of the program. If I copy your code and paste it directly into ROBOTC, the if statements I'm referring to begin on lines 38 and 49. There should be closing curly braces on lines 48, and after 58 to close each, I think (and two less toward the end of the program). By not closing the if statements in the correct places, all the following code gets put in one giant if statement... which would explain the weird, undesirable behavior.

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