Go to Post This is the type of thing that puts an evil glint in Dave's eye and a smile on his face... - Wetzel [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 24-02-2016, 14:27
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 666
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: LimitSwitches

Alternatively, you can do fairly sophisticated software control on your lift such that it knows when it's approaching the limit switches (via encoder/potentiometer) and applies PID control to slow it down. So eventually, it will gently "hit" the limit switch and stop. In fact with this capability, you don't even need the upper limit switch, this is called "soft limit". This is especially useful because while it is generally easy to add a lower limit switch, it is sometimes difficult to add an upper limit switch. For example, if you have an extending arm, it is sometimes impossible to find a place to mount an upper limit switch because it extends into open space. We have a PIDMotor class in our library that implements this capability. There is a method in this class:
Code:
public void setPidPower(double power, double minPos, double maxPos, boolean holdTarget)
In this method, you tell it what maximum motor power you want to drive the motor (typically, it receives this value from the joystick). You also provide the range of motion the motor can travel. It will check against this range using the encoder (or potentiometer). A lower limit switch is used to "zero calibrate" the encoder (or potentiometer). An optional upper limit switch can be used as an additional safety for the upper range. Finally, the holdTarget boolean specifies whether it should use active PID to hold the current position when you stop the motor (i.e. power is set to zero). The code for this class can be found here.
https://github.com/trc492/Frc2016Fir...cPidMotor.java
__________________
Reply With Quote
 


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 09:35.

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