예제 #1
0
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
ArmPIDSubsystem::ArmPIDSubsystem() 
	: PIDSubsystem("ArmPIDSubsystem", Kp, Ki, Kd), 
	  upperArmLimitHit(false),
	  lowerArmLimitHit(false),
	  pidEnabled(false),
	  potOrigin(PotOriginDefault),
	  potOriginCheckComplete(false)
{
	Logger::GetInstance()->Log(ArmPIDSubsystemLogId, Logger::kINFO, "ArmPIDSubsystem::ctor() called.");
	
	SetAbsoluteTolerance(0.2);
	GetPIDController()->SetContinuous(false);
	LiveWindow::GetInstance()->AddActuator("Arm PID Subsystem", "PIDSubsystem Controller", GetPIDController());
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	potentiometer1 = RobotMap::armPIDSubsystemPotentiometer1;
	armSpeedController = RobotMap::armPIDSubsystemSpeedController1;
	upperArmLimit = RobotMap::armPIDSubsystemupperArmLimit;
	lowerArmLimit = RobotMap::armPIDSubsystemlowerArmLimit;
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	// Use these to get going:
	// SetSetpoint() -  Sets where the PID controller should move the system
	//                  to
	// Enable() - Enables the PID controller.
	Logger::GetInstance()->Log(ArmPIDSubsystemLogId, Logger::kINFO, "ArmPIDSubsystem::ctor() exiting.");
	SmartDashboard::PutBoolean(ReadyToFireField, false);
}
예제 #2
0
void HorizontalAlign::Initialize()
{
	printf("test");
	auto pid = GetPIDController();
	pid->SetAbsoluteTolerance(40);
	pid->SetSetpoint(SCREEN_CENTER_X); //Point we're trying to get to
	pid->Disable();
	pid->SetOutputRange(-(ROT_SPEED_CAP - ROT_SPEED_MIN), ROT_SPEED_CAP - ROT_SPEED_MIN);
}
예제 #3
0
Wrist::Wrist() : frc::PIDSubsystem("Wrist", kP_real, 0.0, 0.0) {
#ifdef SIMULATION  // Check for simulation and update PID values
  GetPIDController()->SetPID(kP_simulation, 0, 0, 0);
#endif
  SetAbsoluteTolerance(2.5);

  // Let's show everything on the LiveWindow
  AddChild("Motor", m_motor);
  AddChild("Pot", m_pot);
}
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
ShooterSubsystem::ShooterSubsystem() : PIDSubsystem("ShooterSubsystem", 1.0, 0.0, 0.0) {
	SetAbsoluteTolerance(0.2);
	GetPIDController()->SetContinuous(false);
	LiveWindow::GetInstance()->AddActuator("ShooterSubsystem", "PIDSubsystem Controller", GetPIDController());
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	shooterEncoder = RobotMap::shooterSubsystemShooterEncoder;
	shooterWheelJaguar = RobotMap::shooterSubsystemShooterWheelJaguar;
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	// Use these to get going:
	// SetSetpoint() -  Sets where the PID controller should move the system
	//                  to
	// Enable() - Enables the PID controller.
}
예제 #5
0
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
Catapult::Catapult() : PIDSubsystem("Catapult", -0.003, -0.001, -0.005) {
	SetAbsoluteTolerance(5.0);
	GetPIDController()->SetContinuous(false);
	LiveWindow::GetInstance()->AddActuator("Catapult", "PIDSubsystem Controller", GetPIDController());
	GetPIDController()->SetOutputRange(-1.0, 0.35);
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	encoder = RobotMap::catapultEncoder;
	jag2 = RobotMap::catapultJag2;
	jag3 = RobotMap::catapultJag3;
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	// Use these to get going:
	// SetSetpoint() -  Sets where the PID controller should move the system
	//                  to
	// Enable() - Enables the PID controller.
}
예제 #6
0
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
Arm::Arm() : PIDSubsystem("Arm", 1.0, 0.0, 0.0) {
    SetAbsoluteTolerance(0.2);
    GetPIDController()->SetContinuous(false);
    LiveWindow::GetInstance()->AddActuator("Arm", "PIDSubsystem Controller", GetPIDController());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID

    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    motor = RobotMap::armMotor;
    pot = RobotMap::armPot;
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS

    // Use these to get going:
    // SetSetpoint() -  Sets where the PID controller should move the system
    //                  to
    // Enable() - Enables the PID controller.
}
예제 #7
0
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
ShooterArm::ShooterArm() : PIDSubsystem("ShooterArm", 0.75, 0.16, 0.7) {
	SetAbsoluteTolerance(0.3);
	GetPIDController()->SetContinuous(false);
	LiveWindow::GetInstance()->AddActuator("ShooterArm", "PIDSubsystem Controller", GetPIDController());
	GetPIDController()->SetOutputRange(-1.0, 0.75);
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	shooterArmPot = RobotMap::shooterArmshooterArmPot;
	shooterArmMotor = RobotMap::shooterArmshooterArmMotor;
	fiveVoltMeasure = RobotMap::shooterArmFiveVoltMeasure;
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	GetPIDController()->SetInputRange(MIN_ANGLE, MAX_ANGLE);//Minimum voltage defines the max angle, max volage defines the min angle
	_targetAngle = 0.0;
    _onStage2 = false;
    _onStage3 = false;
    _targetPosition = CUSTOM;
	ResetPID();
}
SlavedLauncherPID::SlavedLauncherPID(std::string side, MotorPin motorPin, MotorPin motorPin2, DIOPin encoderPin) :
		PIDSubsystem(side + "SlavedLauncherPID", 4.5, 0.167, .0),
		pidMotor(motorPin),
		pidMotor2(motorPin2),

		pidEncoder(encoderPin),
		reverseMultiplier(1)
{
	LiveWindow::GetInstance()->AddActuator(side + "LauncherPID2", side + "PIDController", GetPIDController());
	LiveWindow::GetInstance()->AddActuator(side + "LauncherPID2", side + "OutputMotor", pidMotor);
	LiveWindow::GetInstance()->AddActuator(side + "LauncherPID2", side + "OutputMotor2", pidMotor2);
	LiveWindow::GetInstance()->AddSensor(side + "LauncherPID2", side + "Encoder", pidEncoder);
//	SmartDashboard::PutData(side+"LauncherPidController", GetPIDController().get());
	GetPIDController()->SetOutputRange(0,1);
	SetAbsoluteTolerance(.05);
	SetPIDSourceType(PIDSourceType::kDisplacement);
	pidEncoder.SetSamplesToAverage(1);
	// Use these to get going:
	// SetSetpoint() -  Sets where the PID controller should move the system
	//                  to
	// Enable() - Enables the PID controller.
}
예제 #9
0
void OpenSMOKE_ICEM::DefineFromFile(const std::string inputFile)
{
    double			double_value;
    std::string			string_value;
    int				int_value;
	vector<string>  string_vector;

    OpenSMOKE_Dictionary_ICEM dictionary;
    dictionary.ParseFile(inputFile);


    // COMPULSORY: Rotation Rate
	if (dictionary.Return("#RotationRate", double_value, string_value))
		AssignRotationRate(string_value, double_value);

    // COMPULSORY: Compression Ratio
	if (dictionary.Return("#CompressionRatio", double_value))
		AssignCompressionRatio(double_value);

    // COMPULSORY: Reactor Clearance Volume
    if (dictionary.Return("#ClearanceVolume", double_value, string_value))
        AssignClearanceVolume(string_value, double_value);

    // COMPULSORY: Arm Ratio
    if (dictionary.Return("#ArmRatio", double_value))
        AssignArmRatio(double_value);

    // COMPULSORY: Start angle
    if (dictionary.Return("#StartAngle", double_value, string_value))
        AssignStartAngle(string_value, double_value);
	
	// COMPULSORY: Start angle
    if (dictionary.Return("#Diameter", double_value, string_value))
        AssignDiameter(string_value, double_value);

	// OPTIONAL: Number of cycles
    if (dictionary.Return("#NumberOfCycles", double_value))
        SetNumberOfCycles(double_value);



	// OPTIONAL: KeySpecies
    if (dictionary.Return("#Key", string_vector))
        SetKeySpecies(string_vector);

    // OPTIONAL: Output folder
    if (dictionary.Return("#Output", string_value))
        SetOutputFolder(string_value);

    // OPTIONAL: Print Options
    if (dictionary.Return("#Nvideo", int_value))
        SetVideoOptions(int_value);

    // OPTIONAL: Print Options
    if (dictionary.Return("#Nfile", int_value))
        SetFileOptions(int_value);

    // OPTIONAL: Print Options
    if (dictionary.Return("#NoVerbose"))
        UnsetVerbose();

	// OPTIONAL: Verbose Energy
    if (dictionary.Return("#VerboseEnergy"))
        SetVerboseEnergy();

    // OPTIONAL: Global kinetics
    if (dictionary.Return("#GlobalKinetics"))
        SetGlobalKinetics();

    // OPTIONAL: Relative tolerance
    if (dictionary.Return("#RelTol", double_value))
        SetRelativeTolerance(double_value);

    // OPTIONAL: Absolute tolerance
    if (dictionary.Return("#AbsTol", double_value))
        SetAbsoluteTolerance(double_value);

	// OPTIONAL: Adiabatic
    if (dictionary.Return("#Adiabatic"))
        SetAdiabatic();


	// OPTIONAL: Heat flux
    if (dictionary.Return("#Qe", double_value, string_value))
        SetConstantHeatFlux(double_value, string_value);

	// OPTIONAL: Exchange area
    if (dictionary.Return("#A", double_value, string_value))
        SetConstantExchangeArea(double_value, string_value);

	// OPTIONAL: Exchange coefficient
    if (dictionary.Return("#U", double_value, string_value))
        SetConstantHeatExchangeCoefficient(double_value, string_value);

	// OPTIONAL: Ambient temperature
    if (dictionary.Return("#Twall", double_value, string_value))
        SetConstantAmbientTemperature(double_value, string_value);


	// OPTIONAL: UserDefined_Qe
    if (dictionary.Return("#UserDefined_Qe", string_value))
        SetUserDefinedHeatFlux(string_value);

	// OPTIONAL: UserDefined_Ae
    if (dictionary.Return("#UserDefined_A", string_value))
        SetUserDefinedExchangeArea(string_value);

	// OPTIONAL: UserDefined_U
    if (dictionary.Return("#UserDefined_U", string_value))
        SetUserDefinedHeatExchangeCoefficient(string_value);

	// OPTIONAL: UserDefined_Twall
    if (dictionary.Return("#UserDefined_Twall", string_value))
        SetUserDefinedAmbientTemperature(string_value);
 

	// OPTIONAL: TwoEquationModel
    if (dictionary.Return("#2E_Model"))
        SetTwoEquationModel();

	// OPTIONAL: Reaction Rates
    if (dictionary.Return("#ReactionRates", string_vector))
		SetReactionRatesOnFile(string_vector);

	// OPTIONAL: Formation Rates
    if (dictionary.Return("#FormationRates", string_vector))
		SetFormationRatesOnFile(string_vector);

	// OPTIONAL: Rate of Production Analysis
    if (dictionary.Return("#ROPA"))
		SetROPAOnFile();

	// OPTIONAL: Sensitivity Analysis
    if (dictionary.Return("#Sensitivity", string_vector))
		SetSensitivityOnFile(string_vector);

	Lock();
}