dasc-lab / ros2-vicon-bridge

2 stars 0 forks source link

ROS2 Vicon Bridge

Provides a simple ros2 vicon bridge, heavily inspired by https://github.com/ethz-asl/vicon_bridge

The Vicon SDK 1.12 source files are provided here so they can be compiled from source.

Only Linux is supported.

We provide two types of nodes. One uses the standard ViconSDK::Client (i.e., the ROS node publishes each frame that is received from the ViconSDK) or the ViconSDK::RetimingClient (i.e., it interpolates the vicon messages and publishes them at a fixed rate).

In our experience, the Client version is likely the better choice for most robotics applications, since it doesnt extrapolate data.

Installation

Install ros2 and ensure the following Boost libraries are available.

sudo apt-get install libboost-thread-dev libboost-date-time-dev

The source code of the ViconSDK has been copied from Vicon and provided in this repo, meaning it should be able to build for both x86 and aarch64 systems, and possibly others.

You also need to grab the diagnostic-updater package:

sudo apt-get install ros-${ROS_DISTRO}-diagnostic-updater

From your colcon_ws run

colcon build --symlink-install

Usage of the standard client (recommended)

Edit ./launch/all_segments.launch.py and set the IP address of the Vicon computer correctly. Then launch it through

ros2 launch vicon_bridge all_segments.launch.py

Alternatively, you can also run just the node:

ros2 run vicon_bridge vicon_bridge --ros-args ...

and in the /tf topic you will see the transform being published. Each tf that is published is in the form of <tf_namespace>/<subject_name>/<segment_name> where subject and segment names are usually the same. By default tf_namespace=vicon.

It will also publish a topic /<tf_namespace>/<subject_name>/<segment_name> for each segment in the vicon datastream. This topic is a geometry_msgs::msg::TransformStamped message, and the header.stamp is the timestamp corrected for latency, as reported by VICON.

You need to set a bunch of parameters:

Parameters

Example:

ros2 run vicon_bridge vicon_bridge --ros-args -p host_name:="192.168.2.136:801"

It also prints to the console the number of times it missed an update, and failed to publish a message. Every second, it also publishes the latency of the last message.

Usage of the retiming client

ros2 run vicon_bridge vicon_bridge_retiming --ros-args ...

and in the /tf topic you will see the transform being published. Each tf that is published is in the form of <tf_namespace>/<subject_name>/<segment_name> where subject and segment names are usually the same. By default tf_namespace=vicon.

You need to set a bunch of parameters:

Parameters

Example:

ros2 run vicon_bridge vicon_bridge_retiming --ros-args -p host_name:="192.168.2.136:801" -p max_prediction_ms:=25 -p --update_rate_hz:=100.0

It also prints to the console the number of times it missed an update, and failed to publish a message.