コード例 #1
0
	void TeleopPeriodic()
	{
		Drive->arcadeDrive(Drivestick->GetAxis((Joystick::AxisType)constants->Get("DriveAxisY")),
				Drivestick->GetAxis((Joystick::AxisType)constants->Get("DriveAxisX")),
				Drivestick->GetRawButton(constants->Get("HighShiftButton")),
				Drivestick->GetRawButton(constants->Get("LowShiftButton")));
		if(ShootIntake->shooter->shooterIndex->Get()==false){
			ShootIntake->RollerMotor->Set(Operatorstick->GetAxis((Joystick::AxisType)constants->Get("RollerMotorY")) * constants->Get("rollerMotorGain"), 0);
		}
		else{
			ShootIntake->RollerMotor->Set(0);
		}


		ShootIntake->Update(Operatorstick->GetRawButton(constants->Get("intakeButton")),
				Operatorstick->GetRawButton(constants->Get("armedButton")),
				Operatorstick->GetRawButton(constants->Get("shooterButton")), Operatorstick->GetRawButton(constants->Get("DownRollerButton")), Operatorstick->GetRawButton(constants->Get("UpRollerButton")), Operatorstick->GetAxis((Joystick::AxisType)constants->Get("RollerAControl")));

		//ShootIntake->Rollerarm->Set(Operatorstick->GetAxis((Joystick::AxisType)constants->Get("RollerAControl")));
		if(ShootIntake->Rollerarm->RollerControl->GetPinStateQuadIdx()==0){
				 	 	ShootIntake->Rollerarm->RollerControl->SetPosition(0);
				 	 	}



		char *Rollerencoder = new char[255];
		sprintf(Rollerencoder, "rollerEncoder: %lf\n", ShootIntake->Rollerarm->GetPosition());
		DriverStation::GetInstance().ReportError(Rollerencoder);

	}
コード例 #2
0
// Called repeatedly when this Command is scheduled to run
void DriveWithJoystick::Execute() {
	
	Joystick *leftStick = Robot::oi->getLeftStick();
	Joystick *rightStick = Robot::oi->getRightStick();
	
	float leftaxis = leftStick->GetAxis(Joystick::kYAxis);
	float rightaxis = rightStick->GetAxis(Joystick::kYAxis);
		
	if((leftaxis < DEADBAND) && (leftaxis > -DEADBAND))
		leftaxis = 0;
	
	if((rightaxis < DEADBAND) && (rightaxis > -DEADBAND))
		rightaxis = 0;
	
	
	// Code for the slow mode if either button "2" on the driver sticks is pressed.
	leftButton2 = Robot::oi->getLeftStick()->GetRawButton(2);
	rightButton2 = Robot::oi->getRightStick()->GetRawButton(2);
	
	if((leftButton2 == true) || (rightButton2 == true))
	{
		leftaxis *= SLOW_PERCENTAGE;
		rightaxis *= SLOW_PERCENTAGE;
	}
	
	
	
	
	Robot::driveTrain->tankDrive(leftaxis, rightaxis);
	
}
コード例 #3
0
ファイル: CJoystick.cpp プロジェクト: FRC980/FRC-Team-980
/**
 * For the current joystick, return the axis determined by the argument.
 *
 * This is for cases where the joystick axis is returned programatically, otherwise one of the
 * previous functions would be preferable (for example GetX()).
 *
 * @param port The USB port for this joystick.
 * @param axis The axis to read.
 * @return The value of the axis.
 */
float GetAxis(UINT32 port, AxisType axis)
{
    Joystick *stick = getJoystick(port);
    if (stick == NULL)
        return 0;
    return stick->GetAxis((Joystick::AxisType) axis);
}
コード例 #4
0
ファイル: MyRobot.cpp プロジェクト: FRC980/FRC-Team-980
	/**
	 * Run the closed loop position controller on the Jag.
	 */
	void OperatorControl()
	{
		printf("In OperatorControl\n");
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl() && !IsDisabled())
		{
			GetWatchdog().Feed();
			// Set the desired setpoint
			speedJag.Set(stick.GetAxis(axis) * 150.0);
			UpdateDashboardStatus();
			Wait(0.05);
		}
	}