Java Programming Help

Hello, everyone.

I need help with making a tank drive controlled with a xbox controller. I need it for java programming.

if anyone wants to help that would be helpful. also examples would be appreciated. if you can send me your entire code would also be nice.

thanks

wpilib.screenstepslive.com is a fantastic resource with plenty of examples and guides on how to accomplish exactly this. If you have further questions feel free to ask! Good luck!

We have a very simple implementation of this available on our github site: https://github.com/frc5687/2017-simplebot

This was written last year so it targets the steamworks game…but it’s really very generic.

I definitely recommend checking out http://wpilib.screenstepslive.com/s/currentCS/m/java/l/145307-creating-your-benchtop-test-program. For an xbox controller, you will want to create a joystick object, motor controllers for the drive train, and a DifferentialDrive object. In teleopPeriodic(), you should create two double variables, one for each axis of the controller you want to use. Make the double equal to joystick.getRawAxis(axis), where the axis is the number of the axis you want to use. Then, add drivetrain.tankDrive(leftSpeed, rightSpeed). Let me know if you need any help!

OP, any luck yet? Any specific issues we can help with?

You can check out our public github that has 2017 Steamworks code. That code base has lots of different functionality to it, you really only need to focus on the DriveTrain subsystem.

Also, there are other built-in WPI classes that will help, the DifferentialDrive being one of them.

Reach out for more help if you need, our team will be happy to help.

The Eclipse plugins come with a number of sample programs that you can select when making a new project. They’re also viewable on GitHub: https://github.com/wpilibsuite/allwpilib/tree/master/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples

I directed at least one rookie team to this one, and it worked pretty well for them.