ROBOTC.net forums
http://www.robotc.net/forums/

How can I test out Autonomous without a competition switch?
http://www.robotc.net/forums/viewtopic.php?f=11&t=10614
Page 1 of 1

Author:  TerryHerrmann [ Thu Mar 05, 2015 9:12 pm ]
Post subject:  How can I test out Autonomous without a competition switch?

Hi, I'm sort of new to programming and am confused on how to test out a simple autonomous program with a competition switch.

Here is a copy of my code;
Code:
#pragma config(Motor,  port1,           RightWheels,   tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor,  port2,           HighRight,     tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           Lift1,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           Port4,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           Port5,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           Port6,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           Port7,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           Port8,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           HighLeft,      tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port10,          LeftWheels,    tmotorVex393_HBridge, openLoop)
#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!

/////////////////////////////////////////////////////////////////////////////////////////
//
//                          Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////

void pre_auton()
{
   // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
   // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
   bStopTasksBetweenModes = false;

   // All activities that occur before the competition starts
   // Example: clearing encoders, setting servo positions, ...
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{
   motor[LeftWheels]=127;
   motor[HighLeft]=127;
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 User Control Task
//
// This task is used to control your robot during the user control phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task usercontrol()
{
   // User control code here, inside the loop

   while (true)
   {
      if(vexRT[Btn6D] == 1)
         {
            motor[LeftWheels] = vexRT(Ch3);
            motor[RightWheels] = vexRT(Ch2);
            motor[HighLeft] = -vexRT(Ch3);
            motor[HighRight] = vexRT(Ch2);
         }
      else
         {
            motor[HighLeft] = 0;
            motor[HighRight] = 0;
            motor[LeftWheels] = vexRT(Ch3);
            motor[RightWheels] = vexRT(Ch2);
         }


      if(vexRT[Btn7U] == 1)
          {
             motor[Lift1] = 127;
          }
       else if(vexRT[Btn7D] == 1)
          {
             motor[Lift1] = -127;
          }
       else
          {
             motor[Lift1] = 0;
          }

   }
}


I just want to test out moving the left wheels autonomously but can't figure out how to switch to autonomous mode. Whenever I press start on the debugger submenu, nothing happens.

Author:  JohnWatson [ Fri Mar 06, 2015 10:59 am ]
Post subject:  Re: How can I test out Autonomous without a competition swit

Try using the Competition Control Debug window that's included with ROBOTC; it can be used to emulate a Competition Switch when the Cortex/Joystick Controller are connected via VEXNet and the Joystick is connected to the computer via the Programming Hardware Kit.

ROBOTC Competition Control: http://help.robotc.net/WebHelpVEX/index ... ontrol.htm

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/