Razer hydra emulation

Official forum for open source FreePIE discussion and development.
Post Reply
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Razer hydra emulation

Post by CyberVillain »

Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

Hi

Is now everythink finally working? All Axes and buttons? I have 2 Motion controllers and i wanna test hydra emulation :D

Anyone have fully working script?
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

CyberVillain, are you going to edit nav buttons or you don't have enaugh time for it? If you don't, we'll just test if it works with multiple moves and when it'll work fine you can just add psmove plugin to next update without all that mess with nav controllers. At all, it can be read by joystick plugin.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

CyberVillain wrote:Code is now checked into https://github.com/AndersMalmgren/FreePIE/tree/psmove
Thanks for putting it up. Couldn't quite figure out how to update my fork so in the end I deleted it and re-forked :? . I accidentally made a pull request in the process so I closed it (hope that's okay).
gladiusz wrote: Works amazing! We have to restart FreePie after every use of script, beacuse the bulb doesn't light down in any way and it's messed up in every next use. So restart after every script's running and everything will be fine.
I've managed to fix the problem of the script not shutting down correctly which meant that FreePIE had to be restarted every time (fixed plugin attached :) ).
Remlas wrote: Is now everythink finally working? All Axes and buttons? I have 2 Motion controllers and i wanna test hydra emulation :D
The axes, buttons and positioning all work. Currently the axes aren't aligned as expected but it is an easy fix (ie. hydra[0].yaw = psmove[0].pitch; hydra[0].pitch = -psmove[0].roll; hydra[0].roll = psmove[0].yaw).
You do not have the required permissions to view the files attached to this post.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Razer hydra emulation

Post by CyberVillain »

Good find on the reconnect problem, what was it?
n8rockerasu
One Eyed Hopeful
Posts: 35
Joined: Thu Oct 17, 2013 2:33 am

Re: Razer hydra emulation

Post by n8rockerasu »

Very nice work on fixing the plugin! I tested it a bit tonight and didn't have any of the disconnect issues I had before. And when I click "stop script", it does indeed turn the orbs off. And they light right back up if you start the script again. That's great to see. You mention about the axes not being aligned as expected. Do you think having the yaw/pitch/roll all scrambled like that is the best way to handle it? Or is there a better option?

Regardless, it's amazing to see the progress that has been made. It feels like we're getting really close to having solid Move functionality on PC (and for me, not only Hydra emulation, but Vive wand emulation...which is huge). Really appreciate the work you guys have done on this.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

Good job, zelmon64! After turning off the script, orb stop shining and red led from PS eye turn off. Previously led from camera was shining all time after using some program which use framework. However, few times FreePie crashed after restarting the script.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Thanks for all the kind encouragement :) .
CyberVillain wrote:Good find on the reconnect problem, what was it?
I found "close()" in the MF_CWrapper.dll code which runs "move->closeCamera();" and "move->closeMoves();" so I added it to the "stop()" part in PSMovePlugin.c. Initially I didn't think it worked because I forgot the ";" so it wouldn't build :? .

n8rockerasu wrote:You mention about the axes not being aligned as expected. Do you think having the yaw/pitch/roll all scrambled like that is the best way to handle it? Or is there a better option?
I wasn't sure about changing it as it would mess up anyone's pre-existing code and I also wasn't sure what the correct alignment should be. After googling it I've aligned the orientation axes to be the same as a plane's which I hope is okay. It makes more sense to me (plugin attached):

Roll = rotation about the controller's axis of symmetry
Pitch = titling the controller forwards and backwards
Yaw = titling the controller from side to side

If this isn't right I can change it again. Just in case anyone doesn't already know, pressing the PS button resets the current orientation as (Pitch, Roll, Yaw) = (0.0, 0.0, 0.0) and holding it down for about 10s turns off the controller.

Initially I though my alteration was breaking the positional tracking because those numbers weren't changing but I think it was because the orb was setting itself to purple. I was able to make it choose yellow instead by holding it in front of the camera when starting the script and then the tracking was fine.

