PS4 Dual Shock Motion Control

GPC2 script programming for Titan Two. Code examples, questions, requests.

PS4 Dual Shock Motion Control

Postby DeviateSquirrel » Mon Jan 18, 2021 1:26 am

I haven’t purchased the T2 yet but it’s in my budget. Until then I’m thinking through so ideas.

I play Elite Dangerous and found SirBass’s post on getting the VKB NXTs to to work on the PS4 through the T2 and it got me wondering if it was possible to use something like TrackIR to control head look. The Dual Shock controller can be used to look around by tilting it and I see accel and gyro are used in the PS4 file so it would seem theoretically possible... or am I barking up the wrong tree?

My dream would be to use the Tobii 5 eye tracker so I wouldn’t have to wear the TrackIR but any port in a storm!
User avatar
DeviateSquirrel
First Sergeant
First Sergeant
 
Posts: 46
Joined: Sun Jan 17, 2021 11:07 pm

Re: PS4 Dual Shock Motion Control

Postby SirBrass » Tue Jan 19, 2021 3:10 am

It's theoretically possible but I'm having trouble implementing it with an analog mini stick. But I do get it to respond, just not how I want. So, it's DOABLE. But I haven't figured out the math.
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Re: PS4 Dual Shock Motion Control

Postby DeviateSquirrel » Tue Jan 19, 2021 3:32 am

Is it about degree of movement then? You get some but not enough?
User avatar
DeviateSquirrel
First Sergeant
First Sergeant
 
Posts: 46
Joined: Sun Jan 17, 2021 11:07 pm

Re: PS4 Dual Shock Motion Control

Postby SirBrass » Tue Jan 19, 2021 12:47 pm

If only. I also get undesired movement.

The movement is a function of 3 to 6 inputs: accelerometer x, y,& z, & gyro x, y, &z.

It SEEMS the accelerometers each have an input range of -25 to 25 and the value is based on the orientation of the controller. That's the EASY part. The gyro input only seems to have a range of 0 to 10 and only changes from 0 when movement is induced.


Conceptually that means the logic should be straightforward, but it isn't. At least not in elite dangerous for headlook. And I'm tired of experimenting.
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Re: PS4 Dual Shock Motion Control

Postby DeviateSquirrel » Tue Jan 19, 2021 7:37 pm

SirBrass wrote:Conceptually that means the logic should be straightforward, but it isn't. At least not in elite dangerous for headlook. And I'm tired of experimenting.


Copy that.

I'd considered making a hat for the DS4 controller to rest in an attempt to get a head look that was always on while I used the HOTAS 4 as my controller... but then I figured my wife would die laughing at the sight. :innocent_smile_1: Plus, I don't think it would work well in any case. The movements to get the controller to look around are pretty large compared and I'd have to really exaggerate my head movements.

I'll put it on my someday maybe list. Thanks for looking into it!
User avatar
DeviateSquirrel
First Sergeant
First Sergeant
 
Posts: 46
Joined: Sun Jan 17, 2021 11:07 pm

Re: PS4 Dual Shock Motion Control

Postby SirBrass » Tue Jan 19, 2021 9:20 pm

DeviateSquirrel wrote:
SirBrass wrote:Conceptually that means the logic should be straightforward, but it isn't. At least not in elite dangerous for headlook. And I'm tired of experimenting.


Copy that.

I'd considered making a hat for the DS4 controller to rest in an attempt to get a head look that was always on while I used the HOTAS 4 as my controller... but then I figured my wife would die laughing at the sight. :innocent_smile_1: Plus, I don't think it would work well in any case. The movements to get the controller to look around are pretty large compared and I'd have to really exaggerate my head movements.

I'll put it on my someday maybe list. Thanks for looking into it!


Doesn't work, as Elite only allows one controller to be active at a time on the PS4. If you're using the HOTAS, it won't respond to any input from the DS4.
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Re: PS4 Dual Shock Motion Control

Postby SirBrass » Wed Jan 20, 2021 11:29 pm

DeviateSquirrel wrote:
SirBrass wrote:Conceptually that means the logic should be straightforward, but it isn't. At least not in elite dangerous for headlook. And I'm tired of experimenting.


Copy that.

I'd considered making a hat for the DS4 controller to rest in an attempt to get a head look that was always on while I used the HOTAS 4 as my controller... but then I figured my wife would die laughing at the sight. :innocent_smile_1: Plus, I don't think it would work well in any case. The movements to get the controller to look around are pretty large compared and I'd have to really exaggerate my head movements.

I'll put it on my someday maybe list. Thanks for looking into it!


Don't get me wrong, it's doable, but I'm tired of figuring out the formula. I'll publish my latest code and you can see at the beginning of main what my math is. As the analogue sticks is at rest with buttons 5 & 8 at values of 50.5 and go from 0 to 100, I have to adjust both the scale of movement AND the the zero point. That's what the formula accomplish, but the game still acts strangely. What I need is straight forward code that advances gyro from value of 0 to that of 10 (binary on/off) when the stick is in motion, and 0 when it is at rest, while at the same time ALWAYS reporting where the accelerometer is at all times, all based on the value of each axis input from the analogue stick, and respecting the different scales of movement. And THEN seeing if the bloody thing works.

The difficulty is in modeling gyro/accel behavior. When plugged in through the T2, the PS4 turns off gyro input to the controller (a feature of wired mode I guess), so I can't just have the controller plugged in and play Elite while having it plugged into the PC at the same time to watch gyro and accel inputs while I manipulate head movement.

If you'd like to do that and give me values for what gyro and accel do when head movement inputs are repeated when it's plugged into the T2, I'd be happy to try and implement the code. I could REALLY use headlook on analogue stick capability.
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Re: PS4 Dual Shock Motion Control

Postby DeviateSquirrel » Thu Jan 21, 2021 4:38 pm

I wonder if the Bluetooth adapter for the T2 would allow the motion from the controller to go through the T2.

It makes sense that the gyros only output when in motion as they’re ultimately measuring angle and at rest there’s nothing to measure. I would expect something besides an on/off output though. With 3 axis an on/off would only allow for a few angles I think (the primary axes and 45s off those axes though I don’t see how you’d get negative values).

I’ve been doing a little research on head tracking software and found a now defunct company called EDTracker. Even though the company went under you can still get the hardware and I believe the software is on Git. Near as I can tell it reads as a standard HID so I’m thinking it’ll show up in GTuner. I’ll let you know how it turns out.
User avatar
DeviateSquirrel
First Sergeant
First Sergeant
 
Posts: 46
Joined: Sun Jan 17, 2021 11:07 pm

Re: PS4 Dual Shock Motion Control

Postby DeviateSquirrel » Tue Jan 26, 2021 8:50 pm

SirBrass wrote:I'll publish my latest code and you can see at the beginning of main what my math is.


Can you push that out for me? I have the T2 and should be getting the EDTracker soon.
User avatar
DeviateSquirrel
First Sergeant
First Sergeant
 
Posts: 46
Joined: Sun Jan 17, 2021 11:07 pm

Re: PS4 Dual Shock Motion Control

Postby SirBrass » Wed Feb 17, 2021 3:05 pm

DeviateSquirrel wrote:
SirBrass wrote:I'll publish my latest code and you can see at the beginning of main what my math is.


Can you push that out for me? I have the T2 and should be getting the EDTracker soon.


Should be in the online resources already.
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 125 guests