RoboDK Forum
VR tracker Position&Orientation- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: VR tracker Position&Orientation (/Thread-VR-tracker-Position-Orientation)



VR tracker Position&Orientation-gb2njoa-02-22-2023

hello,

我am currently developing a new solution for machine learning.
我use an HTC Tracker 3.0 and SteamVr without a headset.

我linked SteamVr and RoboDK so I see my cameras (base station) and my tracker in space
我positioned a frame in order to overlay my CAO Camera and my SteamVr generated camera.
我t works great, the simulation tracker item follows the real movement !

Now I want to get the position/orientation of the tracker in space ! (if possible with a python script )
我don't see any item(tracker or camera) created in the tree so how can I collect this informations ?

Thanks.


RE: VR tracker Position&Orientation-Albert-02-22-2023

You can measure the pose of a tracker using the RoboDK API and MeasurePose. The following function can help you better understand how to use it as you can also read the button state and take the averaged measurement (helps reduce noise).
Code:
TARGET_TYPE_NONE=-1 # The same as TARGET_TYPE_PROBE
TARGET_TYPE_BASE=0 # Static reference used for world positionning (measurements reference)
TARGET_TYPE_TOOL=1 # Robot tool for robot calibration purposes
TARGET_TYPE_REFERENCE=2 # Moving reference (held by hand)
TARGET_TYPE_PROBE=3 # Generic HTC Vive Tracker used with a probe
TARGET_TYPE_GENERIC=4 # Generic HTC Vive Tracker marked as generic
TARGET_TYPE_CONTROLLER=5 # HTC Vive Controller

...

def MeasurePoseSpecial(target, time_avg_ms=500):
"""Measure a pose of something that moves. target variable must be set to TARGET_TYPE_REFERENCE or TARGET_TYPE_CONTROLLER."""
pose, data = RDK.MeasurePose(target, time_avg_ms)
ntargets = int(数据[0])
buttons = int(data[1]) # important!
#time = int(data[2])
if buttons < 0 or ntargets <= 0:
RDK.ShowMessage("Unable to see target id %s." % str(target), False)
pause(0.5) # gives time to read msg
return None, [-1,-1]

errors = data[2:4]
return pose, errors

You can read the state of the buttons using a bitmask.

Also, you can trigger the identification of a tracker to assign it as a Handheld probe, Generic tracker or robot tool by calling the IdentifyTracker command:
Code:
RDK.Command("IdentifyTracker")



RE: VR tracker Position&Orientation-Albert-02-22-2023

Another topic, we support using HTC Vive trackers and Valve Base stations as a measurement system with RoboDK TwinTrack:
//www.sinclairbody.com/TwinTrack

Let us know if you need more information.

We have not tested the HTC Vive Trackers v3 yet but the new improvements look promising.


RE: VR tracker Position&Orientation-gb2njoa-02-23-2023

Thanks for your reply !

我tried your code.
Code:
RDK.Command("IdentifyTracker")
This code shows me the tracker type parameter window, but when I changed the type and click "ok", it automatically back to probe. It is normal ?

And when I start the code to measure the pose, an exception occurred :
Code:
pose, data = RDK.MeasurePose(target, time_avg_ms)
File "C:\RoboDK\Python\robodk\robolink.py", line 2815, in MeasurePose
self._check_status()
File "C:\RoboDK\Python\robodk\robolink.py", line 779, in _check_status
raise LicenseError(self.LAST_STATUS_MESSAGE)
robodk.robolink.LicenseError: Invalid license for tracking
Do you have a solution ?

Thanks.


RE: VR tracker Position&Orientation-Albert-02-23-2023

我t is better if you can contact us by email so we can allow you to use RoboDK for this purpose.