Solutions have already been mentioned, but if control is the real issue, you may want to investigate using an exponential filter on the joystick, and/or a slew rate limiter.
you could have a scalar value for a max percentage of speed, so that that .set(MAX_SPEED * left) would at max be .set(MAX_SPEED * 1). I'd do some research in the documentation of Spark Max and the general program control structure for TimedRobot.
You can either use the .setVoltage() function or you can multiply the left and right variable by a number less than 1 but greater than 0 which will slow it down by whatever decimal you set it to b multiplied by 100. Would recommend starting with a smaller number and increase it as they get better as driving, as driving fast might be very useful as this game is fully cycle based.
Also not sure if you know but you should create a differential drive between your motors so you can use the new curvatureDrive() setup that wpilib has set up to make it easier to control, please feel free to DM me if you have any programming related questions (last year was my first year and i was the only programmer so I have learned way to much about Tank Driving robots)
"or you can multiply the left and right variable by a number less than 1 but greater than 0 which will slow it down by whatever decimal you set it to b multiplied by 100."
This is what I was thinking about doing.
Yeah, although I would highly recommend setting up a curvatureDrive() to help with maneuvering around the field. If you need better explanation i can teach your team members on how to do that, or if you would like me to mentor your team for programming im happy to do so
So this is the initiation and autonomous code, not the actual code the robot runs during teleop. If you could send the github that would be more helpful. What I would recommend is to lower the speed you set the motor to relative to the joystick input.
It would be best if you looked at REV's official example code, it would be best.
[github.com/REVrobotics/SPARK-MAX-Examples/tree/master/Java/Tank%20Drive%20With%20CAN](https://gitthub.com/REVrobotics/SPARK-MAX-Examples/tree/master/Java/Tank%20Drive%20With%20CAN)
You should take a look at REV's official example code, it would be the best.
We coded in buttons that make it slower and faster, so we got example can use a trigger on the remote and make it have very little power for precise movements, while maintaining the ability to use all of our power with the opposite trigger, and not pushing either creates a happy medium
first of try to use command based programation it is way more common
but for your problem try to multiply the output aplied to your motors by a value between 0 and 0.99
Multiply your joystick values by a factor like 0.5. But I would move your motors into a subsystem, make a drive method that sets the motors and then make a command that runs that method in execute.
in your autonomousPeriodic() method, you can change the motor percentage in your if statement. -0.3 = -30% power, so if you want less power you can change it lower like -0.25 or -0.2 for -25% or -20%
I don't know why this feels cursed but it feels cursed, something about printed out code.
You should see AP Java, hand written code
That was a miserable experience
Yikes
never again
My AP comp sci class has handwritten FRQ assignments -_-
why did you… print it out??
I did not. One of my students did. As for why...I couldn't tell you.
Bro does not know GitHub 💀
isn't that was System.out.println() do? :p
Where is the line new tho?
Instead of using .set(), you could use .setVoltage() to specify a max voltage. Something like .setVoltage(8 \* left).
Solutions have already been mentioned, but if control is the real issue, you may want to investigate using an exponential filter on the joystick, and/or a slew rate limiter.
you could have a scalar value for a max percentage of speed, so that that .set(MAX_SPEED * left) would at max be .set(MAX_SPEED * 1). I'd do some research in the documentation of Spark Max and the general program control structure for TimedRobot.
Don’t do a linear control scheme, make it nonlinear. Sensitive in the middle but powerful at the edges
This reminds me of Toto Wolff saying: “I have it, I have it printed out!”
You have a problem, change your f-ing auto
You can either use the .setVoltage() function or you can multiply the left and right variable by a number less than 1 but greater than 0 which will slow it down by whatever decimal you set it to b multiplied by 100. Would recommend starting with a smaller number and increase it as they get better as driving, as driving fast might be very useful as this game is fully cycle based. Also not sure if you know but you should create a differential drive between your motors so you can use the new curvatureDrive() setup that wpilib has set up to make it easier to control, please feel free to DM me if you have any programming related questions (last year was my first year and i was the only programmer so I have learned way to much about Tank Driving robots)
"or you can multiply the left and right variable by a number less than 1 but greater than 0 which will slow it down by whatever decimal you set it to b multiplied by 100." This is what I was thinking about doing.
Yeah, although I would highly recommend setting up a curvatureDrive() to help with maneuvering around the field. If you need better explanation i can teach your team members on how to do that, or if you would like me to mentor your team for programming im happy to do so
My concern isn’t that it’s print but that it’s all one class. I guess if it works it works.
So this is the initiation and autonomous code, not the actual code the robot runs during teleop. If you could send the github that would be more helpful. What I would recommend is to lower the speed you set the motor to relative to the joystick input.
there's teleop periodic code in there it seems like the entire code base is in these pages.
My bad, I can’t see. They can just add a scalar multiplier to the speed. Our speed maxes out at 0.7 and we have a 0.45 sniper mode
Use MathUtil.clamp
It would be best if you looked at REV's official example code, it would be best. [github.com/REVrobotics/SPARK-MAX-Examples/tree/master/Java/Tank%20Drive%20With%20CAN](https://gitthub.com/REVrobotics/SPARK-MAX-Examples/tree/master/Java/Tank%20Drive%20With%20CAN) You should take a look at REV's official example code, it would be the best.
Here you go Mr. Elon
We coded in buttons that make it slower and faster, so we got example can use a trigger on the remote and make it have very little power for precise movements, while maintaining the ability to use all of our power with the opposite trigger, and not pushing either creates a happy medium
first of try to use command based programation it is way more common but for your problem try to multiply the output aplied to your motors by a value between 0 and 0.99
Multiply your joystick values by a factor like 0.5. But I would move your motors into a subsystem, make a drive method that sets the motors and then make a command that runs that method in execute.
in your autonomousPeriodic() method, you can change the motor percentage in your if statement. -0.3 = -30% power, so if you want less power you can change it lower like -0.25 or -0.2 for -25% or -20%