Go to Post You can never have enough FIRST! :D - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming
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
  #9   Spotlight this post!  
Unread 07-02-2008, 10:18
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,381
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: I am going crazy

We are doing exactly as you describe. It takes to simple functions, call the first one then call the second. The first one looks at the button inputs on the console, the second one sends the command to the lift function.
Code:
int Get_Oi_Switch (void)
{
	if (p1_sw_top == 1)
	{
		liftcmd = LOAD;
	}
	if (p1_sw_trig == 1)
	{
		liftcmd = HURDLE;
	}
	if (p1_sw_aux1 == 1)
	{
		liftcmd = PICK;
	}
	if (p1_sw_aux2 == 1)
	{
		liftcmd = PLACE;
	}
	return liftcmd;	
}
Code:
int Set_Lift_Height (int pos_demand)
{
  int liftdrv;
  int liftvel;
	liftpos = ((int)Get_Encoder_5_Count());
	liftposerr = (pos_demand - liftpos);
	liftvel = (liftpos - lastliftpos);
	lastliftpos = liftpos;  // Save position for next loop
	liftdrv = ((liftposerr * LIFT_KP) + (liftvel * LIFT_KD));  // Actual PD equation
	if (liftdrv > LIFT_MAX_V)
	{
		liftdrv = LIFT_MAX_V; // Limit lift speed to defined range
	}
	if (liftdrv < -LIFT_MAX_V)
	{
		liftdrv = -LIFT_MAX_V;
	}
	
	return (liftdrv + 127);
}
As you can see, there are some definitions that are set up outside of this file that define the individual heights and velocities. Also included in the Set_Lift_Height function is a PD loop. We are not using the integral function of a PID loop.


EDIT: If it helps, feel free to use this code. Just make sure you understand it and modify it to match your system. All I ask is that you let us know how it works out for you.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist

Last edited by billbo911 : 07-02-2008 at 15:29.
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
My error derivative is going crazy Nathans Programming 3 19-01-2008 17:56
crazy game Mike Ciance Fantasy FIRST 22 25-05-2004 11:37
Big for Joe! Going....Going..... archiver 2001 9 23-06-2002 23:29
crazy stuff chris144 Chit-Chat 19 08-04-2002 20:13


All times are GMT -5. The time now is 19:06.

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