It is currently Sat Feb 23, 2019 7:13 am



Reply to topic  [ 9 posts ] 
 Fix for small mouse movements 
Author Message
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
I think this is the number one feature that needs to be fixed for next release so I created a new thread for it.

See this branch

https://github.com/AndersMalmgren/FreeP ... ePlugin.cs

Problem is that Baggyg's code drift for some plugins while the old solution did not

_________________
FreePIE
My blog


Fri Jul 12, 2013 5:49 am
Profile
Vireio Perception Developer
Vireio Perception Developer
User avatar

Joined: Sat May 19, 2012 5:20 am
Posts: 491
Location: BB, Slovakia
Reply with quote
Code:
// Reset the mouse values
                if ((int) DeltaXOut != 0)
                {
                    DeltaXOut = DeltaXOut - (int) DeltaXOut;
                }
                if ((int) DeltaYOut != 0)
                {
                    DeltaYOut = DeltaYOut - (int) DeltaYOut;
                }

You can remove the conditionals here since no movement would equate to a 0 movement anyway.
Code:
// Reset the mouse values
DeltaXOut = DeltaXOut - (int) DeltaXOut;
DeltaYOut = DeltaYOut - (int) DeltaYOut;

I.e. without the conditional. However we then need to somehow identify when the sensor is drifting of its own accord (its important here to realise this is not a problem with our code, but with the sensor data itself) and negate these readings.

I have a couple of ideas how to achieve this so will download your latest branch and try although probably wont be until sometime next week.


Fri Jul 12, 2013 8:24 am
Profile
Cross Eyed!
User avatar

Joined: Thu May 16, 2013 1:02 am
Posts: 108
Reply with quote
so, with this new mouse plugin the small sensors movements are better recognised for mouse purposes?


Fri Jul 12, 2013 10:00 am
Profile
Vireio Perception Developer
Vireio Perception Developer
User avatar

Joined: Sat May 19, 2012 5:20 am
Posts: 491
Location: BB, Slovakia
Reply with quote
RescueGamer wrote:
so, with this new mouse plugin the small sensors movements are better recognised for mouse purposes?

Yes I have a version working here, that even very small precise movements are shown and feels natural with a Rift or YEI. However CyberVillian is worried about the change affecting the behaviour of some of the other plugins as he has seen some unwanted side effects. We are currently trying to resolve these side issues before a release.


Fri Jul 12, 2013 10:13 am
Profile
Cross Eyed!
User avatar

Joined: Thu May 16, 2013 1:02 am
Posts: 108
Reply with quote
Ok, then I don't have to use this with my android device XD


Fri Jul 12, 2013 11:00 am
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
Well yes, try to move your phone just slightly, it will not move. So its the same problem for Android.

_________________
FreePIE
My blog


Fri Jul 12, 2013 1:38 pm
Profile
Cross Eyed!
User avatar

Joined: Thu May 16, 2013 1:02 am
Posts: 108
Reply with quote
Oks, i'll give it a try, i'll tell you what I get ;)


Sat Jul 13, 2013 12:13 am
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
Updated the branch, I now use Baggyg's code. I have also added a deadband filter that can be used for devices with small drift. Please try it out, this works pretty well for me and my Android.

Code:
def update():   
   x = filters.deadband(filters.delta(math.degrees(android.yaw)), 0.01)
   y = filters.deadband(filters.delta(math.degrees(android.roll)), 0.01)
   
   if x <> 0:
      diagnostics.watch(x)
      
   if y <> 0:
      diagnostics.watch(y)
      
   mouse.deltaX = x * 5
   mouse.deltaY = y * 5
   
if starting:
   android.update += update

_________________
FreePIE
My blog


Sun Jul 14, 2013 4:22 pm
Profile
Vireio Perception Developer
Vireio Perception Developer
User avatar

Joined: Sat May 19, 2012 5:20 am
Posts: 491
Location: BB, Slovakia
Reply with quote
Hi Cyber,
Tried your code here on the YEI and all working fine. With the right settings on the YEI suite the deadband wasn't needed, but changed the trust levels to emulate a bit of drift and the deadband works well. Its a good tradeoff to let the user decide the deadband level, but keep the accuracy of the <0.5 figures for small mouse movements.

One small efficiency change. Line 92 of MousePlugin.cs
Code:
if ((deltaXOut != 0) || (deltaYOut != 0))

should be
Code:
if ((int)deltaXOut != 0 || (int)deltaYOut != 0)

Since we don't need to send anything to the mouse if there is no movement.

Apart from that I think this is ready to be released. :-D


Mon Jul 15, 2013 3:08 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.