We have had some problems with our Autonomous modes while running on the competition switch. When we run autonomous mode when plugged into the competition switch, it will run fine, but if we disable the robot mid autonomous and switch to driver control, it will rerun the autonomous. Is there anything we can do to fix this?
If you set this to false and don’t control your tasks by yourself, the robot keeps on running autonomous in some cases and moves around randomly in other cases.
There also may be something you changed accidentally, so try recopying into a new competition template, too.
I had the same thing (I think) during Skyrise
I had this set to false for the first few matches at worlds. This glitched out my autonomous last year (except when I was on field 3) and the robot was basically disabled the rest of the match. My team’s driver was furious with me, but looking back, it was a fun time Thanks to RobotC support for finding this for me!
Well, we did have bStopTasksBetweenModes set to false, but if it is set to true we can not do anything. I believe this is because we use pre_auton for autonomous selection, on the LCD. I tried using stopTask(autonomous) as it enters driver control, but that crashes the cortex and sends it back to initialize. Any way to fix this? If anything I can set a maximum time for each autonomous.
I actually don’t seem to see much of an issue with your code. Does your autonomous selector work as intended?
I do have a few interesting things you might want to be aware of. So motors keep pulling the same amount of power from the cortex after you set them. You do not need to loop and keep sending motors power. That means that
while (time1[T3] < 3000) //Initialize Launcher
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
}
while (time1[T3] >= 3000 && time1[T3] < 3275) //Load First Ball
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[conveyorMotor] = -127; //Conveyor In
ballsLaunched = 1;
}
while (time1[T3] >= 3275 && time1[T3] < 5275) //Recharge Launcher
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[intakeMotor] = -127; //Intake In
}
while (time1[T3] >= 5275 && time1[T3] < 5550) //Load Second Ball
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[intakeMotor] = -127; //Intake In
motor[conveyorMotor] = -127; //Conveyor In
ballsLaunched = 2;
}
while (time1[T3] >= 5550 && time1[T3] < 7550) //Recharge Launcher
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[intakeMotor] = -127; //Intake In
}
while (time1[T3] >= 7550 && time1[T3] < 8000) ///Load Third Ball
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[intakeMotor] = -127; //Intake In
motor[conveyorMotor] = -127; //Conveyor In
ballsLaunched = 3;
}
while (time1[T3] >= 8000 && time1[T3] < 10000) //Recharge Launcher
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[intakeMotor] = -127; //Intake In
}
while (time1[T3] >= 10000 && time1[T3] < 15000)
{
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[intakeMotor] = -127; //Intake In
if (time1[T3] >= 10200 && time1[T3] < 10450)
{
motor[conveyorMotor] = 0;
}
else if (time1[T3] >= 10250)
{
motor[conveyorMotor] = -127; //Conveyor In
}
ballsLaunched = 4;
}
Could have almost entirely been replaced by
motor[leftTopLauncher] = 74; //Launcher On
motor[leftBottomLauncher] = 74;
motor[rightTopLauncher] = 74;
motor[rightBottomLauncher] = 74;
motor[conveyorMotor] = -127; //Conveyor In
delay(5000);
Edit: I might make another pass at reading through the code by deleting entire chunks of code at a time until its easier to read see all the brackets.
Our autonomous selector program works great. Also, the reason why I have the motor speeds in while loops is that when I tried it the other way, the motors would turn on, and shut off immediately. I will try it again, hopefully doing it right this time
I will redownload the code next time I get to the robot and I will try it. I was testing setting bStopTasksBetweenModes while attached to a competition switch, and when disabled it would cause the problems.
I thought he said that it didn’t seem to fix the problem when he tried it. I was assuming he was going to have extra tasks that were running during autonomous and were never killed before driver control. This is something I have seen a few times on teams that never tested what happens if their robot’s autonomous is not able to finish and thus never kills its own tasks.
I was using wait1MSec(x) originally when I tried to make my program more simple, instead of delay(x). As I realized this after I left for the night, I was unable to test it. For now, we have a competition this Sunday and I may keep what I have, but thanks for the help!
As for some of the autonomous problems, I was unable to redownload code with bStopTasksBetweenModes to true, because we ran into some other urgent problems.
During the last week or two, we have had a problem of two motors on our flywheel randomly inverting, where one minute they will spin fine, but the next time the flywheel is powered up, two motors are randomly inverted, causing the flywheel to seize up, and we are unable to use it. Then, we start inverting motors in code, and after 15 minutes of trying, the motors will work the same as before they inverted, as in it works with the original motor configuration. All four motors are for the flywheel, and all of them are on a VEX Battery Expander A2 running nearly full battery, with the sensor port on the battery expander linking to the cortex. Is there a reason behind this? Probably the worst thing to have at a competition.
Also, we have problems with Button responses either not working, or severely lagging. Could this be caused by sensors overloading the CPU? Occasionally buttons will not respond, but eventually they work, with an occasional pause or bad lag. Anything we can do?
Thanks for all of the help already! If anyone wants to see the code, it is posted above. Minimal changes have been made tonight, we have had the same problem in previous nights.
delay, wait1Msec and sleep all do exactly the same thing. Here are their definitions (from RobotCIntrinsics.c which is a public file, no secrets here).
intrinsic void wait1Msec(const long nMSec) asm(opcdWaitTimer1MSecLong, variable(nMSec));
intrinsic void sleep(const long nMSec) asm(opcdWaitTimer1MSecLong, variable(nMSec));
intrinsic void delay(const long nMSec) asm(opcdWaitTimer1MSecLong, variable(nMSec));
I have not heard of anything like this before, which version of ROBOTC are you using? It sounds more like someone playing with the wiring.