Go to Post You know, one year we need to stake out the AndyMark building for several weeks before Kickoff so we can see what the game pieces will be. Hidden webcam? :rolleyes: - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 12-03-2015, 16:12
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 : 12-03-2015 at 17:22. Reason: added another option closer to original implementation
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi