Go to Post Teams should spend more time talking about how to avoid penalties during their strategy sessions. - Rob [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-31-2015, 05:11 PM
jgrindle's Avatar
jgrindle jgrindle is offline
Losing Sleep
AKA: John Grindle
FRC #5122 (RobOTies)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Old Town, ME
Posts: 34
jgrindle will become famous soon enough
Kiwi Drive and Integrating PID Loops

Hey Everyone,
I got two main questions for today. The first being with a kiwi drive, I know that in general for driving the function would look a little like this:
Code:
void DriveBase::Drive(float joy_X, float joy_Y, float joy_Z){
	float Con1 = (joy_X + joy_Z);
	float Con2 = ((-((joy_X)/2))+((sqrt(3)/2)*(joy_Y)) + joy_Z);
	float Con3 = ((-((joy_X)/2))-((sqrt(3)/2)*(joy_Y)) + joy_Z);

	c1->Set(Con1);
	c2->Set(Con2);
	c3->Set(Con3);
}
But in design I do not have an equilateral triangle. I have what I am deeming a "Butterfly" Do I have to change any of the above code, to make this work?

Onto the next part. Along with that I have a custom PD loop that I am working on, I currently have not integrated the I term, as we have not gone over integrals in Calculus yet. I have decided against going with a regular Subsystem, because of how much of a pain they were during build season; I have less time than I did in build season, I have two weeks. Currently my code for the PD Drive is
Code:
//Used to fix deadzones on Joysticks, Gyros, or anything else
void DriveBase::dzFixer(float z){
	if((z >-(deadzone)) && (z < (deadzone))){
		z = 0;
	}
}

void DriveBase::PDDrive(float drive, float turn, float strafe, float kp, float kd)
{
	x = g1->GetAngle();
	dzFixer(x);
	dzFixer(turn);
	if(turn == 0 && (strafe > deadzone|| strafe < deadzone))
	{
		output = ((0 - x)* kp) + ((x+kp)*kd);// First Parentheses = Error, Second set = Derivitive of the first term
	}
	Drive(drive, output, strafe); //Correction made here
}
Is this sufficient? Should I go about and add an I term? If so, how would I do that? Is there an easier way?
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 05:23 AM.

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