OptiTrack

From VeRLab Wiki
Revision as of 10:30, 19 October 2018 by Rezeck (talk | contribs) (Configuring Tracking Tools)
Jump to: navigation, search

OptiTrack

TODO: Importar documentação


Tutorial OptiTrack ROS

This is an updated tutorial from the original ros wiki for OptiTrack.

Streaming of OptiTrack mocap data to tf ROS.

This package contains a node that translates motion capture data from an OptiTrack rig to tf transforms, poses and 2D poses. The node receives packets that are streamed by the Tracking Tools software, decodes them and broadcasts the poses of configured rigid bodies as tf transforms, poses, and/or 2D poses.

Currently, this node supports the NatNet streaming protocol v2.2

Installation

The easiest way to get the mocap_optitrack package in Ubuntu:

$ git clone https://github.com/ros-drivers/mocap_optitrack.git
$ git checkout new-and-old-support-updated # use this branch, I tested the with commit 7723217 and it does not work
$ cd ..
$ catkin_make

To install Tracking Tools, see the instructions on the Natural Point website.


Configuring Tracking Tools

After installing Tracking Tools you will need to configure it for streaming of rigid bodies to the machine running the mocap_optitrack ROS node.


  1. Open the Streaming Properties pane in Tracking Tools and enable the Broadcast Frame Data checkbox. Set the Stream Rigid Bodies option to True if it's not set already.
  2. Set Type to Multicast, the ports should be left as-is.
  3. Unless the machine running Tracking Tools has multiple network interfaces, the Local Interface may be set as Preferred. The Multicast Interface should be set to the address in the range

224.0.0.0 through 239.255.255.255. I used 230.0.0.1 (use the same in mocap.yaml on ROS), with command port in 1510 and data port in 1511.


Enable Linux multicast

For all computers, first check if the multicast feature is enabled using the following command.

cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

If this command returns 0, the multicast feature is enabled and you can go ahead to the next section. To temporary enable the multicast feature, execute the following command, however, when the computer restarts, this configuration will be lost.

sudo sh -c "echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts"

To permanently enable the multicast feature, edit the /etc/sysctl.conf file and add the following line, or uncomment it, if it already exists, and change its default value.

net.ipv4.icmp_echo_ignore_broadcasts=0

In order for the changes to take effect, execute the following command:

sudo service procps restart

To check which multicast groups are already defined in a computer, execute the following command.

netstat -g

This command will report all the IP addresses enabled for multicast for each of the network interfaces available, both for IPv4 and IPv6. The standard IP address for multicast is 224.0.0.1, that should appear on the list provided by the last command, and it is the one we will use.

At this point, to check whether the multicast feature is working or not, execute the following command, at any computer.

ping 224.0.0.1

If everything is configured properly, you should get a reply from each computer in the common network at each iteration.

Configuring mocap_optitrack

Once motion capture data is being streamed to the mocap_optitrack node, the mapping of trackables to ROS topics must be defined. A sample configuration file called "mocap.yaml" is included with the package, you can find it in the config directory of the package.

$ roscd mocap_optitrack/config
$ nano mocap.yaml