A somewhat complicated question.

Hi, i need a little bit of help. I’m Programming a robot for a autonomous competition with EasyC but the competition rules specify that robots must be started from the controller. The easiest way is making a new variable, setting it to zero, and making any input from the controller switch to 1, then make the main autonomous loop start when the variable equals to zero. The problem is : I can’t seem to figure out how to make the controller input change the variable.

Anyone have any ideas on what i should do, or any suggestions?:confused:

You could remove a jumper from an input to start the robot.

input5 = GetDigitalInput(5);
while (input5 == 1)
{
input5 = GetDigitalInput(5); //check input 5
Wait(5); //Slow down the loop
}

//Write autonomous code here

Im sorry. I think i didn’t phrase that right. We need to be able to trigger it from the remote control. The point of this is to simulate a start without being close to the robot.

Use a competition template. This will allow you start your program, either autonomous or operator control, when you turn on your transmitter. Please see the help file in easyC to learn more about competition templates. Thanks.

Thank you very much. Is there any way to get access to that specific help file without the program?

Autonomous and Operator Controlled Modes
You can control the robot with your radio transmitter, or create an autonomous program which executes automatically. However you may at times want to combine elements of both types, to create a program that responds to your input but is intelligent enough to automatically react to sensor information.

Autonomous: your robot follows a programmed sequence of events, ignoring all information from the transmitters.

Operator Control your robot reacts based on information from the transmitters.

Combining autonomous and RC commands in your programs
You can combine these two elements in your program, but you must be sure to use the commands in the proper sequence.

You should not mix motor function blocks for the same motor from the Output group and the RC Control group in the same section of a loop! This will cause erratic behavior from the robot.

An example of improper sequence:

This sequence places the commands in a while loop, which constantly repeats different motor commands for the same motor, causing the controller to behave erratically.

An example of proper use:

The AUTONOMOUSANDRCCONTROL.ECP project show the proper use of autonomous and competition mode together. You can find the project file in the Sample directory.

Note how the motor functions are in the same if-else condition, but they are in separate sections of the condition.

View the Function Block Tree

Competition Template

A series of pre-defined templates are already available in easyC for your use in competitions like FIRST Tech Challenge, or informal in class competitions. A Competition Template provides a standardized platform for teams to use when competing in an event. There are many templates to choose from; each template has two periods of varying lengths, an autonomous period and an operator controlled period.

Note:

If you would like a custom competition template created for an in class competition, please contact the intelitek technical support department.

To open a Competition Template:
Go to File, and Select Open Project.

Change the ‘Files of Type’ from easyC Project to easyC Template using the drop down menu

The window will automatically display the default directory for Templates.

Choose your desired Template, and select Open.

No matter which template you choose, the Main Function will be displayed with two Function Blocks already defined. These Function Blocks refer to user functions which have also been pre-defined for your use. The numbers in parentheses indicate the length of time of each period. In the example shown below, the Competition Template ‘Mixed 2 min round 2’ will have an Autonomous period of 30 seconds followed by a Competition period of 90 seconds. If a period has a length of ‘0’ seconds, then that period will be skipped. To sequentially complete a Competition Template, do not use any of the jumper options described below.

Note:

Normally easyC keeps track time in milliseconds (1/1,000 of a second). Only in the Main Function of Competition Templates is time expressed in seconds.

You should have reason to program in both Autonomous and Operator Controlled Modes at some point during your preparation for a competition. In a Competition Template with both periods, the Autonomous period will always precede the Operator Controlled period.

Autonomous Mode
Autonomous Mode allows the robot to move independently of any operator controls for a prescribed length of time. The Autonomous period will begin when your robot first sees a signal from your transmitter. Your robot will then follow a programmed sequence of events, and will ignore all subsequent information from the transmitters. The orange eye on the controller will blink when the controller is in Autonomous Mode.

Note:

This means that switching off your radio controller WILL NOT deactivate the Autonomous period or your robot.

At the end of the allotted Autonomous period, your robot’s program will stop automatically. If the Autonomous period is followed by an Operator Controlled period, the Operator Controlled period will begin immediately.

Note:

If a jumper is placed in interrupt 5, only the Autonomous portion of the template will be executed.

Programming in the Autonomous Mode is very similar to creating a normal autonomous project. The only difference is that you should treat the Autonomous Function (contained in the user functions group) as if it were your Main Function when programming. The Autonomous Function does not have its own globals (use the regular Program Globals for those), however you should call your user functions from the Autonomous Function.

Operator Controlled Mode
Programming in the Operator Controlled Mode is very similar to programming in a normal project. The Operator Controlled period does not contain any predefined instructions, in fact it is completely blank at the start just like the Autonomous period. You have the ability to communicate with your transmitter during this period however, so you may add blocks from the RC Control group to drive your robot. You could also choose not to do this, and instead give your robot a further series of Autonomous instructions. Be careful when mixing Autonomous and RC commands.

Note:

Switching off your radio controller during the Operator Controlled period will stop your robot. If you turn your controller back on, your robot program will continue to execute until the allotted time expires.

At the end of the allotted Operator Controlled period, your robot’s program will stop automatically.

Note:

If a jumper is placed in interrupt 6, only the Operator Controlled portion of the template will be executed.