|
Why isn't my slowdown working?
Okay. I have this code to add joystick sensitivity(it seems to work):
void joystickSanatizer(float*x, float*y){
//Pointers All the Way!!! #starmaster
if(*x<0){
*x*=*x;
*x*=0-1;
}
else *x*=*x;
if(*y<0){
*y*=*y;
*y*=0-1;
}
else *y*=*y;
}
in TeleopPeriodic:
float joyx=stick->GetRawAxis(0);
float joyy=stick->GetRawAxis(1);
joystickSanatizer(&joyx, &joyy);
if(stick->GetRawButton(10)){
multiplier=0.4;
}
else multiplier=1;
and then, after some unrelated code:
rBot->ArcadeDrive(joyy*multiplier, joyx*multiplier);
Where stick is an XBox 360 controller and rBot is a a RobotDrive object
The point of this code is to slow down the robot... but it doesn't.
Can someone help me fix this code or give me another way to slow down the robot.
|