Hi,
seen that the ps3 controller is equipped with accelerometer and gyroscope
does anyone know if it is possible to know the angle of our ps3 controller via pygame libraries?
EDIT:
Searching on internet i've found ps3joy http://wiki.ros.org/ps3joy.
Can someone help me to implement it with pygame?
[HELP]Pygame and PS3 Controller
[HELP]Pygame and PS3 Controller
My Firmware: https://github.com/capriele/crazyflie-firmware
My Client: https://github.com/capriele/crazyflie-clients-python
My Client Move Edition: https://github.com/capriele/crazyflie-c ... ython-move

My Client: https://github.com/capriele/crazyflie-clients-python
My Client Move Edition: https://github.com/capriele/crazyflie-c ... ython-move

Re: [HELP]Pygame and PS3 Controller
Hi,
Interesting project, we have though about that for a while but never tested.
I ran some test in the virtual machine (Playstation gamepads are currently broken in Ubuntu but it works in the VM as long as it is not updated...) and with jstest-gtk (can be installed with sudo apt-get install jstest-gtk) it is possible to get the accelerometer reading. Axis 23 and 24.
Though by default the deadband is huge and the scaling is wrong. But jstest-gtk allows to run axis calibration that makes things right.
However Pygame does not seems to care about the calibrations and shows the same big deadband and small range (I put some debug print in cfclient to see the raw axis readings). So we get the axis but it returns unworkable values. So it fells like it wont work with Pygame but it may work with another driver.
I really want to get rid of pygame in cfclient: it is a big dependency that we use only for the joystick. At some point I did some work to implement a pure python Linux joystick driver and the plan was to have one for windows and mac as well while keeping pygame only as a backup solution. This work is in lib/cfclient/utils/joystick. Unfortunately I never got around to connect it to the rest of the program. But I just tested and this code actually uses the jstest calibration and reports workable value for the accelerometer axis.
If you want to test this new joystick code you can run this in the example/ folder:
Interesting project, we have though about that for a while but never tested.
I ran some test in the virtual machine (Playstation gamepads are currently broken in Ubuntu but it works in the VM as long as it is not updated...) and with jstest-gtk (can be installed with sudo apt-get install jstest-gtk) it is possible to get the accelerometer reading. Axis 23 and 24.
Though by default the deadband is huge and the scaling is wrong. But jstest-gtk allows to run axis calibration that makes things right.
However Pygame does not seems to care about the calibrations and shows the same big deadband and small range (I put some debug print in cfclient to see the raw axis readings). So we get the axis but it returns unworkable values. So it fells like it wont work with Pygame but it may work with another driver.
I really want to get rid of pygame in cfclient: it is a big dependency that we use only for the joystick. At some point I did some work to implement a pure python Linux joystick driver and the plan was to have one for windows and mac as well while keeping pygame only as a backup solution. This work is in lib/cfclient/utils/joystick. Unfortunately I never got around to connect it to the rest of the program. But I just tested and this code actually uses the jstest calibration and reports workable value for the accelerometer axis.
If you want to test this new joystick code you can run this in the example/ folder:
Code: Select all
import sys
sys.path.append("../lib")
from cfclient.utils.joystick import Joystick
js = Joystick()
js.open(2)
while True:
js.get_events()
print(js.axes)
Re: [HELP]Pygame and PS3 Controller
Thanks for the reply. I've tried jstest-gtk.
Is it possible to evaluate joystick's yaw with jstest-gtk?
Is it possible to evaluate joystick's yaw with jstest-gtk?
My Firmware: https://github.com/capriele/crazyflie-firmware
My Client: https://github.com/capriele/crazyflie-clients-python
My Client Move Edition: https://github.com/capriele/crazyflie-c ... ython-move

My Client: https://github.com/capriele/crazyflie-clients-python
My Client Move Edition: https://github.com/capriele/crazyflie-c ... ython-move

Re: [HELP]Pygame and PS3 Controller
I don't know, I have not been able to see the yaw gyro with jstest.