gladiusz wrote:However, few times FreePie crashed after restarting the script.
Do you mean when using my new plugin or CyberVillain's? I think the camera and move weren't closing properly in CyberVillain's original plugin so restarting the script meant that there were multiple instances running. I noticed that my cpu usage would increase and then FreePIE would crash when it got near 100%. The only way to prevent this was restarting FreePIE. I haven't had any crashes yet with my new plugin. I'm not sure what would be the cause if it's still crashing for you.
You do not have the required permissions to view the files attached to this post.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

Do you mean when using my new plugin or CyberVillain's? I think the camera and move weren't closing properly in CyberVillain's original plugin so restarting the script meant that there were multiple instances running. I noticed that my cpu usage would increase and then FreePIE would crash when it got near 100%. The only way to prevent this was restarting FreePIE. I haven't had any crashes yet with my new plugin. I'm not sure what would be the cause if it's still crashing for you.
I mean your plugin. Usually when I'm turning off the script, whole FreePie stops working and in total I have to run it once again. Can it be MotioninJoy fault?
Edit: I repaired that mess with nav buttons. It was realy easy :) In PSMovePlugin.cs instead:

Code: Select all

public bool getNavDown(MoveButton button)
        {
            return plugin.ButtonHandler.IsButtonDown(button);
        }

        public bool getNavPressed(MoveButton button)
        {
            return plugin.ButtonHandler.IsButtonPressed(button);
        }
Use this:

Code: Select all

public bool getNavDown(MoveButton button)
        {
            return plugin.NavButtonHandler.IsButtonDown(button);
        }

        public bool getNavPressed(MoveButton button)
        {
            return plugin.NavButtonHandler.IsButtonPressed(button);
        }
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

gladiusz wrote:
Do you mean when using my new plugin or CyberVillain's? I think the camera and move weren't closing properly in CyberVillain's original plugin so restarting the script meant that there were multiple instances running. I noticed that my cpu usage would increase and then FreePIE would crash when it got near 100%. The only way to prevent this was restarting FreePIE. I haven't had any crashes yet with my new plugin. I'm not sure what would be the cause if it's still crashing for you.
I mean your plugin. Usually when I'm turning off the script, whole FreePie stops working and in total I have to run it once again. Can it be MotioninJoy fault?
I use the native windows 10 bt stack for my motion controllers and SCP Driver for the navigation controller. I don't trust MotioninJoy from what people say about it. I'm running the attached test script and I can stop and start it as quickly and as often as possible without FreePIE crashing or giving any errors.

I'm not sure how or why my modifications should cause FrePIE to crash. Does it happen every time stop your script? Could you post your script so that I can see if it crashes on my system please?

Is anyone else experiencing similar problems?
You do not have the required permissions to view the files attached to this post.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

The problem appears only when nav controller is on. Without the nav controller I can even past this line in code:

Code: Select all

diagnostics.watch(psmove[0].getNavDown(MoveButton.DOWN))
diagnostics.watch(psmove[0].getNavDown(MoveButton.LEFT))
and i can run script as many times as I want. Maybe your plugin wants to shut down nav controller too and this is the reason.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

gladiusz wrote:The problem appears only when nav controller is on. Without the nav controller I can even past this line in code:

Code: Select all

diagnostics.watch(psmove[0].getNavDown(MoveButton.DOWN))
diagnostics.watch(psmove[0].getNavDown(MoveButton.LEFT))
and i can run script as many times as I want. Maybe your plugin wants to shut down nav controller too and this is the reason.
You are correct that my modification tries to shut down the nav controllers as well. I added "close()" from MF_CWrapper.dll and looking at it's source code it performs "closeCamera()" and "closeMoves()".

"closeMoves()" appears to delete all the variable the program used for keeping track of the moves and navs. From what I can tell it seems to only close down the things is creates when initialising so I wouldn't have thought that it could interfere with something else. There does look to be a slight asymetry in the way it closes hid handles. It closes the hid move handles but not the nav handles. I've had a go at adding in the code for the navs and built the attached MF_CWrapper.dll. I'm not entirely sure what the changes I made will do. It still ran the same on my system.
You do not have the required permissions to view the files attached to this post.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

