Example #1
0
void BIOS::RumbleWhenRange(double target, double variance){
	if(abs(GetUltraAt(ULTRASONIC_FRONT_ANIPORT) - target) <= variance){
		CommandBase::pOI->GetDrive()->SetRumble(Joystick::RumbleType::kLeftRumble, 1.0f);
		CommandBase::pOI->GetMech()->SetRumble(Joystick::RumbleType::kLeftRumble, 1.0f);
	}else{
		CommandBase::pOI->GetDrive()->SetRumble(Joystick::RumbleType::kLeftRumble, 0.0f);
		CommandBase::pOI->GetMech()->SetRumble(Joystick::RumbleType::kLeftRumble, 0.0f);
	}
}
Example #2
0
////hypothesis
float Shooter::GetShootSpeed_R(){
	int degree = prefs->GetFloat("degree", 1);
	double displacement = GetUltraAt(ULTRASONIC_FRONT_ANIPORT);
	float output = 0;

	for(int i = 0; i < degree + 1; i++){
		std::ostringstream oss;
		oss << "theta_" << i;
		std::string prefsKey = oss.str();
		output = output + prefs->GetFloat(prefsKey, 0.0) * pow(displacement, i);
	}

	fRegressionSpeed = output;
	return output;
}