I am having issues accepting multiple doubles from an Xbox Controller. I wanted to test out tank drive with an Xbox Controller, however whenever it set it to accept left stick y and right stick y, it completely ignores any right stick inputs (sets it to left input).
I am using command based coding in java, I have both properly set as Supplier . If needed, I can send the code but right now my laptop is at the shop. It looks somewhat like this:
Just a shot in the dark since we don’t have complete code yet, but it could be because you haven’t defined the TYPE of the Supplier. You should make sure that you define the command’s Supplier (this.lyFunc/this.ryFunc) as a double Supplier. You can do this by either using a type identifier like this:
Supplier<double> lyFunc;
or use a DoubleSupplier object instead of a generic Supplier like this:
It looks like your code in your GitHub is a bit different than what you’ve shared here. One thing I did notice is that you’re using one SlewRateLimiter for all your axes. You should use one per double supplier. (Source)
Your value is also very high for it. I suspect that is also an issue. The example used 0.5 instead of 8.5.
You seem to have forgot to update ly,ry,rx based on the suplliers.
Something like ly=inLy.get() before ly = (Math.abs(ly) > 0.17) ? slew.calculate(ly) : 0.0; (for each value) should fixed that issue
I forgot to bring that back when updating the git but I don’t think thats the main issue. It isn’t that I am getting no inputs whatsoever, it’s that all my other inputs are being overridden by my Left Y (first input listed).
The git has now been edited to reflect my error. I’ll send results on Monday when I get into the shop. Thank you all so much for the help so far!
It might be worth asking sanity check to look at the Xbox controller’s values in the driver station. see the controller itself doesn’t have any misbehaviour.
I will make sure to check that! Now thinking about it, I am using a really sketch controller. However, I don’t think that is the main reason because I was able to make it work in a really scuffed way (having the two sides in different commands and subsystems). I had the right stick and left stick values as what they should be when I had it work that abominable way. I had them print out for the sake of seeing what they were.
After checking my old code for swerve I 100% agree with this. I don’t know how I didn’t catch this sooner but thank you so much! I’ll make sure to post results when I go to the shop this Monday
For anyone who has the same issue as me here’s how to fix it:
Make sure to have separate slew rate values per axis. Otherwise the slew calculates over all other values but the first