View unanswered posts | View active topics It is currently Tue Sep 30, 2014 3:09 pm






Reply to topic  [ 2 posts ] 
program is not consistent 
Author Message
Rookie

Joined: Fri Jan 10, 2014 12:44 pm
Posts: 2
Post 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.
}
}
}
}


Fri Jan 10, 2014 12:49 pm
Profile
Rookie
User avatar

Joined: Mon Sep 02, 2013 12:54 pm
Posts: 12
Post Re: program is not consistent
sometimes the program dont work perfectly because is bugged or something try cleaning the program :bigthumb:

_________________
Team 7472-C CoBaCu

Image


Fri Jan 10, 2014 10:11 pm
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.