steamcontroller icon indicating copy to clipboard operation
steamcontroller copied to clipboard

Trying to publish buttons as joystick and gyro data at the same time

Open awesomebytes opened this issue 10 years ago • 3 comments

Hello, I'm trying to use your library as sc-xbox.py does but at the same time I would like to publish the gyro data (this is for making a ROS node to publish all this).

I also would like to set the left pad to publish as all the range of values between 1.0 and -1.0 not only 1.0, 0.0, -1.0.

And finally give some haptic feedback on both pads.

For now I've been able to do a dump.py version that dumps also the gyro data. But I think writting a node that writes all the joystick buttons and the gyro data from scratch sounds like an overkill considering how close to be what I need is the code I found.

If I could setup two callbacks for the input data to process the gyro data separately I would have everything but configuring the left pad to be like the right pad in xbox mode.

I've tried to make a Gamepad Uinput class which has different Axis ranges (I think those are the ranges, the numbers defined in the axes= field) but I couldn't make it work.

Copy pasting the full process method and give some modifications just to handle the gyro also sounds like an overkill.

I would be very grateful for some feedback. Sorry if the issue is a bit chaotic, I've been writting it as I tried stuff.

awesomebytes avatar Jan 25 '16 23:01 awesomebytes

Oh, and I checked that the quaternion data is actually a quaternion and given in the form (w, x, y, z).

Checked it with this little code: https://gist.github.com/awesomebytes/d9dad21ba07eed27adb8

Video of it working: https://youtu.be/vIwJa4dtiyo

I hope I can help a little bit with this info.

awesomebytes avatar Jan 26 '16 00:01 awesomebytes

Thanks for the info, I'll try to add gyro data into the event mapper, but I still have to add a good strategy to permits the different possible use case.

The use case I have encountered for the moment are :

  • Gyro as axis stand alone or in complement of another input.
  • Gyro as mouse stand alone or in complement of another input.

Many mapping I saw use a pad for fast move and gyro for precise move.

On Tue, Jan 26, 2016 at 1:18 AM, Sammy Pfeiffer [email protected] wrote:

Oh, and I checked that the quaternion data is actually a quaternion and given in the form (w, x, y, z).

Checked it with this little code: https://gist.github.com/awesomebytes/d9dad21ba07eed27adb8

Video of it working: https://youtu.be/vIwJa4dtiyo

I hope I can help a little bit with this info.

— Reply to this email directly or view it on GitHub https://github.com/ynsta/steamcontroller/issues/21#issuecomment-174741356 .

ynsta avatar Jan 26 '16 10:01 ynsta

Function I want to implement soon:

  • Enable gyro condition (always on, or on specific button event)
  • Use gyro as mouse (add yaw, pitch, roll accell to mouse event with a scale factor).
  • Use gyro as an axis (compute yawn, pitch or roll from quaternion, normalize to -32768 32768 and use it as an axe)

ynsta avatar Dec 02 '16 13:12 ynsta