Go to Post As usual this was the programmers fault. - Swampdude [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 09-03-2011, 05:30
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 357
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Protecting against runaway PID

This is in C++. What are some ways to prevent runaway of the motor when using the PID controller with an encoder when the encoder is not plugged in, it fails or the wire comes loose? The only thing I can think of is monitoring the encoder for changes over time and if the motor is driving beyond a certain threshhold and the encoder is not changing, turn off the motor. The PID controller could be applying a small amount of power to hold the arm still but in this case the encoder would probably be changing small amounts, as its not being held perfectly still.

Also, we could have a limit switch connected to the jaguar to turn it off if the arm reaches its limits. Plus safe mechanical stops.

Thanks,
Brian
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
  #2   Spotlight this post!  
Unread 09-03-2011, 08:36
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Protecting against runaway PID

I would use the limit switch, along with safe mechanical stops. I believe you can poll the limit switch inputs on the Jaguars over CAN (assuming you're using it) and you could have the robot program check that periodically, if you see it set, you can tag a flag in your program, display an alert indicator on the Dashboard and switch to some kind of backup Vbus control mode or something.

I'd definitely put the limit switches in, the only way to keep a closed loop control system safe is to keep the loop closed, even if its just barely closed by a limit switch.

Matt
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
Reply With Quote
  #3   Spotlight this post!  
Unread 09-03-2011, 12:57
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,039
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Protecting against runaway PID

If you're using the PIDController class in WPILib, instead of using the motor as a PIDOutput directly, we have used an intermediate class that checks to see if the motor is being manually overriden, and if so to not allow the PID controller to send output to the motor. Something like..

Code:
void PIDWrite(float output)
{
    if (!m_motor_overridden)
        m_motor.Set( output );
}
This year we're using the CAN mode of the Jaguars, and you can switch control modes from position mode to manual mode, and back. However, we didn't get enough testing time, and we had a bit of trouble getting the position mode to work [even just by itself, without the manual mode] because of what we suspect may be a faulty encoder... so we'll be playing with that soon before our competition in April. But we have shown that you can successfully switch modes.

We also have limit switches hooked up to prevent our arm from traveling too far.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:36.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi