![]() |
Example Robot Java Project
So my rookie team has the basic drivetrain made and they want to test it out with the Logitech Extreme 3-D Pro Joystick.
We are running behind on our schedule and we need to test out the drivetrain immediately. We have the Driver Station and Eclipse installed on the Acer Aspire E-11 that came with our kit this year, and we have all the necessary software loaded onto the RoboRIO. Which example Robot Java Project (From WPILIB) will us to immediately load it on the RoboRIO and get the drivetrain functioning? |
Re: Example Robot Java Project
I wouldn't suggest using an example. If you want something really simple and fast just make a new Robot Project. Then go to The Robot Class. create a joystick object "Joystick joy1 =new Joystick (0);" then create a motor object for each motor controller/Cim (My team personally uses talon motor controllers)"Talon Motor1 = new Talon(PWM PORT);" then go to your teleopperiodic and pull the X and Y value of the joystick, set it to a double . Then use double to set the speed of the motors.
|
Re: Example Robot Java Project
In case you need more information, after creating a new Talon (or Jaguar), in the teleOp section, do
double speed = getRawAxis(ID_NUMBER); //ID_NUMBER is # of axis on joystick motor1.set(speed); |
Re: Example Robot Java Project
The only problem I have is that Eclipse states that "The method getRawAxis(int) is undefined for Robot.java
Any hints here? |
Re: Example Robot Java Project
It should be like this:
double speed = joystick.getX(); This sets your double to the values being returned by your joystick. Then use that double to power your motor. |
Re: Example Robot Java Project
I forgot to mention some important information.
We are now trying to use the Xbox 360 Controller to use both analog sticks. But we don't know how to set one analog stick to the left side, and the other analog stick to the right side. Any hints? Code is listed below Code:
|
Re: Example Robot Java Project
First you'll need to make sure you know which axis goes to which joystick. Don't connect up your robot motors (you might not even need to enable it, I can't remember) and in the driverstation there will be one tab on the left side you can click that will show you a bunch of buttons and sliders that correlate to user input from the joystick. This will tell you what # you need for the getRawAxis(#) function.
You can use either the Getting Started project or the Tank Drive one. Getting started uses Arcade drive, Tank drive uses...Tank. Either way you'll need to make sure to have a couple of things mapped correctly in the code: Which joystick axis do you need to use (using the above method) Which motors need to get powered - this is determined by where your PWM cables are plugged into the rio. If you have 2 CIMs per side - I highly recommend disconnecting one from power and ensuring they both treat forward as the same direction independently. It's a good way to burnout motors or mess up gears if they're fighting each other and you keep trying to make it move. Probably common sense - but since it's a rookie year I want to say this just in case: I also highly recommend putting the robot up on blocks and everything is free and clear of belts/chain/wheels until you feel comfortable it's not going to go anywhere unexpectedly. |
| All times are GMT -5. The time now is 03:37. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi