Programming Skills Challenge (Autonomous Programming)

Hi,

Firstly, thank you to everyone who has helped me so far throughout this process. My class now have a robot built that responds to the VEX controller (mostly default programming to be fair but it’s a start).

My question is in relation to the autonomous programming side of things. I understand what is required in the Crossover game but do not know where to even begin to help the guys in my class implement it. I have a basic understanding of the RobotC code now but am struggling to understand how the logic would work and how the code would be structured for an autonmous robot. Does anyone have a few tips/a source/a tutorial that could help me become somewhat familiar with it? Even an example of the structure of an autonomous program from another challenge would be great

Clearly I am pretty clueless in this area but have learned lots so far and am interested in getting to grips with this side of the project as well.

Autonomous is anything that you make it do in steps. For example, if you look at Color Sensor - Line Following sample programs or if you copy-paste several of those together, you have a sequence of steps. Take a look at Basic Line tracking, it is using sensors to drive itself along a line. Line Track for Time follows a line only for predetermined time. Just try putting together a bunch of code from samples provided (basic movements, sensors, etc) and watch it run.

After that you can make your own challenge… Draw a large square. Make a program to drive the robot on that square… Move on.

Also all the programs from Basic Movements sample code are considered autonomous (no controller involved) … Moving Forward, as soon as it is run, I recall moves forward for 2 sec and stops. Point Turns sample makes two movements.

Autonomous program starts executing as soon as you “run” the program. Using sensors, you can make your sequence start/stop when you want rather than executing those steps as soon as you select the program from the brain slot. Many people use a touch sensor for that.

Moving Forward:
task main()
{
setMotorSpeed(leftMotor, 50); //Set the leftMotor (motor1) to half power (50)
setMotorSpeed(rightMotor, 50); //Set the rightMotor (motor6) to half power (50)
sleep(2000); //Wait for 2 seconds before continuing on in the program.
}

Point Turns:
task main()
{
setMotorSpeed(leftMotor, -127); //Set the leftMotor (motor1) to full power reverse (-127)
setMotorSpeed(rightMotor, 127); //Set the rightMotor (motor6) to full power forward (127)
sleep(1000); //Wait for 1 second before continuing on in the program.

setMotorSpeed(leftMotor, 127); //Set the leftMotor (motor1) to full power forward (127)
setMotorSpeed(rightMotor, -127); //Set the rightMotor (motor6) to full power reverse (-127)
sleep(1000); //Wait for 1 second before continuing on in the program.
}

Combining the two basic programs: So this goes forward for 2 sec, then turns left, then turns right. End of program…
task main()
{
setMotorSpeed(leftMotor, 50); //Set the leftMotor (motor1) to half power (50)
setMotorSpeed(rightMotor, 50); //Set the rightMotor (motor6) to half power (50)
sleep(2000); //Wait for 2 seconds before continuing on in the program.

setMotorSpeed(leftMotor, -127); //Set the leftMotor (motor1) to full power reverse (-127)
setMotorSpeed(rightMotor, 127); //Set the rightMotor (motor6) to full power forward (127)
sleep(1000); //Wait for 1 second before continuing on in the program.

setMotorSpeed(leftMotor, 127); //Set the leftMotor (motor1) to full power forward (127)
setMotorSpeed(rightMotor, -127); //Set the rightMotor (motor6) to full power reverse (-127)
sleep(1000);
}

You may want to start with graphical, easier.

Thank you for all your help - I’m slow to pick it up but that’s certainly a start. Yes I am using Graphical RobotC for sure!

The thing to remember about Programming Skills is that you don’t need to create just 1 all-encompassing autonomous routine, you create lots of smaller ones. The students can reset their robot to either of the two starting positions as many times as they like in the run. Each time they reset the robot, they could run a different program, for example:

Program 1) Start in the blue end and knock some Hexballs over the wall for 1 point each
Program 2) Start in the orange end and knock some Heballs over the wall for 1 point each
Program 3) Park on the Bridge

Start with the simplest program which is probably one to park on the bridge:

  1. Move forward X amount so you are level with the bridge
  2. Turn left (or right, depending on which starting position you are in) 90 degrees
  3. Move forward until the robot is parked on the bridge

You can then tweak this program to improve reliability, e.g on step 3, move forward fast initially, then creep forwards towards the end to ensure the bridge remains balanced and the robot doesn’t go too far.

See how you get on, let us know if you need an example posted.

Thanks Calv…can I just confirm one thing so? For the programming skills game, my team can place the robot on EITHER starting position (one on each side)?

Edit - this is a good example of it: Vex IQ Crossover 6210 Programming Skills - YouTube

Exactly - you can reset to either of the two starting positions. Just remember that if you reset, any Hexballs that your robot is holding need to be removed so you cant pick up some orange balls, reset to the other end and then score them.
That video is a great example of what I described above though, three short programs each with a specific purpose.

Hi again,

So the guys in my class have been messing around with autonimous programming and are getting the hang of it. We are doing this without an actual arena so we are starting to work off the measurements (which are really comprehensive) for the Crossover arena provided by vex. I just have a couple of questions in relation to this.

  1. From what point on the robot are rotations measured? I assume it is the motors (left and right side)?

  2. Does anyone know exactly how many mm/inches one rotation is equal to? I guess we can test it ourselves but I’m not sure how accurate it will be.

Rotations refer to one rotation of the motor. In the case of the standard Clawbot, the gear ratio is 1:1 so it is also one rotation of the wheel. With VEX IQ, VEX have been really kind to the students and printed the circumference of the wheel on the tyre itself. The standard Clawbot wheels are 200mm circumference so also 200mm travel per rotation.