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

VR tracker Position&Orientation

#1
hello,

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 ?

Thanks.
#2
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")
#3
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.
#4
Thanks for your reply !

I 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.
#5
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)