View Single Post
  #2   Spotlight this post!  
Unread 03-12-2015, 04:12 PM
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 429
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Why isn't my slowdown working?

Have you added debug print statements for you code to see if your inputs and outputs make sense?
THat might help you get a quick sanity check of where your code is going wrong.


Is there's a reason you don't want to do something a little simpler?

Code:
float joyx = stick->GetRawAxis(0);
float joyy = stick->GetRawAxis(1);
 
if(stick->GetRawButton(10)){
  multiplier = 0.4;
} else {
  multiplier = 1;
}
rBot->ArcadeDrive(joyy * multiplier, joyx * multiplier);
Just change your multiplier variable to affect commanded rate of travel.

It doesn't give you X^2 scaling, but not sure you need that.


Keeping the x^2 implementation:
Code:
float joyx = stick->GetRawAxis(0);
float joyy = stick->GetRawAxis(1);

//#nostarmaster
joyx = joyx * abs(joyx); 
joyy = joyy * abs(joyy);

if(stick->GetRawButton(10)){
  multiplier = 0.4;
} else {
  multiplier = 1;
}
rBot->ArcadeDrive(joyy * multiplier, joyx * multiplier);
I think this one does exactly what you were trying to do in your code.
__________________
http://team2168.org

Last edited by otherguy : 03-12-2015 at 05:22 PM. Reason: added another option closer to original implementation
Reply With Quote