|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Need help figuring out how to use PID to go over an obstacle turn to a certain point. (ex. The position that the robot calibrates at)
This is the code I have so far. Code:
myRobot.SetSafetyEnabled(false); myRobot.Drive(-.5,0.0); Wait(1.5); myRobot.Drive(0.0, 0.0); turnController->SetSetpoint(0.0f); Wait(2.0); // Have to wait till the bot turns |
|
#2
|
||||
|
||||
|
Re: Using PID in autonomous to keep straight
Quote:
|
|
#3
|
||||
|
||||
|
Re: Using PID in autonomous to keep straight
Sorry for not explaining, we are using a gyro as a source with the output being our drivetrain.
|
|
#4
|
||||
|
||||
|
Re: Using PID in autonomous to keep straight
Quote:
Code:
double angle = robot.getAngle(); double angleError = AngleYouWantToBe - angle; double output = constant * angleError; myRobot.drive(output, 0); Wait(2.0); myRobot.drive(0, 0); If you want to get more complex than that, you could use a PI loop, but that's another story. Last edited by Poseidon5817 : 24-04-2016 at 01:56. |
|
#5
|
|||
|
|||
|
Re: Using PID in autonomous to keep straight
Here is the problem:
PID presumes continuous measurements. If you are crossing the low bar with no jerky movements, then PID works ok for driving straight (our robot drives like a slightly drunken sailor). Over the other Defenses, the jerkiness throws off PID. You will eventually head in the right direction (gyro), but you may be off track to the left/right. |
|
#6
|
||||
|
||||
|
Re: Using PID in autonomous to keep straight
Quote:
We used proportional control to drive straight in auto, and we didn't have any problems. |
|
#7
|
||||
|
||||
|
Re: Using PID in autonomous to keep straight
Yeah but the issue is its unpredictability. For example, the ramparts tend to send robots in any direction, and there's no good way to predict that. Also, a couple inches can be a big deal, particularly when trying to shoot without a vision system. Earlier in the season, we calculated that the margin of error when shooting the high goal in auto (if you go straight through the low bar and spin) to be ~1.5 degrees and 2-3 inches IIRC.
|
|
#8
|
|||
|
|||
|
Re: Using PID in autonomous to keep straight
We did not use a PID just the Proportional part of it... and it is good enough to cross the ramparts in auto, then spin 180 and cross them again during lab work. We never had any issues staying straight on any of the defenses.
There are some items that we will be cleaning up in the off season but it did work. As a matter of fact auto was better then telle-op. https://github.com/WhitmoreLakeTroBo.../CMDdrive.java https://github.com/WhitmoreLakeTroBo...tCaluator.java |
|
#9
|
||||
|
||||
|
Re: Using PID in autonomous to keep straight
Here is a link to our entire code https://github.com/Dpurry23/FRC-Team.../src/Robot.cpp
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|