So I have got my program installed on the roborio and the driver station picks it up. But the robot doesn’t move when I move the joysticks on our controller. The driver station didn’t print any errors so I am quite lost on what to do.
Here is the code in using if this is the problem:
Victor victor1 = new Victor(0);
Victor victor2 = new Victor(1);
Joystick joysticc=new Joystick(0);
victor1.set(0.5joysticc.getRawAxis(5));
victor2.set(-0.5joysticc.getRawAxis(1));
if (joysticc.getRawButton(0)) {
victor1.set(1joysticc.getRawAxis(5));
victor2.set(-1joysticc.getRawAxis(1));
your not initializing the joystick properly make sure you have the proper axis count button count and usb count example
Joystick *gamePad =new Joystick(0,6,9);// this is for a xbox 360
also make sure you installed the xbox 3601 drivers onto the computer
for further clarification Joystick(0,6,9) 0=usb port on computer 6=axis count of controller and 9= button count of controller. Also make sure that you check the things mentioned in the previous posts
I am just trying to do it over an ether net connection and the main light blinks and the leds on the roborio are green on power and status but is blinking orange on the rsl one I think. I am not by the bot now so i wont know for sure till tomorrow
for the command victor.set() set should be capitalized eg victor.Set() also check to make sure your controllers’ lights are solid when you enable teleop.
gamePad is just a generic name you could call it Bob_Marly_The_Grand_Overlord or with your own name. As for the second question I’m not entirely sure I could be wrong but that would be the C++ constructor at least. Are you sure your including WPILib?
For the The constructor Joystick(int, int, int) is not visible, what do you mean by am I including wpilib? sorry this my first year programming and i’m the only one.
I’m guessing your probably doing it right. I would redowload the Xbox drivers we had that problem a while ago and it was the drivers. If you’d like you could pm me or post your actual code, the whole file, for me to bug check tomorrow.
Your program looks fine. You should first make sure that your motor controllers are hooked up and working. You could do this by commenting out your joystick setting of the motor controllers and just put in a literal “set” value:
victor1.set(.3);
victor2.set(.3);
If that makes the motors run, then you can move on to the joysticks. The first thing I’d check there is to see if they are showing up in the Drivers Station. Click on the USB icon way on the left of the drivers station and see what is showing there. If they are showing, try moving the controls, you should see activity on that screen. I believe it also shows which button you’re pressing and which axis is active (although I don’t have it in front of me). If you’re not seeing any Joysticks here, it’s probably a Windows driver issue.
If you do see them, and they still don’t move the robot, try operating all the different controls on the Joystick and see if any of them cause motion. You may be referencing the wrong axis number.