View Single Post
  #1   Spotlight this post!  
Unread 05-02-2015, 19:54
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 609
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Need help with testing PID for an elevator

We run this code:
Code:
{
private:
	//Initializing livewindow
	LiveWindow *lw;
	//Initializing stick
	Joystick *stick;
	//Initializing the Chassis parts
	Talon *kFrontLeftMotor;
	Talon *kFrontRightMotor;
	Talon *Elevator;
	RobotDrive *robot;
	Relay *Fan;
	DoubleSolenoid *shifter;
	Encoder *ChassisEnc;
	Encoder *OtherEnc;
	Encoder *ElevatorEnc;
	//Initializing the values for Cheesy Drive
	float Rotation;
	float Acceleration;
	float rightMultiplier;
	float leftMultiplier;
    double automode;
    Gyro *gyro;
    bool robottime;
    double Angle;
    DoubleSolenoid *ElevSol;
    bool robotdrive;
   double Kp = 0.03;
   DigitalInput *Limit;
   PIDController *ElevatorPID;
	void RobotInit()
	{

		SmartDashboard::init();
		lw = LiveWindow::GetInstance();
		stick = new Joystick(0);
		kFrontLeftMotor = new Talon(0);
		kFrontRightMotor = new Talon(1);
		Elevator = new Talon (2);
		robot = new RobotDrive(kFrontRightMotor, kFrontLeftMotor);
		Fan = new Relay (3);


		/* Setting the shifter as a DoubleSolenoid
		 * Because we're using both pistons off of
		 * one Double Solenoid
		 */
		shifter = new DoubleSolenoid (0,1);

		ChassisEnc = new Encoder (0,1, false, Encoder::EncodingType::k4X);
		OtherEnc= new Encoder (8,9, false, Encoder::EncodingType::k4X);

		//Setting it so the fan is off by default
		Fan->Set(Relay::kOff);


		//Setting the Rotation and Accel values
		Rotation = stick->GetRawAxis(1);
		Acceleration = stick->GetRawAxis(3);

	    /*Setting the multipliers
	     * so that they don't allow
	     * a robot to go full forward
	     * while going full turn
	     */

		rightMultiplier = Rotation + Acceleration;
		leftMultiplier = Rotation - Acceleration;

		//Setting the shifter to Low Gear
		shifter->Set(DoubleSolenoid::kReverse);
		robot->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
		robot->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);

		ChassisEnc->SetDistancePerPulse(.084);
		OtherEnc->SetDistancePerPulse(.084);
        ElevatorEnc->SetDistancePerPulse(.5);
	gyro = new Gyro (1);
	Angle = gyro->GetAngle();

	if (stick->GetRawButton(1))

		{
			automode = 1;
		}
		if (stick->GetRawButton(2))
		{
			automode = 2;
		} else {
			automode = 0;
		}
	SmartDashboard::PutNumber("Auto:", automode);
gyro->InitGyro();
ElevSol = new DoubleSolenoid (2,3);
gyro->InitGyro();
Limit = new DigitalInput(2);
ElevatorPID = new PIDController(0.5, 0.0, 0.0, &ElevatorEnc, &Elevator);
	}
We get this error: no matching function for call to 'PIDController:IDController(double, double, double, Encoder**, Talon**, double)'
We're confused on how to get the function for the PID working. Thanks!
Reply With Quote