cmbruns/pyopenvr 168
Unofficial python bindings for Valve's OpenVR virtual reality SDK
Classic Doom/Heretic/Hexen games in stereo 3D and VR; modified version of gzdoom.
Python bindings for Oculus Rift virtual reality SDK
Mirror of http://code.google.com/r/cer0sentido-osgswig/ (a clone of http://code.google.com/p/osgswig/)
Python bindings for OpenSceneGraph 3D graphics API, created using Boost.Python and Py++
Python module for using KTX format OpenGL texture image files
stereograph restoration application
A portable, enhanced source port of Doom, Heretic and Hexen.
SEQUOIA sequence/structure alignment tool
startedtothepoweroftom/AudioUI
started time in a day
startedcmbruns/pyovr
started time in 4 days
startedcmbruns/pyopenvr
started time in 8 days
startedcmbruns/pyopenvr
started time in 12 days
startedcmbruns/pyopenvr
started time in 14 days
startedVitorVilela7/fastrom
started time in 17 days
startedcmbruns/pyopenvr
started time in 21 days
startedGrimi94/WAVCat
started time in 23 days
startedcmbruns/pyopenvr
started time in 23 days
issue commentcmbruns/pyopenvr
openvr.error_code.InitError_Init_VRClientDLLNotFound
Hi Abdullah, same with me after trying to continue work on cameratracking on a linux machine. everything worked for me on a win10-machine. cannot find any answer in the forum, did you help yourself? Best and habby new year, sven
comment created time in 25 days
startedcmbruns/pyopenvr
started time in a month
fork Tubbz-alt/pyopenvr
Unofficial python bindings for Valve's OpenVR virtual reality SDK
fork in a month
startedAllar/ue4-style-guide
started time in a month
startedcmbruns/pyopenvr
started time in 2 months
startedcmbruns/pyopenvr
started time in 2 months
issue openedcmbruns/pyopenvr
getControllerStateWithPose() returns all zeros
More hacking around and discovered another problem. I do NOT have real hardware, so the possibility exists that it is bug else where... but 'fake' trackers are shown in Virtual World.
Discovered that waitGetPoses()
only works when you are operating as VRApplication_Scene
, meaning that script terminates (or is terminated) other VR application - runs in construct though...
So I have shifted to getControllerStateWithPose()
.
if options.kinect:
'''
poses, game_poses = openvr.VRCompositor().waitGetPoses(poses, None)
kinect = poses[1]
'''
res, state, kinect = openvr.VRSystem().getControllerStateWithPose(0,2)
mat = kinect.mDeviceToAbsoluteTracking
A = np.matrix(
((mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3]),
(mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3]),
(mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3]),)
, np.float32)
P = A.dot(np.matrix('0; 0; 0; 1')) + np.array( \
[[options.Y], [options.X], [options.Z]])
position = (P[2][0], P[0][0], P[1][0])
Any suggestions as to why? Do the 'controllers' have to have a button press before this function returns data?
https://github.com/mungewell/pyPSVR/blob/master/example5_threaded/threaded_psvr.py#L347 https://github.com/SDraw/driver_kinectV1
created time in 2 months
issue commentcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
Minor detail. need to start OpenVR with "VRApplication_Overlay" or it stops (or is stopped by) true application.
comment created time in 2 months
issue commentcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
Not tested with PSVR yet (as that's not available ATM), but seems to function as expected. https://github.com/mungewell/pyPSVR/blob/master/example4_vridge_sensors/reposition.py#L123
comment created time in 2 months
issue commentcmbruns/pyopenvr
How do I convert the pose information to just XYZ position
tried some simple code with sample 'track_hmd.py', but had some issue getting it to handle the HmdMatrix34_t. Ended up with this...
hmd_pose = poses[openvr.k_unTrackedDeviceIndex_Hmd]
mat = hmd_pose.mDeviceToAbsoluteTracking
A = numpy.matrix(
((mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3]),
(mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3]),
(mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3]),)
, numpy.float32)
print(A.dot(numpy.matrix('0; 0; 0; 1')))
After starting VRidge it gives a position (believed to be 0,0,0)
[[ 9.80908925e-45]
[ -2.41901112e+01]
[ -7.00649232e-45]]
If I reposition HMD to x=1, y=1, z=1 I get
[[ 0.52336156]
[-24.89011192]
[ 1.31380844]]
If I reposition HMD to x=1, y=1, z=2 I get
[[ 0.12813818]
[-24.89011192]
[ 2.2323935 ]]
If I reposition HMD to x=1, y=2, z=2 I get
[[ 0.12813818]
[-23.89011192]
[ 2.2323935 ]]
Seems like the co-ordinate frames are not quite aligned, so perhaps I'd a little off in my code.
I'll try building this up into a full script (Kinect camera watching me wear a headset and sending me the HMD position).
comment created time in 2 months
issue closedcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
I am tinkering on a DIY project and want to establish the timing of HMD's VSYNC, so that I can calculate a predicted Rotation/Position to send through the system.
It looks like OpenVR has a call "GetTimeSinceLastVsync" https://github.com/ValveSoftware/openvr/blob/0eb70325a4ea3edca2a0ff8aefa631f2529e6eb7/headers/openvr.h#L2046
But this is not implement in pyOpenVR. :-(
Is this the correct method, or is there a better way to sync the timing?
There do seem to be properties for this: https://github.com/cmbruns/pyopenvr/blob/129e38228cbf61d129ed9757a177ea6cf4aa7fe7/src/translate/openvr_capi.h#L532 https://github.com/ValveSoftware/openvr/blob/0eb70325a4ea3edca2a0ff8aefa631f2529e6eb7/headers/openvr.h#L366
closed time in 2 months
mungewellissue commentcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
So again, with minimum effort expended, a slight mod to the example 'track_hmd.py' script.
print(hmd_pose.mDeviceToAbsoluteTracking)
print(openvr.VRSystem().getTimeSinceLastVsync())
sys.stdout.flush()
time.sleep(0.2)
I got plausible results. 60Hz screen/HMD rate, 0.2s sleep...
[[0.9185850024223328, 0.0, -0.3952234089374542, -0.3952234089374542], [0.0, 1.0, 0.0, -24.69011116027832], [0.3952234089374542, 0.0, 0.9185850024223328, 0.9185850024223328]]
(1, 0.007271000184118748, 44916)
[[0.9185850024223328, 0.0, -0.3952234089374542, -0.3952234089374542], [0.0, 1.0, 0.0, -24.69011116027832], [0.3952234089374542, 0.0, 0.9185850024223328, 0.9185850024223328]]
(1, 0.009304800070822239, 44928)
[[0.9185850024223328, 0.0, -0.3952234089374542, -0.3952234089374542], [0.0, 1.0, 0.0, -24.69011116027832], [0.3952234089374542, 0.0, 0.9185850024223328, 0.9185850024223328]]
(1, 0.012063900008797646, 44940)
[[0.9185850024223328, 0.0, -0.3952234089374542, -0.3952234089374542], [0.0, 1.0, 0.0, -24.69011116027832], [0.3952234089374542, 0.0, 0.9185850024223328, 0.9185850024223328]]
(1, -0.0022718000691384077, 44953)
[[0.9185850024223328, 0.0, -0.3952234089374542, -0.3952234089374542], [0.0, 1.0, 0.0, -24.69011116027832], [0.3952234089374542, 0.0, 0.9185850024223328, 0.9185850024223328]]
(1, -0.000631399976555258, 44965)
Though I'm not sure how a 'time since' something can be a negative value.
I think that this is enough to get a real script going. Thanks for the help, and I'll re-open if have more issues.
comment created time in 2 months
issue commentcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
I think probably about '2 out of 10'. It was late and I think I was using GitHub search, which still flags 0 hits... so perhaps that's broken at the moment.
Thanks for the follow up. I'll try both methods and see what works for me. Simon.
comment created time in 2 months
issue openedcmbruns/pyopenvr
openvr.error_code.InitError_Init_VRClientDLLNotFound
I keep getting the following error when I run the same code in the read.md:
File "/home/shn/MyDrive/TestPython/testOpenVR.py", line 5, in <module> openvr.init(openvr.VRApplication_Scene) File "/home/shn/.local/lib/python3.8/site-packages/openvr/__init__.py", line 7170, in init initInternal2(applicationType, pStartupInfo) File "/home/shn/.local/lib/python3.8/site-packages/openvr/__init__.py", line 7302, in initInternal2 openvr.error_code.InitError.check_error_value(error.value) File "/home/shn/.local/lib/python3.8/site-packages/openvr/error_code/__init__.py", line 23, in check_error_value raise error_class(error_value, message) openvr.error_code.InitError_Init_VRClientDLLNotFound
I am using Ubuntu 20.04 with Vive Headset and 2 base stations 1.0
created time in 2 months
issue commentcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
I am tinkering on a DIY project and want to establish the timing of HMD's VSYNC, so that I can calculate a predicted Rotation/Position to send through the system.
You should look into IVRCompositor::WaitGetPoses
documentation (I know it is not easy to find), because this will get you (I believe) exactly what you need.
For what concerns IVRSystem::GetTimeSinceLastVsync
not being implemented in pyOpenVR, I will look into it.
comment created time in 2 months
issue openedcmbruns/pyopenvr
Establishing VSYNC timing of HMD - GetTimeSinceLastVsync
I am tinkering on a DIY project and want to establish the timing of HMD's VSYNC, so that I can calculate a predicted Rotation/Position to send through the system.
It looks like OpenVR has a call "GetTimeSinceLastVsync" https://github.com/ValveSoftware/openvr/blob/0eb70325a4ea3edca2a0ff8aefa631f2529e6eb7/headers/openvr.h#L2046
But this is not implement in pyOpenVR. :-(
Is this the correct method, or is there a better way to sync the timing?
There do seem to be properties for this: https://github.com/cmbruns/pyopenvr/blob/129e38228cbf61d129ed9757a177ea6cf4aa7fe7/src/translate/openvr_capi.h#L532 https://github.com/ValveSoftware/openvr/blob/0eb70325a4ea3edca2a0ff8aefa631f2529e6eb7/headers/openvr.h#L366
created time in 2 months
issue commentcmbruns/pyopenvr
How do I convert the pose information to just XYZ position
@risa2000 Thank you for a very helpful reply, I will try this when I have the kit hooked up again.
I had taken the value from; https://github.com/cmbruns/pyopenvr/blob/master/src/samples/track_hmd.py
But with 'k_unTrackedDeviceIndex_Hmd' replaced with the index of the tracker I was interested in.
comment created time in 2 months
issue commentcmbruns/pyopenvr
How do I convert the pose information to just XYZ position
@mungewell I am not sure from which function you get the pose exactly, but in general, you should be getting equivalent of this:
/** describes a single pose for a tracked object */
struct TrackedDevicePose_t
{
HmdMatrix34_t mDeviceToAbsoluteTracking;
HmdVector3_t vVelocity; // velocity in tracker space in m/s
HmdVector3_t vAngularVelocity; // angular velocity in radians/s (?)
ETrackingResult eTrackingResult;
bool bPoseIsValid;
// This indicates that there is a device connected for this spot in the pose array.
// It could go from true to false if the user unplugs the device.
bool bDeviceIsConnected;
};
What you post here could be mDeviceToAbsoluteTracking
which is 3x4 matrix, representing affine transformation (rotation and translation) in "dense" format (without the last row). It is
A = T * R
where R
is the rotation and T
is the translation, and it defines the relative position and orientation of the tracked device in the world space. Incidentally A
is a transformation from the device space to the world space, so:
dev_pos_world = A * [0, 0, 0, 1]
dev_direction_world = A * [dev_direction_dev | 0]
where [dev_direction_dev | 0]
is the direction vector of the device in device coordinates (e.g [0, 0, -1] for a HMD), extended by zero.
comment created time in 2 months
issue openedcmbruns/pyopenvr
How do I convert the pose information to just XYZ position
Working on a DIY project using various projects from GitHub.
I am using a Kinect to track head position, and I want to blend the position with my PSVR's rotation (already have kalman working with VRidge and SteamVR). https://github.com/SDraw/driver_kinectV1
pyOpenVR lets me access the tracking pose, and report something like this
[[-0.9185850024223328, 0.0, 0.3952234089374542, 0.4742681086063385], [0.0, 1.0, 0.0, -20.290109634399414], [-0.3952234089374542, 0.0, -0.9185850024223328, -1.102302074432373]]
What is the format of this matrix?
created time in 2 months
startedchangkun/modern-cpp-tutorial
started time in 2 months