This vive_ros2
package provides a ROS2 interface to the HTC VIVE controllers. Due to compatibility issues between the OpenVR library and ROS2, this package utilizes socket programming to enable data transfer between two standalone programs running under ROS2 on Ubuntu.
vive-robot-arm-control.mp4
- Install the latest version of Steam from Steam Store.
- Install SteamVR in the Steam application.
cd ~
mkdir libraries && cd libraries
git clone https://github.com/ValveSoftware/openvr.git -b v2.5.1
cd openvr
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ../
make
- Follow the official VIVE Pro Setup Guide to setup the lighthouse, headset, controller, etc.
- Plug in the VIVE and set the permission as below:
sudo chmod +rw /dev/hidraw*
- You are ready to use the VIVE.
(OPTIONAL) Build the sample code to test the VIVE setup.
cd ~/libraries/openvr/samples
mkdir build && cd build
cmake .. -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/opt/Qt/5.6/gcc_64/lib/cmake -DCMAKE_BUILD_TYPE=Release
Run the demo code as follows:
# copy the texture files to the bin folder
cd ~
cp libraries/openvr/samples/bin/cube_texture.png libraries/openvr/samples/bin/hellovr_* build
# Run demo code
~/.steam/steam/ubuntu12_32/steam-runtime/run.sh ~/vive_ws/libraries/openvr/samples/bin/linux64/hellovr_opengl
- Clone the repository.
# here I use ~/vive_ws as the ROS2 workspace, you can change it to your own workspace mkdir -p ~/vive_ws/src && cd ~/vive_ws/src git clone https://github.com/iltlo/vive_ros2.git
- Build the package.
cd ~/vive_ws colcon build --packages-select vive_ros2 source install/setup.bash
- Set the environment variables.
# for bash shell echo "source ~/vive_ws/src/vive_ros2/scripts/set_vr_env.sh" >> ~/.bashrc source ~/.bashrc
# for zsh shell echo "source ~/vive_ws/src/vive_ros2/scripts/set_vr_env.sh" >> ~/.zshrc source ~/.zshrc
- Start SteamVR.
$STEAMVR/bin/linux64/vrserver --keepalive
- Run the package.
# Terminal 1: ros2 run vive_ros2 vive_input # Terminal 2: ros2 run vive_ros2 vive_node
Using VIVE Pro controller to control a WidowX-250-S robot arm in ROS2 (using absolute pose).
Visualizing the absolute and relative poses of the controller on RViz.
- Obtain absolute pose data of controller
- Implement the server client model
- Haptic feedback to enhance user experience
- Solve relative transformations
- Add bounding conditions
- Refactor code to improve readability
- Optimize performance
- Server-client 2-way communication
- Ubuntu 22.04
- ROS2 Humble
- OpenVR SDK v2.5.1
- HTC VIVE Pro