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

program is not consistent
http://www.robotc.net/forums/viewtopic.php?f=11&t=7652
Page 1 of 1

Author:  team3233 [ Fri Jan 10, 2014 12:49 pm ]
Post subject:  program is not consistent

I try to run my autonomous program and sometimes it does what I'm telling it to and other times the robot will spin in a circle and my lift will only lift one side. That is not what my program tells my robot to do. what am I doing wrong?

here is my program:


#pragma config(Sensor, dgtl1, solenoid1, sensorDigitalOut)
#pragma config(Sensor, dgtl2, solenoid2, sensorDigitalOut)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#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 = true;

// 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()
{
SensorValue[solenoid1] = 1;
SensorValue[solenoid2] = 1;
wait1Msec(500);
SensorValue[solenoid1] = 0;
SensorValue[solenoid2] = 0;
wait1Msec(350);
motor[port2] = 127;
motor[port4] = 127;
motor[port6] = -127;
motor[port8] = -127;
wait1Msec(1500);
motor[port2] = 127;
motor[port4] = 127;
motor[port6] = 127;
motor[port8] = 127;
wait1Msec(100);
motor[port2] = 0;
motor[port4] = 0;
motor[port6] = 0;
motor[port8] = 0;
wait1Msec(500);
motor[port3] = 127;
motor[port5] = 127;
motor[port7] = 127;
motor[port9] = 127;
wait1Msec(1400);
motor[port3] = 0;
motor[port5] = 0;
motor[port7] = 0;
motor[port9] = 0;
wait1Msec(500);
motor[port2] = 127;
motor[port4] = 127;
motor[port6] = -127;
motor[port8] = -127;
wait1Msec(500);
motor[port2] = 0;
motor[port4] = 0;
motor[port6] = 0;
motor[port8] = 0;
wait1Msec(500);


// .....................................................................................
// Insert user code here.
// .....................................................................................

AutonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}

/////////////////////////////////////////////////////////////////////////////////////////
//
// 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)
{
// This is the main execution loop for the user control program. Each time through the loop
// your program should update motor + servo values based on feedback from the joysticks.

// .....................................................................................
// Insert user code here. This is where you use the joystick values to update your motors, etc.
// .....................................................................................

bMotorFlippedMode[port6] = true;
bMotorFlippedMode[port8] = true;



motor[port2] = vexRT[Ch3];
motor[port4] = vexRT[Ch3];
motor[port6] = vexRT[Ch2];
motor[port8] = vexRT[Ch2];

if(vexRT[Btn6U] == 1)
{
motor[port3] = 127;
motor[port5] = 127;
motor[port7] = -127;
motor[port9] = 127;

}
else if(vexRT[Btn6D] == 1)
{
motor[port3] = -127;
motor[port5] = -127;
motor[port7] = 127;
motor[port9] = -127;
}
else
{
motor[port3] = 0;
motor[port5] = 0;
motor[port7] = 0;
motor[port9] = 0;
}

if(vexRT[Btn5U] == 1)
{
motor[port1] = -127;
motor[port10] = 127;


}
else if(vexRT[Btn5D] == 1)
{
motor[port1] = 127;
motor[port10] = -127;

}
else
{
motor[port1] = 0;
motor[port10] = 0;

if(vexRT[Btn8U] == 1)
{
SensorValue[solenoid1] = 1;
SensorValue[solenoid2] = 1;


}
else if(vexRT[Btn8U] == 0)
{
SensorValue[solenoid1] = 0;
SensorValue[solenoid2] = 0;

}
else
{
SensorValue[solenoid1] = 0;
SensorValue[solenoid2] = 0;// Remove this function call once you have "real" code.
}
}
}
}

Author:  Phoenix [ Fri Jan 10, 2014 10:11 pm ]
Post subject:  Re: program is not consistent

sometimes the program dont work perfectly because is bugged or something try cleaning the program :bigthumb:

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