Go to Post My wife is in advertising, and uses a scary amount of math. They have to know how to target you and beat down your defenses, so that you buy that hamburger while driving that car while wearing those designer jeans to your favorite store. - Not2B [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 Rating: Thread Rating: 31 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 27-01-2012, 16:25
l0stboy l0stboy is offline
Registered User
FRC #4064 (InZombiacs)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: United States
Posts: 22
l0stboy is an unknown quantity at this point
Help Setting Up PID System for Tank Drive Train

My team is making 4 motor drive train that has two on each side with a jaguar attached to each motor. I have a basic understanding of the CommandBase structure included in the library, but I'm not sure what I would use for the pid loop when it comes to values, constants, and to do with returnPIDInput(). I'm not entirely sure what sort of input the jaguars can have, and that's the source of my problem. I keep seeing that they have built in encoders? Here's my code so far. I hope that once I figure out how to use PID here I'll be able to use a similar format to control our "arm."



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.command.PIDSubsystem;
import edu.wpi.first.wpilibj.templates.RobotMap;

/**
*
* @author l0stboy
*/
public class DriveTrain extends PIDSubsystem {

private static final double Kp = 0.0;
private static final double Ki = 0.0;
private static final double Kd = 0.0;


//declare objects

RobotDrive zombieDrive;




// Initialize your subsystem here
public DriveTrain() {
super("DriveTrains", Kp, Ki, Kd);

// Use these to get going:
// setSetpoint() - Sets where the PID controller should move the system
// to
// enable() - Enables the PID controller.
zombieDrive = new RobotDrive(RobotMap.leftBackMotor, RobotMap.leftFrontMotor,
RobotMap.rightBackMotor, RobotMap.rightFrontMotor);

}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());d
setDefaultCommnad(JoystickDrive);
}

protected double returnPIDInput() {
// Return your input value for the PID loop
// e.g. a sensor, like a potentiometer:
// yourPot.getAverageVoltage() / kYourMaxVoltage;
return zombieDrive.get;
}

protected void usePIDOutput(double output) {
// Use output to drive your system, like a motor
// e.g. yourMotor.set(output);
}
}
__________________

Pedro
Ocala InZombiacs

Last edited by l0stboy : 27-01-2012 at 16:37.
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 12:21.

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