Skip to main content

(Ⅰ) VRPN Protocol Method

ROS version: noetic, Ubuntu version: 20.04.

Ⅰ. VRPN Download and Installation

  1. Enter "sudo apt search vrpn" in the Ubuntu terminal to query the VRPN version that can be installed for the current Ubuntu version.
查询vrpn版本

Query VRPN Version

  1. If the package manager can find the corresponding VRPN version, enter the following command in the terminal to install the VRPN library. In this example, the installed ROS version is noetic, and ros-noetic-vrpn is used.
sudo apt install ros-noetic-vrpn
apt 安装

apt Installation

  1. If the package manager does not find the corresponding VRPN version, use the following commands to download the source code and install the VRPN library. This operation is applicable to different ROS versions.
git clone --recurse-submodules https://github.com/vrpn/vrpn.git
# build and install
cd vrpn/
mkdir build
cd build
cmake ../
sudo make install
git clone

git clone

cmake build

cmake build

图片5 (2)
  1. Save the quatlibConfig.cmake file and VRPNConfig.cmake in the corresponding folder, and use the following commands to create the corresponding directory (replace "noetic" according to the installed ROS version).

quatlibConfig.cmake

VRPNConfig.cmake

sudo mkdir -p /opt/ros/noetic/share/vrpn/cmake/
sudo mkdir -p /opt/ros/noetic/share/quatlib/cmake/
创建文件夹

Create Folder

图片6 (2)
图片7 (2)

Ⅱ. vrpn_client_ros Download, Installation and Network Configuration

There are two installation methods: software source installation and source code compilation.

(Ⅰ) Software Source Installation

  1. First install the relevant dependencies.
# First install the dependencies
sudo apt install -y
ros-noetic-geometry-msgs
ros-noetic-tf2-ros
ros-noetic-roscpp
ros-noetic-roslaunch
ros-noetic-roslint
安装依赖

Install Dependencies

  1. If apt can find the corresponding vrpn-client-ros, directly use the following command to install. In this example, the installed ROS version is noetic, and ros-noetic-vrpn-client-ros is used.
sudo apt install ros-noetic-vrpn-client-ros
安装 ros-noetic-vrpn-client-ros

Install ros-noetic-vrpn-client-ros

  1. Run the following commands in sequence to compile and install vrpn_client_ros. This operation is applicable to different ROS versions. First install
# git clone vrpn_client_ros
mkdir -p ~/catkin_vr/src
cd ~/catkin_vr/src/
git clone https://github.com/ros-drivers/vrpn_client_ros
cd ~/catkin_vr/catkin_make
catkin_make

catkin_make

(Ⅱ) Source Code Installation

  1. Use the following code to create a catkin workspace, pull the source code and compile
# clone vrpn_client_ros
mkdir -p ~/catkin_vr/src
cd ~/catkin_vr/src/
git clone https://github.com/ros-drivers/vrpn_client_ros
# catkin_make
cd ~/catkin_vr/
catkin_make
catkin_make

catkin_make

  1. Use the following commands to configure the environment and load the environment in this terminal. (Skip this step if using apt to install vrpn_client_ros)
source ~/catkin_vr/devel/setup.bash
echo 'source ~/catkin_vr/devel/setup.bash' >> ~/.bashrc
写入bashrc

Write to bashrc

Ⅲ. Test Network

  1. When starting vrpn_client-ros, note that the IP address setting must be correct, and it must be on the same network segment as the XINGYING software host and able to ping. Please close the computer's firewall. Refer to the following commands, and replace the network card name with the local network card.
ifconfig ens33
sudo ufw disable
ping -c 4 10.1.1.198
检查网络配置

Check Network Configuration

Ⅳ. Run vrpn_client_ros Node

  1. Enter the following command: "roslaunch vrpn_client_ros sample.launch server:=10.1.1.198" and press Enter. If the three lines "Connection established", "Found new sender: Tracker2", and "Creating new tracker Tracker2" are printed, it means the connection is successful. "Tracker2" represents the name of the Markerset in XINGYING software.
roslaunch vrpn_client_ros sample.launch server:=10.1.1.198
运行vrpn_client_ros节点

Run vrpn_client_ros Node

  1. Use CTRL+ALT+T to open a new terminal and view topic topics. Enter the command "rostopic list" to see the topic "/vrpn_client_node/Tracker2/pose". "Tracker2" represents the name of the Markerset in XINGYING software.
rostopic list
ros话题列表

ROS Topic List

  1. Enter the command "rostopic echo /vrpn_client_node/Tracker2/pose" and press Enter to see the received data. "Tracker2" represents the name of the Markerset in XINGYING software.
rostopic echo /vrpn_client_node/Tracker2/pose
打印Tracker2/pose话题

Print Tracker2/pose Topic