Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

VR tracker Position&Orientation


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

I linked SteamVr and RoboDK so I see my cameras (base station) and my tracker in space
I positioned a frame in order to overlay my CAO Camera and my SteamVr generated camera.
It 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 )
I don't see any item(tracker or camera) created in the tree so how can I collect this informations ?

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).
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


   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(data[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:
Another topic, we support using HTC Vive trackers and Valve Base stations as a measurement system with RoboDK 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.
Thanks for your reply !

I tried your code.
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 :
   pose, data = RDK.MeasurePose(target, time_avg_ms)
 File "C:\RoboDK\Python\robodk\", line 2815, in MeasurePose
 File "C:\RoboDK\Python\robodk\", line 779, in _check_status
   raise LicenseError(self.LAST_STATUS_MESSAGE)
robodk.robolink.LicenseError: Invalid license for tracking
Do you have a solution ?

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

Users browsing this thread:
1 Guest(s)