|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
How to use Xbox controller with RobotPy?
Hi! So we have our code working with the Xbox controller's left joystick but that was just using the
Code:
self.stick=wpilib.Joystick(0) |
|
#2
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Recommend you search the forums, as your problem is a WPILib problem, and not necessarily specific to RobotPy.
Here's one that looks useful: http://www.chiefdelphi.com/forums/sh...highlight=xbox |
|
#3
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Quote:
|
|
#4
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Quote:
Code:
joystick = wpilib.Joystick(0) rightX = joystick.getAxis(4) rightY = joystick.getAxis(5) |
|
#5
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
From the looks of it, your code is only written for one axis, axis 0. That is most likely the reason why only the left side is working. Go to the driver station with your controller plugged in and then to the USB panel. There you will find the connected joystick and all the buttons. Any button you press or joystick you move will show you the associated button value that you should implement into the code. remember that these are all array values, so you start with axis 0 and button 0.
|
|
#6
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Quote:
|
|
#7
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Quote:
|
|
#8
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
I would see what code people are using in other languages, and translate it to python. It's definitely a WPILib related issue, so presumably someone else has had the problem too and fixed it.
I don't have an XBox, so I can't test it personally. |
|
#9
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Just a quick side question, how can you use one motor and one axis for aracadeDrive? I tried just using the ".set()" but that didn't work. Thanks again for all your help!
|
|
#10
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Quote:
Code:
joystick = wpilib.Joystick(0) motor = wpilib.Talon(2) motor.set(joystick.getX()) |
|
#11
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
Do the motor.set and things like that have to be in the Teleop function to work properly? Thanks!
|
|
#12
|
||||
|
||||
|
Re: How to use Xbox controller with RobotPy?
The roboRIO will disable motors when the robot is not enabled, so I would not recommend setting the motors outside of teleop/autonomous modes.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|