View unanswered posts | View active topics It is currently Sun Sep 15, 2019 4:04 pm






Reply to topic  [ 2 posts ] 
How can I test out Autonomous without a competition switch? 
Author Message
Rookie

Joined: Thu Mar 05, 2015 9:05 pm
Posts: 1
Post 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.


Thu Mar 05, 2015 9:12 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post 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

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.


Fri Mar 06, 2015 10:59 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.