It look quite better with your new dll, so I can run script few times (my record is 3), but in the and I meet crash of FreePie.
Edit: I'm uninstalling MotioninJoy, because I want to test multiple moves with native stack.
Edit2: It works perfect with native stack, multiple moves and zelmon64 plugin. I think that my edit with nav buttons can be added to plugin and it can be released in new version of FreePie ;)
https://www.youtube.com/watch?v=iEMsqeoCgas
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

gladiusz wrote: Edit: I'm uninstalling MotioninJoy, because I want to test multiple moves with native stack.
Edit2: It works perfect with native stack, multiple moves and zelmon64 plugin. I think that my edit with nav buttons can be added to plugin and it can be released in new version of FreePie ;)
Here's the plugin with gladiusz's nav button edit :) .

Nice demo gladiusz :) . What are you using to connect the other controllers with now that you uninstalled MiJ?

Just in case anyone didn't already know (I only just found out), if you hold down the PS button on the move for about 3s while tracking it will set the current position as (0.0, 0.0, 0.0).
You do not have the required permissions to view the files attached to this post.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

Thanks :D Now I'm using this method to connect motion controlers: https://github.com/HipsterSloth/psmove- ... Windows%29. And for Dualshock I have another bluetooth dongle and SCP drivers.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

gladiusz wrote:Thanks :D Now I'm using this method to connect motion controlers: https://github.com/HipsterSloth/psmove- ... Windows%29. And for Dualshock I have another bluetooth dongle and SCP drivers.
Thanks. That's the method I'm currently using. It seems quite nice and stable :) . Is there any point in supporting MiJ any more?

I've added rumble control to the attached plugin. I couldn't figure out how to pass through the controller's id so the code is currently

Code: Select all

psmove[id].setRumble(id,value)
where value is 0 to 255.

I did this by adding

Code: Select all

        public void setRumble(int id, int value)
        {
            Api.setRumble(id, value); // 0 to 255
        }
into the class:

Code: Select all

    [Global(Name = "psmove")]
    public class PSMoveGlobal : UpdateblePluginGlobal<PSMoveGlobalHolder>
    {
If someone could tell me how the id's are stored or point me at some documentation it would be appreciated. I tried reverse engineering it from the other functions but had no luck.

I also attempted at manually setting the colour but it seems that the tracking or something overrides it because it would only briefly flash my set colour then return to its previous one.
You do not have the required permissions to view the files attached to this post.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

Thanks. That's the method I'm currently using. It seems quite nice and stable :) . Is there any point in supporting MiJ any more?
MiJ is a quite good option if you want to use one move and navigations controllers / dualshocks with one bluetooth dongle, but is full of bugs. Everything what was need to run plugin with MiJ is now in it, so I think that still supporting it has no sense.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

After digging through the source code for MoveFramework I found out that there's quite a simple way to set the move orb colour. When starting it looks at the settings.cfg file for any colour information then automatically sets it if it doesn't find any thing. Here is an example:

Code: Select all

[Tracking]
BallColor0=255 100 100
BallColor1=100 255 255
The numbers are for the separate red, green and blue leds and can be set from 0 to 255. When changing the colour only the script needs to be restarted instead of restarting FreePIE completely.

Positional tracking only seems to work for no more than two motion controllers but the other sensor information still comes through from the non-tracked controllers so they may be useful for something like run-in-place motion systems.
zeeker
One Eyed Hopeful
Posts: 3
Joined: Fri Dec 20, 2013 12:58 am

Re: Razer hydra emulation

Post by zeeker »

Hi!!! I think all of you are doing an excellent job with this PsMove plugin! Congrats for that! :D

By the way, I have a little question, why you don’t try or test this PsMove API, https://github.com/thp/psmoveapi/releases, perhaps two or three months ago this API was updated.

Some time ago, I read in some forum, that there is some FreePie fork, that uses that PS Move API.

According to what I understand, with this PsMove API, you can manage multiple PsMove devices simultaneously.

I haven’t the programing skills and time to test and try that API , but the people, who have been coded the Freepie PsMove plugin, maybe could take a look of that!
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

zeeker wrote: By the way, I have a little question, why you don’t try or test this PsMove API, https://github.com/thp/psmoveapi/releases, perhaps two or three months ago this API was updated.

Some time ago, I read in some forum, that there is some FreePie fork, that uses that PS Move API.

According to what I understand, with this PsMove API, you can manage multiple PsMove devices simultaneously.

I haven’t the programing skills and time to test and try that API , but the people, who have been coded the Freepie PsMove plugin, maybe could take a look of that!
Hi there :) . Thanks for your suggestion :) . The fork you're referring to is probably the one by NoxWings. I initially tried building that when CyberVillain merged it but I couldn't get any responses from the motion controller. I also tried building directly from NoxWings' fork but got the same result. It didn't show any errors so I wasn't sure how to fix it.

I think that the MoveFramework basically does the same thing as the PSMoveAPI. It can also manage multiple PsMove devices simultaneously. The only limitation seems to be that the positional tracking only works with up to two PSMoves but that may be the same for the PSMoveAPI anyway since Thomas Perl (thp) only shows tracking of two moves in his video.

I'm aslo able to build the MoveFramework DLLs and am adding functions by using the fork by NoxWings and documentation for moveonpc by nitsch (the PSMoveAPI is a library implementation of the MoveOnPC project) as references.
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

I confirm, that only 2 moves are working on positional tracking, when using 3 motion controller freepie crashes. Moves with id 0 and 1 are used. CalibrationTool 3.2 also crashes.
[youtube-hd]http://youtube.com/watch?v=WXnzE5URUqM[/youtube-hd]
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas wrote:I confirm, that only 2 moves are working on positional tracking, when using 3 motion controller freepie crashes. Moves with id 0 and 1 are used. CalibrationTool 3.2 also crashes.
I'm not sure why FreePIE is crashing for you. CalibrationTool 3.2 crashes for me when using more than two psmoves but FreePIE seems stable when I run the attached script. Would you please try running it on your system to see if it still crashes? I also attached the settings.cfg file I'm using to force the colour of the tracked psmoves to blue and red.

Just to clarify, are you using the native bt stack to pair your moves?

Cheers :)
You do not have the required permissions to view the files attached to this post.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Razer hydra emulation

Post by CyberVillain »

Please have a look at the native FreePIE plugin settings. Each plugin cant have its own way of doing it :D
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

zelmon64 wrote:
Remlas wrote:I confirm, that only 2 moves are working on positional tracking, when using 3 motion controller freepie crashes. Moves with id 0 and 1 are used. CalibrationTool 3.2 also crashes.
I'm not sure why FreePIE is crashing for you. CalibrationTool 3.2 crashes for me when using more than two psmoves but FreePIE seems stable when I run the attached script. Would you please try running it on your system to see if it still crashes? I also attached the settings.cfg file I'm using to force the colour of the tracked psmoves to blue and red.

Just to clarify, are you using the native bt stack to pair your moves?

Cheers :)
Yes, I'm using native windows bt stack, paired with unity tools (Gladiusz linked them).
I'm gonna recompile freepie and check this script afternoon.
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

zelmon64 wrote:
zeeker wrote: By the way, I have a little question, why you don’t try or test this PsMove API, https://github.com/thp/psmoveapi/releases, perhaps two or three months ago this API was updated.

Some time ago, I read in some forum, that there is some FreePie fork, that uses that PS Move API.

According to what I understand, with this PsMove API, you can manage multiple PsMove devices simultaneously.

I haven’t the programing skills and time to test and try that API , but the people, who have been coded the Freepie PsMove plugin, maybe could take a look of that!
Hi there :) . Thanks for your suggestion :) . The fork you're referring to is probably the one by NoxWings. I initially tried building that when CyberVillain merged it but I couldn't get any responses from the motion controller. I also tried building directly from NoxWings' fork but got the same result. It didn't show any errors so I wasn't sure how to fix it.

