OptiTrack Interface to ROS
Intro
This tutorial will show you how to get OptiTrack information (position and orientation) of a rigid body that is defined in Motive (motion capture software) to a ROS node. This allows you to get localization data on your robot in an indoor environment.
Required Hardware
- Optitrack system
- WiFi router (5Ghz recommended)
- A linux computer e.g. normal PC or onboard embedded computer like ODROID XU4. This will be connected to the router either via ethernet cable or WiFi connection.
Required Software
Motive. This is the motion capture software that runs on the mocap machine. It allows you to calibrate your optitrack system, stream tracking information to external entities.
ROS Kinetic installed on your Linux computer. If you will use ODROID XU4, flash it with Ubuntu 16 and ROS Kinetic. Ready Ubuntu images with ROS Kinetic for your eyes are available. (ubuntu16_minimal_image, full_ubuntu16)
You can use Etcher to flash your ODROID eMMC card with your ubuntu .img
file.
- Install mocap ROS package (works with Optitrack and VICON) to receive the tracking data from your mocap system. The package page is called vrpn_client_ros.
To install the package use the following command (assuming ROS Kinetic). If you are using the minimal Ubuntu image provided above, you don't need to install this package as it's already included
sudo apt-get install ros-kinetic-vrpn-client-ros -y
Streaming MOCAP Data
Now, you should be set to get data from mocap to your ROS.
- Make sure that you installed
vrpn_client_ros
package all required packages are already included in the minimal ubuntu image referenced above - If you are streaming data to an ODROID which is connected to a flight controller, make sure that you have mavros installed. See next tutorial to know how feed mocap data to Pixhawk that is connected to ODROID.
- Make sure that you configured your Motive as mentioned above
- Connect the PC that runs Motive to your router with an ethernet cable
- Note down the IP address given to the Motive PC, let's call it motive_ip
- Create a rigid body in Motive and give it a proper name e.g. uav1If your rigid body has white spaces in its name e.g. 'robot 1', the ROS mocap node will not receive it and will give errors
- In your ROS machine, where you want to get tracking data, run the vrpn_client_ros node as follows
roslaunch vrpn_client_ros sample.launch server:=<motive_ip>
- Now you should be able to receive mocap data under topics that look like
/vrpn_client_node/<rigid_body_name>/pose