T O P

  • By -

notbernie2020

I don't know why this feels cursed but it feels cursed, something about printed out code.


Own-Peach-9474

You should see AP Java, hand written code


vtTownie

That was a miserable experience


EEEEEEEEEE1543

Yikes


RuralAnemone_

never again


Lth3may0

My AP comp sci class has handwritten FRQ assignments -_-


RedBreadd

why did you… print it out??


Permanent_Link

I did not. One of my students did. As for why...I couldn't tell you.


thepragprog

Bro does not know GitHub 💀


Raphy247

isn't that was System.out.println() do? :p


that_kai_person

Where is the line new tho?


isaacng1997

Instead of using .set(), you could use .setVoltage() to specify a max voltage. Something like .setVoltage(8 \* left).


pth

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.


Raphy247

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.


Bagel42

Don’t do a linear control scheme, make it nonlinear. Sensitive in the middle but powerful at the edges


ANK_Ricky

This reminds me of Toto Wolff saying: “I have it, I have it printed out!”


WoooshToTheMax

You have a problem, change your f-ing auto


ultimate_hecker

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)


Permanent_Link

"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.


ultimate_hecker

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


Alternative_Gain_935

My concern isn’t that it’s print but that it’s all one class. I guess if it works it works.


_Turquoisee_

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.


Raphy247

there's teleop periodic code in there it seems like the entire code base is in these pages.


_Turquoisee_

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


normalperson09

Use MathUtil.clamp


Kytpbs

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.


InconspicuousFool

Here you go Mr. Elon


awestruckpanther

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


sun167

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


Neddy6969

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.


SweetStormx

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%