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

Autonomous to User Control
http://www.robotc.net/forums/viewtopic.php?f=53&t=7121
Page 1 of 1

Author:  joshm4789 [ Tue Oct 29, 2013 11:58 am ]
Post subject:  Autonomous to User Control

My team has code for a test robot but with the competition template it skips the autonomous code and goes to user control


Code:
#pragma config(Motor,  port1,            ,             tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port9,            ,             tmotorVex393, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//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.

   // 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[port1] = 50;
   motor[port10] = 50;
   wait10Msec(1000);

   motor[port1] = 50;
   motor[port10] = -50;
   wait10Msec(1000);

   motor[port1] = -50;
   motor[port10] = 50;
   wait10Msec(1000);

   motor[port1] = -100;
   motor[port10] = 100;
   wait10Msec(1000);

   motor[port1] = 50;
   motor[port10] = 50;
   wait10Msec(2000);

   motor[port1] = 50;
   motor[port10] = -50;
   wait10Msec(1000);
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 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)
   {
      motor[port1] = vexRT[Ch2] / 2;
      motor[port10] = vexRT[Ch3] / 2;

      //Arm Control
      if(vexRT[Btn6U] == 1)
      {
         motor[port2] = 125;
         motor[port9] = 125;
      }
      else if(vexRT[Btn6D] == 1)
      {
         motor[port2] = -125;
         motor[port9] = -125;
      }
      else
      {
         motor[port2] = 0;
         motor[port9] = 0;
      }
   }
}

Author:  rcahoon [ Tue Oct 29, 2013 2:57 pm ]
Post subject:  Re: Autonomous to User Control

Hi joshm4789,
Your robot is not receiving any commands telling it to switch to autonomous mode. You either need a VEXnet Competition Switch or you can use the ROBOTC debugger.

Best,
--Ryan

Author:  kowens [ Fri Apr 04, 2014 8:55 am ]
Post subject:  Re: Autonomous to User Control

I am an advisor for two new TSA VEX teams and we seem to be having a similar problem. I am posting one teams programs to this reply.

Attachments:
File comment: Cannot get autonomous to trigger using stated buttons. Program goes straight to user control, optical encoders are not working as intended.
The final count down robot - Connor.txt [5.29 KiB]
Downloaded 595 times
File comment: Cannot get autonomous to trigger using the stated buttons. Program goes straight to user control.
Simon's New Competition format VEX - Copy.txt [7.97 KiB]
Downloaded 626 times

Author:  rcahoon [ Fri Apr 04, 2014 11:05 am ]
Post subject:  Re: Autonomous to User Control

Hi kowens,
I responded to your post in your other thread.

--Ryan

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