Autonomous Problems

Hi, I can’t get my autonomous to work here’s a picture any suggestions???

My first suggestion would be to be more specific about the nature of your problem. More information helps other people help you.

Are you sure it doesn’t work? Does the robot seem like it’s just about to get started and then just stop? Your whole autonomous only runs for 0.3 seconds. And you’re trying to get the motors up to 50 rpm. That’s less than 1 revolution per second for only 0.3 seconds. Even if you could instantly get to maximum speed, the motors would only rotate 0.25 revolution in total. Since it can’t get to that maximum speed instantly, I would expect something in the ballpark of 0.1 revolution in total. So if you see the robot just starting to roll and immediately stopping, it works perfectly.

Separately, I’m not sure about the spaces between the colons and the namespace. I’ve never seen it written that way. For example, I’ve always seen directionType::fwd as opposed to directionType ::fwd. I don’t know if those spaces make a difference or not.

The problem is not with the formatting however since you’re using v5 I highly suggest you replace the command with a “.startRotateFor()” command since it is a lot more accurate especially for autonomous. You also have to change the time from 0.3 seconds to 3 seconds by making it 3000 milliseconds rather than 300. The degrees on the .startRotateFor() can be made very precise with trial and error or you can also do math and take into account the size of you tires and the gear ratio and translate that into linear distance with degrees the degrees. This would be even more accurate but once again you can also just do trial and error. You can set it to rotate for say 1000 degrees which is about 2 feet depending on you the size of your robot.

so I tried your methods and none of it worked. our autonomous switch works but I still don’t know the problem I tried rotate for and it doesn’t work, have any other ways to do this?? They would be much appreciated

Here’s our Auton code, this may help you in how to set up an Auton code.

void autonomous() {
     //Setting Velocity Values (NO TOUCHIE)
Intake.setVelocity(90, velocityUnits::pct);
Intake2.setVelocity(100, velocityUnits::pct);
DeScore.setVelocity(100, velocityUnits::pct);
LeftShooterB.setVelocity(185, velocityUnits::rpm);
RightShooterB.setVelocity(185, velocityUnits::rpm);
RightDrive.setVelocity(90, velocityUnits::pct);
LeftDrive.setVelocity(90, velocityUnits::pct);
    //Autonomous Starts... NOW (Can touch but I don't advise it)
sleep(1, timeUnits::msec);
sleep(3.5, timeUnits::sec);
sleep(1, timeUnits::msec); //Shooting HIGH Flag ^
sleep(200,timeUnits::msec); //Drives to LOW Flag^
sleep(500,timeUnits::msec); //Backs away from LOW flag^
sleep(1,timeUnits::msec); //Turns to WAFFLE^
sleep(500,timeUnits::msec); //Goes at WAFFLE^
sleep(200,timeUnits::msec); //Turns to MID LOW Flag^
sleep(1,timeUnits::msec); //Hits MID LOW Flag^
sleep(1,timeUnits::msec); //Hits WAFFLE^
sleep(1,timeUnits::sec); //Drives away from the WAFFLE to allow fall^
//END AUTON TOTAL ~ 5 Points:1 High Flag, 2 Low Flag, 1 Low Waffle:

I need help, when we first tried to get the controller to control the robot it wouldn’t work and after we put some programming on it it wouldn’t switch from autonomous period to driver control, now the lights are all green and nothings working. we are using easy c v5.

Try deleting the space after “directionType” and “percentUnits” so it is “directionType::fwd” instead of “directionType ::fwd” That’s how we do it.