Go to Post What? No Poof balls as pillows? Phfff. Amateur. :p - artdutra04 [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
  #1   Spotlight this post!  
Unread 31-01-2009, 09:07
bronxbomber92 bronxbomber92 is offline
Registered User
FRC #1551 (Grapes of Wrath)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Naples
Posts: 75
bronxbomber92 is an unknown quantity at this point
Autonomous PID movement

Hi,

For autonomous mode I'm able to find the target and calculate a setpoint to turn to, but I'm not sure I'm actually using PID control correctly. Here is what I'm doing in pseudo code

Code:
class PIDCameraSource : public PIDSource
{
public:
	PIDCameraSource() : source_( 0.0f ) {
	}
	
	virtual Double PIDGet() {
		return source_;
	}
	
	void SetSource( Double source ) {
		source_ = source;
	}
	
private:
	Double source_;
};

class PIDCameraOutput : public PIDOutput
{
public:
	PIDCameraOutput() : output_( 0.0 ) {
	}
	
	virtual void PIDWrite( Float output ) {
		output_ = output;
	}
	
	Float GetOutput() const {
		return output_;
	}
	
private:
	Float output_;
};


static int currentDriveX_ = 0; // really a member variable, not a static

if( TargetFound ) {
    pidSource_.SetSource( currentDriveX_ ); // pidSource_ is a member variables
    pidController_.SetSetpoint( normalize_x_center_of_mass ); // as well pidController_
}

robotDrive_.Drive( speed, (currentDriveX_ = pidOutput_.GetOutput()) ); //  speed calculate elsewhere
Basically, my source is just my last PID output. Is that wrong? Obviously there is not direct 1-to-1 relationship between the a turn curve and the values actually sent to the two drive motors for tank control, but should I still try to calculate what the turn curve is from the two motors or is what I have sufficient?

Also, what's the best to go about getting the PID constants right? I seem to be having a hard time calculating something that works and I'm not sure if it's because I'm just using PID control wrong, or if my constants are just to far off.
 


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
Joystick Movement PHSRobotics NI LabVIEW 1 23-01-2009 22:42
Axis Camera Movement Sauce NI LabVIEW 5 20-01-2009 21:05
New Code - No Movement Guarana Programming 1 13-02-2008 20:17
Arm movement program1 Programming 3 28-01-2008 11:49
Movement Hunter1539 Rules/Strategy 4 09-01-2008 22:06


All times are GMT -5. The time now is 21:53.

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