458 views

# Autonomous Problems

1. 3 weeks ago

### Ellis Engineer Levi

Jan 2

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

Jan 3 WA

3. ### callen

Jan 3 Braintree, MA, USA

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.

4. ### mvas8037

Jan 3

@callen 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.

5. 2 weeks ago

### Ellis Engineer Levi

Jan 4
Edited 2 weeks ago by Ellis Engineer Levi

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

6. ### G.A.T Wrenches

Jan 4 Groton 9050 C

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)
LeftDrive.stop(brakeType::brake);
RightDrive.stop(brakeType::brake);
sleep(1, timeUnits::msec);
LeftShooterB.spin(directionType::fwd);
RightShooterB.spin(directionType::fwd);
Intake.spin(directionType::fwd);
sleep(3.5, timeUnits::sec);
LeftShooterB.stop(brakeType::coast);
RightShooterB.stop(brakeType::coast);
Intake.stop(brakeType::brake);
sleep(1, timeUnits::msec); //Shooting HIGH Flag ^
RightDrive.rotateFor(directionType::rev,.114,rotationUnits::rev,true);
RightDrive.rotateFor(directionType::rev,3.3,rotationUnits::rev,false);
LeftDrive.rotateFor(directionType::fwd,3.3,rotationUnits::rev,true);
sleep(200,timeUnits::msec); //Drives to LOW Flag^
RightDrive.rotateFor(fwd,1.5,rotationUnits::rev,false);
LeftDrive.rotateFor(directionType::rev,1.5,rotationUnits::rev,true);
sleep(500,timeUnits::msec); //Backs away from LOW flag^
RightDrive.rotateFor(directionType::fwd,1.2,rotationUnits::rev,false);
LeftDrive.rotateFor(directionType::fwd,1.2,rotationUnits::rev,true);
sleep(1,timeUnits::msec); //Turns to WAFFLE^
RightDrive.rotateFor(directionType::rev,2.52,rotationUnits::rev,false);
LeftDrive.rotateFor(fwd,2.52,rotationUnits::rev,true);
sleep(500,timeUnits::msec); //Goes at WAFFLE^
LeftDrive.rotateFor(directionType::rev,1.1,rotationUnits::rev,false);
RightDrive.rotateFor(directionType::fwd,1.1,rotationUnits::rev,true);
sleep(200,timeUnits::msec); //Turns to MID LOW Flag^
RightDrive.rotateFor(directionType::rev,1.19,rotationUnits::rev,false);
LeftDrive.rotateFor(fwd,1.19,rotationUnits::rev,true);
sleep(1,timeUnits::msec); //Hits MID LOW Flag^
RightDrive.rotateFor(fwd,3.5,rotationUnits::rev,false);
LeftDrive.rotateFor(directionType::rev,3.5,rotationUnits::rev,true);
sleep(1,timeUnits::msec); //Hits WAFFLE^
RightDrive.rotateFor(directionType::fwd,1,rotationUnits::rev,true);
RightDrive.rotateFor(directionType::rev,1,rotationUnits::rev,false);
LeftDrive.rotateFor(fwd,1,rotationUnits::rev,true);
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:

}```
7. last week

### sumowresler76

Jan 11
Edited last week by sumowresler76

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.

8. ### Robo Chickens

Jan 11 Sioux Falls, SD 99707K

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