Create workspace:
mkdir -p mocap4r2_ws/src && cd mocap4r2_ws/src
Download optitrack repo:
git clone https://github.com/MOCAP4ROS2-Project/mocap4ros2_optitrack.git
Install dependencies:
rosdep install --from-paths src --ignore-src -r -y
vcs import < mocap4ros2_optitrack/dependency_repos.repos
Compiling workspace:
cd .. && colcon build --symlink-install
Source workspace:
source install/setup.bash
Setup your optitrack configuration:
mocap4r2_ws/src/mocap4ros2_optitrack/mocap4r2_optitrack_driver/config/mocap4r2_optitrack_driver_params.yaml
Launch optitrack system:
ros2 launch mocap4r2_optitrack_driver optitrack2.launch.py
Check that Optitrack configuration works fine and is connected. As the driver node is a lifecycle node, you should transition to activate:
ros2 lifecycle set /mocap4r2_optitrack_driver_node activate
Visualize in rViz:
ros2 launch mocap4r2_marker_viz mocap4r2_marker_viz.launch.py mocap4r2_system:=optitrack
Additional tasks(added by Sharfi:)
Open a new terminal & source your ros2
source /opt/ros/humble/setup.bash
check for the topic list
ros2 topic list
source the ros2 project in the new terminal
source install/setup.bash
To get the data from the desired topic( in our case it is the "/rigid_bodies" where we are getting all the positions and orientations)
ros2 topic echo /rigid_bodies