![]() |
PID & One Second Delay Between Auto and TeleOp
This year we have a giant arm that sticks behind our robot, with two joints. At the end of an arm is a claw. One of our autonomous modes is that the both parts will drop down, our robot will drive backwards, our claw will close on the bin on the center step, and the arm will then fold up and set the bin so that it is resting on our robot while still grabbing the bin. The problem is, during the one second between autonomous and teleop, our PID is disabled so the arm droops a little and some of the time we drop that bin. I've temporarily fixed the problem by storing the bin in a different position where if the PID disables none of the parts of the arm will droop, but it is vital for our drivers to start in the docked position.
So: - Is it possible to operate the PID during this 1 second delay? - Is this delay considered "disabledPeriodic" - Are there any other fixes? |
Re: PID & One Second Delay Between Auto and TeleOp
Something to try:
After the arm has reached the proper position and stabilized, get the voltage setting for the motor, set that voltage and disable the PID (or perhaps swap the order). This setting seems more likely to survive the transition from auto to teleop. |
Re: PID & One Second Delay Between Auto and TeleOp
I believe the robot is in the disabled state during the period between autonomous and teleop, so no commanding will be sent to the motor controllers. Someone with a roboRIO at hand could validate that.
Without seeing your mechanism, it's hard to picture what would work. Bungees or constant force springs are often used in similar scenarios when you need a balancing force. |
Re: PID & One Second Delay Between Auto and TeleOp
GeeTwo:
I tried creating two variables and setting it to the .getAverageVoltage() for each potentiometer on the arm during Auto Periodic and then in TeleOpInit I would set the setPoint for each part of the arm to their respective variable but I didn't seem to get the arm to jump back up to its previous position, and sometimes the first part of the arm had drooped too much and the bin had already fell. |
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
|
Re: PID & One Second Delay Between Auto and TeleOp
![]() Above is the image of what we call our "Stinger" It has two parts: The shoulder and the elbow. The shoulder is the bottom part and the elbow is the part that is turned, think of it as an actual human arm where the joint is where the elbow starts. This is our old docked position, now our shoulder is a little farther up so it's not at 0 degrees. |
Re: PID & One Second Delay Between Auto and TeleOp
Also, are you using the same motor controller object between auto and tele? Declaring a new motor controller at the beginning of teleop would presumably reset the throttle to zero.
|
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
Yes. The only time we declare motor controllers is in robotInit. |
Re: PID & One Second Delay Between Auto and TeleOp
Glad to see the picture - not what I hand in mind (I was thinking of an overhead arm). Putting the arm vertical or nearly vertical leaning against the tall frame would presumably handle the temporary "storing the bin in a different position where if the PID disables none of the parts of the arm will droop".
Would it help if you used your temporary solution, then at the beginning of teleop, the robot automatically moved the arm to the "docked" position, without waiting on driver input? |
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
What I'm doing temporarily is bringing the shoulder back down to 0 degrees, and then making the elbow go to 90 degrees, in which nothing falls. I guess at teleop init I could set both of the positions to go to docked position. Which raises another question: - Is there any way to do something only if the robot is in practice mode or playing an actual match? |
Re: PID & One Second Delay Between Auto and TeleOp
DriverStation::IsFMSAttached() helps you with part of your question.
|
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
Code:
DriverStation.getInstance().isFMSAttached() |
Re: PID & One Second Delay Between Auto and TeleOp
Do you guys think this would work?
Code:
robotInit(){ |
Re: PID & One Second Delay Between Auto and TeleOp
Or I could add
Code:
disabledInit(){ |
Re: PID & One Second Delay Between Auto and TeleOp
Remember you also have DisabledInit and DisabledPeriodic available.
|
| All times are GMT -5. The time now is 10:49. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi