Re: Razer hydra emulation
Posted: Mon May 02, 2016 7:07 am
Code is now checked into https://github.com/AndersMalmgren/FreePIE/tree/psmove
The Number One Resource For Stereoscopic 3D Excitement!
https://www.mtbs3d.com/phpbb/
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).CyberVillain wrote:Code is now checked into https://github.com/AndersMalmgren/FreePIE/tree/psmove
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 ).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.
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).Remlas wrote: Is now everythink finally working? All Axes and buttons? I have 2 Motion controllers and i wanna test hydra emulation
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 .CyberVillain wrote:Good find on the reconnect problem, what was it?
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):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?
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.gladiusz wrote:However, few times FreePie crashed after restarting the script.
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?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.
Code: Select all
public bool getNavDown(MoveButton button)
{
return plugin.ButtonHandler.IsButtonDown(button);
}
public bool getNavPressed(MoveButton button)
{
return plugin.ButtonHandler.IsButtonPressed(button);
}
Code: Select all
public bool getNavDown(MoveButton button)
{
return plugin.NavButtonHandler.IsButtonDown(button);
}
public bool getNavPressed(MoveButton button)
{
return plugin.NavButtonHandler.IsButtonPressed(button);
}
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.gladiusz wrote: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?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.
Code: Select all
diagnostics.watch(psmove[0].getNavDown(MoveButton.DOWN))
diagnostics.watch(psmove[0].getNavDown(MoveButton.LEFT))
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()".gladiusz wrote:The problem appears only when nav controller is on. Without the nav controller I can even past this line in code: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.Code: Select all
diagnostics.watch(psmove[0].getNavDown(MoveButton.DOWN)) diagnostics.watch(psmove[0].getNavDown(MoveButton.LEFT))
Here's the plugin with gladiusz's nav button edit .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
Thanks. That's the method I'm currently using. It seems quite nice and stable . Is there any point in supporting MiJ any more?gladiusz wrote:Thanks 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.
Code: Select all
psmove[id].setRumble(id,value)
Code: Select all
public void setRumble(int id, int value)
{
Api.setRumble(id, value); // 0 to 255
}
Code: Select all
[Global(Name = "psmove")]
public class PSMoveGlobal : UpdateblePluginGlobal<PSMoveGlobalHolder>
{
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.Thanks. That's the method I'm currently using. It seems quite nice and stable . Is there any point in supporting MiJ any more?
Code: Select all
[Tracking]
BallColor0=255 100 100
BallColor1=100 255 255
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.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!
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.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.
Yes, I'm using native windows bt stack, paired with unity tools (Gladiusz linked them).zelmon64 wrote: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.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.
Just to clarify, are you using the native bt stack to pair your moves?
Cheers
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.zelmon64 wrote: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.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!
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.
Ok, now it's not crashing.zelmon64 wrote:Would you please try running it on your system to see if it still crashes?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.
I think it's very good ideagladiusz 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'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.Remlas wrote:Ok, now it's not crashing.zelmon64 wrote:Would you please try running it on your system to see if it still crashes?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.
I think it's very good ideagladiusz 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.
Anyone have any idea how to use multiple cameras? I have 2 PS Eyes, but I can get 2 more.
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.CyberVillain wrote:Please have a look at the native FreePIE plugin settings. Each plugin cant have its own way of doing it
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: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.
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
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.zelmon64 wrote:
Has anyone managed to get tracking of more than two moves to work using the new MoveManager.dll I built?
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.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?).
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)
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.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 ) wchich make move motion -- > freetrack / trackir / vireosmt
Code: Select all
UseMagnetometers=1
Code: Select all
AHRSalgorithmGain (default: 0.1)
PredictionBufferSize (default not set)
yup, i set UseMagnetometers=1zelmon64 wrote:
I don't think it would make a difference but did you include the linein the settings.cfg file in the "[Tracking]" section?Code: Select all
UseMagnetometers=1
Looking at the documentation (https://code.google.com/archive/p/movef ... rkSDK.wiki) you might want to try adjusting the value for these:My hunch is that setting the might be of more use since it doesn't have a default value. Good luck!Code: Select all
AHRSalgorithmGain (default: 0.1) PredictionBufferSize (default not set)
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?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?