I think that the MoveFramework basically does the same thing as the PSMoveAPI. It can also manage multiple PsMove devices simultaneously. The only limitation seems to be that the positional tracking only works with up to two PSMoves but that may be the same for the PSMoveAPI anyway since Thomas Perl (thp) only shows tracking of two moves in his video.

I'm aslo able to build the MoveFramework DLLs and am adding functions by using the fork by NoxWings and documentation for moveonpc by nitsch (the PSMoveAPI is a library implementation of the MoveOnPC project) as references.
Maybe, a good idea will be replace CL Eye driver with PS3EYEDriver from PsMove API. First thing is that is free ;) and second that we will can make aplications for UE4 and Unity directly for Move and API without changing drivers. Disadventage of this can be a little bit harder installation process. It can be that new driver will work better in lighter rooms and it may works with bigger amounts of controllers than two.
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

zelmon64 wrote:
Remlas wrote:I confirm, that only 2 moves are working on positional tracking, when using 3 motion controller freepie crashes. Moves with id 0 and 1 are used.
Would you please try running it on your system to see if it still crashes?
Ok, now it's not crashing.
Image
gladiusz wrote:Maybe, a good idea will be replace CL Eye driver with PS3EYEDriver from PsMove API. First thing is that is free ;) and second that we will can make aplications for UE4 and Unity directly for Move and API without changing drivers. Disadventage of this can be a little bit harder installation process. It can be that new driver will work better in lighter rooms and it may works with bigger amounts of controllers than two.
I think it's very good idea :D


Anyone have any idea how to use multiple cameras? I have 2 PS Eyes, but I can get 2 more.
You do not have the required permissions to view the files attached to this post.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas wrote:
zelmon64 wrote:
Remlas wrote:I confirm, that only 2 moves are working on positional tracking, when using 3 motion controller freepie crashes. Moves with id 0 and 1 are used.
Would you please try running it on your system to see if it still crashes?
Ok, now it's not crashing.
gladiusz wrote:Maybe, a good idea will be replace CL Eye driver with PS3EYEDriver from PsMove API. First thing is that is free ;) and second that we will can make aplications for UE4 and Unity directly for Move and API without changing drivers. Disadventage of this can be a little bit harder installation process. It can be that new driver will work better in lighter rooms and it may works with bigger amounts of controllers than two.
I think it's very good idea :D


Anyone have any idea how to use multiple cameras? I have 2 PS Eyes, but I can get 2 more.
I've managed to alter the MoveManager.dll so that it can positionally track up to four moves. I've tested it with three moves (all I currently have) and I believe it works with a red, green and blue combination. The automatic selector kept wanting a purple one again which wouldn't track so I had to set it manually. I've attached the new MoveManager.dll and the settings.cfg file with the colours. My avast anti-virus kept deleting MoveManager.dll claiming it was a trojan but I build it from source myself and the source files are clean. What's more strange is that it wasn't deleting it when I was building it yesterday.

I haven't been able to use any of the PSMoveAPI stuff yet. I got as far as installing libusb-win32 but then couldn't figure out how to use anything. The windows examples in psmoveapi-3.9.1-x86_64-w64-mingw32.zip from https://github.com/thp/psmoveapi/releases wouldn't recognise my move controllers. Could someone who has the PSMoveAPI working please point me at how they managed it?

I've also managed to retrieve all the sensor data from the move such as the magnetometer, accelerometer and battery level but haven't implemented it yet in FreePIE because I can't figure out how to pass through the id number from "psmove[id]". Currently I have to state it twice like "psmove[0].battery(0)" to get the battery level of the first move.
CyberVillain wrote:Please have a look at the native FreePIE plugin settings. Each plugin cant have its own way of doing it :D
Are you referring to the settings.cfg file? It was already implemented in the MoveFramework code. Are the native FreePIE plugin settings stored in the settings.xml file? I had a look but couldn't understand it.
You do not have the required permissions to view the files attached to this post.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Razer hydra emulation

Post by CyberVillain »

Yes all plugin settings that uses the built in settings mechanism are stored in the settings xml
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

Guys, I have terrible drift problem in freepie :/ Raw data: https://onedrive.live.com/redir?page=vi ... XDM6pME3BY
Image


