Giter Site home page Giter Site logo

htc_vive_teleop_stuff's Introduction

HTC Vive teleop stuff

Install

First, follow the INSTALL instructions to get Ubuntu 16.04 and SteamVR (beta) on your machine.

Install pyopenvr (it's not in package.xml dependencies as it needs to have HTC Vive SteamVR installed anyways, which is a manual process):

sudo pip install pyopenvr

To run my node you'll need to have installed basic ROS TF stuff:

# In case you are missing it
sudo apt-get install ros-kinetic-tf ros-kinetic-tf2*

Then check out and fake-compile (it's all Python) this repository in your catkin workspace:

mkdir -p vive_ws/src
cd vive_ws/src
git clone https://github.com/uts-magic-lab/htc_vive_teleop_stuff
cd ..
# or catkin build
catkin_make
source devel/setup.bash

You may also want to add htc_vive_helper to the workspace if you want to deal in a more user friendly fashion with the HTC Vive controllers.

Run node

The node you want to run is scripts/vive_tf_and_joy.py which is nicely prepared in a launchfile for you.

roslaunch htc_vive_teleop_stuff htc_vive_tf_and_joy.launch

You'll see plenty of output (that's the OpenVR initializing) and you may need to touch your controllers to get it started. Then you'll see the output: Running!

You'll find the topics:

Topic                   Type                Rate
/tf                     tf2_msgs/TFMessage  250Hz
/vive_left              sensor_msgs/Joy     On Event
/vive_right             sensor_msgs/Joy     On Event
/vive_left_vibration    std_msgs/Float64    Listening
/vive_right_vibration   std_msgs/Float64    Listening

The TF tree looks like (there is only one lighthouse because I only had one plugged in): tf_tree.png

The sensor_msgs/Joy topics are as:

header: 
  seq: 541
  stamp: 
    secs: 1508649347
    nsecs: 147578954
# which controller
  frame_id: left_controller
# Trigger, Trackpad X, Trackpad Y
axes: [0.0, 0.0, 0.0]
# Trigger, Trackpad touched, Trackpad pressed, Menu, Gripper
buttons: [0, 0, 0, 0, 0]

controllers.png

This image pertains to HTC from this user guide.

Note that the system button is unreadable. Pressing it will prevent the other keys from being read. Press it again to resume data transmission.

To ease interaction with the controllers you may use the ViveController class.

The vibration topics /vive_SIDE_vibration expect a std_msgs/Float64 with a value in between 0.0 and 1.0 representing the strength of the vibration. Every publication makes it vibrate shortly. If you want long vibrations you need to publish multiple times. Note that if you abuse it you may slow down the publication of TF.

You can find another launch file called vive_tf_joy_and_ps.launch which in addition provides two topics:

Topic                               Type                        Rate
/left_controller_as_posestamped     geometry_msgs/PoseStamped   30Hz
/right_controller_as_posestamped    geometry_msgs/PoseStamped   30Hz

Which are the poses of the controllers in reference to the headset, useful for teleoperation purposes. It uses scripts/frame_as_posestamped.py which is a commandline tool:

Usage:
./frame_as_posestamped.py frame_to_posestamped reference_frame [rate]

That takes a TF frame that you want published as a geometry_msgs/PoseStamped in reference to another frame, with whatever rate you want.

To run PR2 Teleop demo

TODO

sudo apt-get install libnlopt-dev
sudo apt-get install ros-kinetic-moveit-ros
sudo apt-get install swig

git clone https://bitbucket.org/awesomebytes/trac_ik
cd trac_ik
git checkout python_wrapper_swig_based

cd ../..
catkin_make

htc_vive_teleop_stuff's People

Contributors

awesomebytes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

htc_vive_teleop_stuff's Issues

Error when initializing OpenVR (try 1 / 4) recently

Hi,

I was successfully able to use your code roslaunch htc_vive_teleop_stuff vive_tf_joy_and_ps.launch few days back but today I am facing an issue all of a sudden.

Debug Trace

roslaunch htc_vive_teleop_stuff vive_tf_joy_and_ps.launch
... logging to /home/mingxi/.ros/log/cb7e0e44-3dd1-11ee-b267-f9a46231351c/roslaunch-mingxi-HHLab-4393.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/mingxi/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

started roslaunch server http://mingxi-HHLab:42233/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.16.0

NODES
  /
    left_controller_ps (htc_vive_teleop_stuff/frame_as_posestamped.py)
    right_controller_ps (htc_vive_teleop_stuff/frame_as_posestamped.py)
    vive_tf_and_joy (htc_vive_teleop_stuff/vive_tf_and_joy.py)

ROS_MASTER_URI=http://localhost:11311

process[vive_tf_and_joy-1]: started with pid [4407]
process[left_controller_ps-2]: started with pid [4408]
process[right_controller_ps-3]: started with pid [4409]
INFO: cannot create a symlink to latest log directory: [Errno 2] No such file or directory: '/home/mingxi/.ros/log/latest'
===========================
Initializing OpenVR...
Using vrcompositor capability proxy
Launching /home/mingxi/.steam/debian-installation/steamapps/common/SteamVR/bin/linux64/vrcompositor
Using breakpad crash handler
Setting breakpad minidump AppID = 250820
Forcing breakpad minidump interfaces to load
[WARN] [1692368184.053559]: Exception on transforming pose... trying again 
("hmd" passed to lookupTransform argument target_frame does not exist. )
[WARN] [1692368184.056203]: Exception on transforming pose... trying again 
("hmd" passed to lookupTransform argument target_frame does not exist. )
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
08/18 10:16:24 Init: Installing breakpad exception handler for appid(250820)/version(1.27.2)/tid(4423)
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

Error when initializing OpenVR (try 1 / 4)

I am trying to use HTC Vive Controller in headless mode by changing the below settings for SteamVR beta.

I have enabled the null driver

"driver_null": { "enable": true,

"steamvr": { "requireHmd": false, "forcedDriver": "null", "activateMultipleDrivers": true

Does anyone have any idea why is this occurring?

Update

I changed openvr.init(openvr.VRApplication_Scene) to openvr.init(openvr.VRApplication_Other) in vive_tf_and_joy.py on line # 182 and it worked surprisingly. But I don't know the reason as openvr.init(openvr.VRApplication_Scene) was working earlier.

Error when initializing OpenVR

@awesomebytes
Error when initializing OpenVR (try 1 / 4) VRInitError_Init_VRClientDLLNotFound (error number 102)

What does this entail? Do I need steamVR running?

Where does OpenVR need to be is there a specific openVR repo I need?

Topic to access for teleoperation (Baxter)

I am bit confused about accessing the topics.. So I know that /vive_left /vive_right are for the Joy messages. But for any teleoperation (like controlling Baxter using the Vive), would I also need to run frame_as_posestamped.py script to access /left_controller_as_posestamped and /right_controller_as_posestamped ?

It's just I am planning to also use the headset to control head movements of Baxter once I get the arm limbs working. So leaving the headset stationary as a reference frame is not ideal. Would you happen to know of a workaround? Like could it be possible to achieve teleoperation by accessing the normal /tf topic to access TFMessages (containing Pose & Quaternion)?

specific to HTV Vive ?

Hi,
Thank you for providing a ROS package to properly receive transform and state button.

Is it really specific to HTV Vive or any VR headset should work with your code ? (with minor modification)
I have seen that : "OpenVR is an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting. This repository is an SDK that contains the API and samples. The runtime is under SteamVR in Tools on Steam.".

Thanks in advance !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.