Go to Post Every single team in FRC has had a rookie season. All those... have stories. Some are sad, some are funny, some are inspiring - but all the teams have stories to be told... Each year is a chapter in the team's history book with stories to be told and shared. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 14-02-2011, 18:41
umangv620 umangv620 is offline
Programming Captain
AKA: Umang
FRC #1403 (Cougar Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2008
Location: New Jersey
Posts: 80
umangv620 will become famous soon enoughumangv620 will become famous soon enough
Re: Acceleration based on position

Since I can't really use PIDs to slow down the motor when it reaches either limit, and allow free control of the motor through joystick otherwise, I tried another method that doesnt involve PIDs or case structures.

I made a function f(x) = .2 + .8sin(pi*x/1000) , and am using this to control the motor. X is an input that has the value of the encoder's position, and f(x) is multiplied with the joystick axis value to get the motor speed. When the position is near either limit, it will have a minimum speed of .2, allowing the motor to still move, yet not overshoot too badly that will cause harm. When it is not in the middle, it has a higher motor speed, allowing the motor to move from one side to the other as fast as it can.

I have that code combined with the limit switch code (using encoders) so that the elevator can't keep going up when it hits the top limit, and vice versa for the bottom. This code should technically work, right?
__________________
Team 1403 Cougar Robotics

2009-2011 Programming Captain

2010
NJ-Regional - Chairmans Award
Reply With Quote
  #17   Spotlight this post!  
Unread 14-02-2011, 19:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,034
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Acceleration based on position


Let XU be the upper position limit.

Let XL be the lower position limit.

Let X be the current position, between those limits.

Let K be the size of the "speed zone" near either limit, where speed gets reduced.

Let J be the joystick command, between -1 and +1, where +1 commands a speed toward the upper limit.

Then:

Code:
if ( (X>XU-K) && (J>(XU-X)/K) ) J=(XU-X)/K;
else
if ( (X<XL+K) && (J<(XL-X)/K) ) J=(XL-X)/K;

Reply With Quote
  #18   Spotlight this post!  
Unread 14-02-2011, 20:33
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Acceleration based on position

If you reverse your decision and want to use PIDs, you may want to consider joystick control where some input takes the elevator between a few known height set points -- say floor, lower peg, feed slot, middle peg, upper peg.

For more control, if the driver presses and holds a button, the joystick value is sent directly to the motor. OR you can make it to where this mode changes the set point.

Greg McKaskle
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 04: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