User Tools

Site Tools


using_htc_vive_to_control_dynamixel_servo

This is an old revision of the document!


Using HTC Vive to Control Dynamixel Servo

Author: Keitaro Nishimura Email: nishik1@unlv.nevada.edu
Date: Last modified on 05/02/17
Keywords: OpenVR SDK, HTC Vive, Dynamixel, tutorial


The photo above depicts using the Vive position tracking to move a Dynamixel servo around. This tutorial shows you how to setup a Visual Studio Project to use the OpenVR SDK, how to get the position data of the Vive controllers, and how to use that position data to move around a Dynamixel servo.

Motivation and Audience

This tutorial's motivation is to teach the reader how to use the position tracking of the HTC Vive controllers to move a Dynamixel servo. This tutorial is not meant to be a comprehensive tutorial on openVR and Dynamixel SDK. Rather a starting point for the reader to then follow further to learn more about the respective APIs.
Readers of this tutorial are assumed to have the following background and interests:

* Know how to follow directions
* Have experience with/or interest in cpp
* Be interested in some form of HMI
* Have completed the previous 2 tutorials


The rest of this tutorial will follow as presented:

  • Parts Lists and Source
  • Setting up Visual Studio Environment for OpenVR
  • Getting the position Data of the Vive Controller
  • Integrating the Dynamixel SDK to move the servo
  • Final Words

Parts Lists and Sources


To complete this tutorial, you'll need the following items listed bellow.

Part Name/Description Vendor Vendor URL Qty Notes
HTC Vive Kit Vive or Fry's https://www.vive.com/us/product/ or http://www.frys.com/product/8987273 1The kit will come with all the necessary hardware. 1 Vive HMD (head mounted display), 2 lighthouse base stations, 2 controllers, and the cables and power sources needed.
A computer with at least a GTX 1060 or equivalent Amazon https://www.amazon.com/1Please reference the recommended computer specs for any computer the reader plans to use. The lab however already has a computer specifically for research with the vive.
Tripod mounts for lighthouse base stations Amazon or build in-house https://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=tripod+for+camera 2 Since the base stations have a standard camera mounting hole on the bottom any standard camera tripod should work. You can also use scrap pieces of 2×4 wood to create your own mount for them.
Dynamixel Servo (RX-28) Robotis http://www.robotis.us/dynamixel-rx-28-hn07-n101/ 1 You do not need to use this specific servo, lease please not that some parts of this tutorial may be different depending
USB to Dynamixel Robotis http://www.robotis.us/usb2dynamixel_int/ 1 This is needed to communicate between the dynamixel and computer
SMPS2Dynamixel Robotis http://www.robotis.us/smps2dynamixel/ 1 This is needed to power the dynamixel
12V~5A power adapter Robotis http://www.robotis.us/smps-12v-5a-ps-10-us-110v/ 1 This should be together with the SMPS2Dynamixel
Robot Cable-X4P Robotis http://www.robotis.us/cables/ 2 The actual length does not matter, but the pin type (4pin) does
Male to Female USB Extension Cable Amazon https://www.amazon.com/AmazonBasics-Extension-Cable-Male-Female/dp/B00NH11R3I/ref=sr_1_2?ie=UTF8&qid=1494974321&sr=8-2&keywords=usb+extender+male+to+female 1 This is not necessary for this tutorial but will make your life a lot easier in the last section (we should have a box full of these in the cabinets)


All of the items mentioned above should already be available to your in the lab. Please check with the lab manager or your lab mates for the whereabouts of the various parts.

Setting up Visual Studio Environment for OpenVR


In this section, we will go over how to setup the visual studio environment to be able to develop with the OpenVR SDK. Although it is possible to do with QT as well this tutorial will focus exclusively on Visual Studio. If you need to use QT please refer to the other sample code within the OpenVR folder that is written with QT (e.x. helloworld_overlay).


1. The first step is to open up a new Visual Studio Project. This picture below should depict what you will see when opening up the IDE. If you have a problem with an expired license please refer to the previous tutorial on how to fix that (if you are using a lab computer this shouldn't be a problem).

Once open click on the New Project… link under “Start” on the left-hand side of the window. A new window will pop up prompting you to choose what type of project, where to save it and what to name it. As the picture below shows click on the “VisualC++” option on the left-hand side and choose “Empty Project”. The name doesn't matter in this case. For this tutorial I will name it “ViveDynamixelPosTest”, but feel free to name it whatever makes sense to you. Don't worry about the save location, the default will work fine. Then click “OK”.

You should be greeted by an empty project, as depicted below.

At the top of the window, you will notice a tab with “x86” in it (if it is already x64 don't worry about this). Click on it and choose the “x64” instead. If you don't there will be build errors later on. I had forgotten to do this when making this tutorial thus why there is already code in my window in the picture bellow.

You have now created you own VisualStudio's project! We will now go into all of the setting and changes to the folders that you will need to make so that you can use the OpenVR SDK with it.


2. In the new project window, if you look at the right hand-side, you will notice the Solution Explorer window. Within it, you should find your project and all of its contents (right now empty folders). Right click on the name of your project (it should be highlighted and in bold text right after the window opens) and click on the Properties option at the bottom of the menu.

Once you have clicked on it the Property Pages window will appear. This is where the majority of changes will happen.

Under “Configuration Properties” in the “VC++ Directories” click left of the Library Directories and choose <Edit…>. In the new window that popped up enter the locations the .lib files for OpenVR, sdl, and glew. All of which can be found inside the OpenVR SDK folder (if you don't already have it downloaded refer to the previous tutorial). For me these paths are:

C:\openvr-master\lib\win64
C:\openvr-master\samples\thirdparty\sdl2-2.0.3\bin\win64
C:\openvr-master\samples\thirdparty\glew\glew-1.11.0\lib\Release\x64

These pathways can differ depending on where you saved the OpenVR folder, but after openvr-master it will be the same (openvr-master is what I named the OpenVR SDK folder when I extracted it from github). Although you can type the pathway directly into the window you can also look for it by clicking the folder icon in the top right hand corner next to the red “X” symbol (which will delete the highlited pathway). Once entered click OK.


Then move to the “C/C++” tab and in “General” click left of “Additional Include Directories” and choose <Edit…>. Then the directories to all of the needed header files for OpenVR, sdl, and glew. For the they were:

C:\openvr-master\headers
C:\openvr-master\samples\thirdparty\sdl2-2.0.3\include
C:\openvr-master\samples\thirdparty\glew\glew-1.11.0\include

They may differ for you depending on where you saved your file but after openvr-master will be identical. Once again you can either type the pathways directly or find them through the folder icon in the top right hand corner.


Then change the option for SDL checks from “Yes” to No“.

Then while staying under “C/C++” move from “General” to “Optimization” and change “Optimization” to “Disabled (/Od)” and “Enable Intrinsic Functions” to “Yes (/Oi)”.

using_htc_vive_to_control_dynamixel_servo.1496541441.txt.gz · Last modified: by keitaronishimura