Any PS Framework fixes, ideas, filters in freepie?

EDIT: I probably found a solution. Can you enable Magnetometrs? In calibration tool i see drift is much smaller when using magnetomerer ON, when it's OFF drift is similar to this from freepie.
You do not have the required permissions to view the files attached to this post.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas wrote:Any PS Framework fixes, ideas, filters in freepie?

EDIT: I probably found a solution. Can you enable Magnetometrs? In calibration tool i see drift is much smaller when using magnetomerer ON, when it's OFF drift is similar to this from freepie.
According to the documentation https://code.google.com/archive/p/movef ... rkSDK.wiki (and from looking at the source code) we should be able to copy the calibration information in the settings.cfg file created by the calibration tool and put it into the same directory as FreePIE.exe and then it will use the magnetometer calibration. Here is an example:

Code: Select all

[Tracking]
BallColor0=0 0 255
BallColor1=255 0 0
BallColor2=0 255 0
UseMagnetometers=1
[Move_00:07:04:42:90:c3]
gyroGain=0.0015613 -4.68939e-006 1.03329e-005 2.9722e-005 0.00160785 4.40665e-005 2.17295e-005 8.59492e-006 0.00181135
accBias=0.000300746 0.000279979 0.000224688
accGain=0.0022532 -7.61355e-005 -1.82442e-005 6.68984e-005 0.00223442 -5.02839e-005 1.03365e-005 3.61141e-005 0.0022394
magBias=-37.0602 126.477 42.1638
magGain=0.00572606 0.000225045 -0.000565066 -0.000382362 0.00572082 -4.56643e-005 5.77864e-005 3.56882e-005 0.00545225
This however does not seem to work for me because instead of "[Move_00:07:04:42:90:C3]" I just get "[Move_]" (ie. the move's bt mac address is not given). When you run the calibration tool does it generate the move's bt mac addresses correctly for you?

I've been having another look at the PSMoveAPI and have actually managed to build and run the example files :D . I agree that it seems nice but I haven't been able to integrate it with FreePIE at all :cry: . I found a built version of NoxWings' plugin that he posted here:
https://groups.google.com/d/msg/psmove/ ... xmfzzOCQAJ but I still can't get it to work. I thought that I could perhaps rebuild libpsmoveapi.dll and libpsmoveapi_tracker.dll. I think that they're the same files as psmoveapi.dll and psmoveapi_tracker.dll (built from PSMoveAPI) because they're imported with the same code but substituting them doesn't work. I think this is because Visual Studio will only alow me to build PSMoveAPI as x64 whereas FreePIE is win32. I'm at a loss :(.

Has anyone managed to get tracking of more than two moves to work using the new MoveManager.dll I built?
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

zelmon64 wrote:
Has anyone managed to get tracking of more than two moves to work using the new MoveManager.dll I built?
Yes I tried. Position is tracked, I don't know how accurate, because I only checked that it's working. Checked with 3 motion controllers.

Referring to calibrating: hmm, I can Calibrate 1 move in calibration tool, launch freepie and generate setting cfg for the same move and copy manually lines from calibration tool settings.cfg file.

I also don't get proper mac adres in file generated from freepie. there are some characters, but N++ don't read them properly.
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

Zelmon - when I'm using your MoveManager.dll I can't reset orientation with PS button. Position is reset, but orientation don't. I'm going back to earlier dll's. Also axes are bugged (maybe because I cant reset them?).
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas wrote:Zelmon - when I'm using your MoveManager.dll I can't reset orientation with PS button. Position is reset, but orientation don't. I'm going back to earlier dll's. Also axes are bugged (maybe because I cant reset them?).
I can still reset the orientation of each of my three connected ps moves. I've attached my current complete working build of FreePIE. Hopefully it will work for you.

With the calibration not producing the BT mac addresses correctly I don't think the settings will be applied. It's annoying that I can't seem to get PSMoveAPI to work with FreePIE because I've been able to calibrate fine with that. I've tried the current version from thp and cboulay's fork with no luck :(.
You do not have the required permissions to view the files attached to this post.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas - I've had some success with the magnetometer calibration :D . I've attached a complete folder for the calibration tool and a separate MoveManager.dll to be placed with FreePIE. The calibration tool should now be able to calibrate two motion controllers per execution and save their data correctly with their bt mac addresses. To calibrate more that two simply turn off the calibrated controllers and repeat with your other ones. Each move's calibration data should now be saved under the move's unique bt mac address by the tool so the data won't be overwritten when calibrating a different move.

If anyone would like to know, the problem was a Windows quirk. Apparently each device is enumerated three times (whatever that means). This results in three paths with the difference being that they have "&col01#", "&col02#" or "&col03#" in them. "&col01#" has all the button and sensor data but "&col02#" has the bt information. I was able to find this information and apply a fix by comparing the code from PSMoveAPI so a big thanks to them :D
You do not have the required permissions to view the files attached to this post.
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

I tried running the programs on a different computer and found out that they needed the Visual C++ Redistributable for Visual Studio 2015 (https://www.microsoft.com/en-us/downloa ... x?id=48145). This was due to the way I was building the DLLs so I've built them with the runtime included so that this doesn't need to be separately installed :).
You do not have the required permissions to view the files attached to this post.
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

I calibrated sensors in calibration tool, copied lines from settings.cfg launched freepie, maybe drift is smaller but still to big. Are you using any filters? Here's my script. It's (I know, it's not written as should it be, but it's working :D ) wchich make move motion -- > freetrack / trackir / vireosmt

Code: Select all

#def update():
     #global yaw
     #yaw = psmove[0].pitch
     #global pitch
     #pitch = -psmove[0].roll
     #global roll
     #roll = psmove[0].yaw
     #global x
     #z = psmove[0].z*10
     #global y
     #x = psmove[0].x*10
     #global z
     #y = psmove[0].y*10


#if starting:
	#psmove[0].update += update
	#trackIR.update += update

#freeTrack.yaw = math.degrees(psmove[0].yaw)
#freeTrack.pitch = -psmove[0].pitch
#freeTrack.roll = psmove[0].roll
#freeTrack.z = psmove[0].z*10
#freeTrack.x = psmove[0].x*10
#freeTrack.y = psmove[0].y*10

trackIR.yaw = math.degrees(psmove[0].yaw)
trackIR.pitch = -math.degrees(psmove[0].pitch)
trackIR.roll = math.degrees(psmove[0].roll)
trackIR.z = psmove[0].z*10
trackIR.x = psmove[0].x*10
trackIR.y = psmove[0].y*10

#vireioSMT.yaw = math.degrees(psmove[0].yaw)
#vireioSMT.pitch = math.degrees(psmove[0].pitch)
#vireioSMT.roll = math.degrees(psmove[0].roll)
#vireioSMT.x = psmove[0].z*10
#vireioSMT.y = psmove[0].x*10
#vireioSMT.z = psmove[0].y*10


diagnostics.watch(trackIR.yaw)
diagnostics.watch(trackIR.pitch)
diagnostics.watch(trackIR.roll)
diagnostics.watch(trackIR.x)
diagnostics.watch(trackIR.y)
diagnostics.watch(trackIR.z)

#diagnostics.watch(freeTrack.yaw)
#diagnostics.watch(freeTrack.pitch)
#diagnostics.watch(freeTrack.roll)
#diagnostics.watch(freeTrack.z)
#diagnostics.watch(freeTrack.y)
#diagnostics.watch(freeTrack.x)

diagnostics.watch(psmove[0].yaw)
diagnostics.watch(psmove[0].pitch)
diagnostics.watch(psmove[0].roll)
diagnostics.watch(psmove[0].x)
diagnostics.watch(psmove[0].y)
diagnostics.watch(psmove[0].z)
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas wrote:I calibrated sensors in calibration tool, copied lines from settings.cfg launched freepie, maybe drift is smaller but still to big. Are you using any filters? Here's my script. It's (I know, it's not written as should it be, but it's working :D ) wchich make move motion -- > freetrack / trackir / vireosmt
That's a shame about the drift :(. I'm not using the moves for anything yet so I didn't know how they were performing. I only recently got the moves for a PS3 game and though it would be nice to be able to use them on PC.

I don't think it would make a difference but did you include the line

Code: Select all

UseMagnetometers=1
in the settings.cfg file in the "[Tracking]" section?

Looking at the documentation (https://code.google.com/archive/p/movef ... rkSDK.wiki) you might want to try adjusting the value for these:

Code: Select all

AHRSalgorithmGain (default: 0.1)
PredictionBufferSize (default not set)
My hunch is that setting the PredictionBufferSize might be of more use since it doesn't have a default value. Good luck! :D

Looking here: https://groups.google.com/d/msg/psmove/ ... vBUnF9JKMJ it seems that NoxWings may have had simular drift issues from using the PSMoveAPI with FreePIE. I'm not sure how to try to improve this :(
Remlas
One Eyed Hopeful
Posts: 13
Joined: Sun Mar 29, 2015 2:10 am

Re: Razer hydra emulation

Post by Remlas »

zelmon64 wrote:
I don't think it would make a difference but did you include the line

Code: Select all

UseMagnetometers=1
in the settings.cfg file in the "[Tracking]" section?

Looking at the documentation (https://code.google.com/archive/p/movef ... rkSDK.wiki) you might want to try adjusting the value for these:

Code: Select all

AHRSalgorithmGain (default: 0.1)
PredictionBufferSize (default not set)
My hunch is that setting the might be of more use since it doesn't have a default value. Good luck! :D
yup, i set UseMagnetometers=1
AHRSalgorithmGain - when set to about 2.0 there is drift around 0, but gives really big jitter.
PredictionBufferSize - makes drift faster. maybe no smaller jitter, big drift.

Calibration tool from framwork is not best. it tell me to hold device after moving. I probably see it too late and it may bug a bit (a my hand may shake a little?). Calibration is better in psmove api. You have to move in all directions and then after clicking Move button it's calculating. Maybe it will be better?
User avatar
zelmon64
Cross Eyed!
Posts: 134
Joined: Thu Apr 09, 2015 4:27 am

Re: Razer hydra emulation

Post by zelmon64 »

Remlas wrote: yup, i set UseMagnetometers=1
AHRSalgorithmGain - when set to about 2.0 there is drift around 0, but gives really big jitter.
PredictionBufferSize - makes drift faster. maybe no smaller jitter, big drift.

Calibration tool from framwork is not best. it tell me to hold device after moving. I probably see it too late and it may bug a bit (a my hand may shake a little?). Calibration is better in psmove api. You have to move in all directions and then after clicking Move button it's calculating. Maybe it will be better?
Comparing with the calibration files generated by PSMoveAPI, it seems that the first part of the process creates similar values. The second part however has six values from PSMoveAPI and nine values from MoveFramework. You could try copying across the first part and see if it helps perhaps?

I've managed to get NoxWings' PSMoveAPI version partially working in Windows 7. It gives all the button info and sensor readings like acceleration and gyro but the pitch, yaw and roll were all zeros and I'm not certain whether the values it gave for the position were correct. I've seen a few posts where he says about drift trouble but nothing about it getting fixed.

I'll try writing a new script for calibration in the style of PSMoveAPI but I'm not sure if it will really help.

[Edit]
Reading through this it looks like PSMoveAPI now uses a different orientation code which has much less drift. If I can just figure out how to build PSMoveAPI for x86 I may be able to integrate it into FreePIE
gladiusz
One Eyed Hopeful
Posts: 47
Joined: Wed Mar 23, 2016 7:22 am

Re: Razer hydra emulation

Post by gladiusz »

I also tested it with calibration tool. It's cool that it write and read correct adress, but even in this tool, with magnetometer on, I can see that third value in orient is changing and left move drifts to left and right move drifts to right
Edit: zelmon64, try to work with 3.0.0 version of API. It was using CL Eye which is 32bit so maybe you'll can buld a x86 version of API https://github.com/thp/psmoveapi/releases
Post Reply

Return to “FreePIE”