This ROS2 package enables VICON motion capture data streaming for use with PX4 visual odometry. It connects to a VICON server, retrieves motion capture data, and publishes it to a ROS2 topic. The data is then remapped to a format compatible with PX4, making it suitable for drone control via visual odometry.
The provided launch file performs the following operations:
- Streams motion capture data from a VICON system using the
mocap_vicon_client
package. - Remaps and publishes the data to a PX4-compatible topic using the
mocap_to_px4
package.
- Vicon DataStream SDK
- mocap_vicon_client
- px4_msgs (a fork known to be compatible at the time of development)
Make sure you have ROS2 installed on your system. This package is tested on Ubuntu 22.04 and ROS2 Humble. You can follow the installation guide here.
To install the Vicon DataStream SDK, run the following command:
wget -qO- https://github.com/atarbabgei/miscellaneous/raw/main/mocap_vicon/scripts/install_vicon_datastream_sdk.sh | sudo bash
Ensure that the necessary dependencies are installed.
sudo apt update
sudo apt install libboost-all-dev python3-colcon-common-extensions cmake
To set up the required packages, clone the repositories into your ROS2 workspace and build them:
cd ~/your_workspace/src
# Clone the mocap VICON client package
git clone https://github.com/atarbabgei/mocap_vicon_client.git
# Clone the forked PX4 message definitions
git clone https://github.com/atarbabgei/px4_msgs.git
# Clone the mocap-to-PX4 remapping package
git clone https://github.com/atarbabgei/mocap_to_px4.git
# Build the workspace
cd ~/your_workspace
colcon build
# Source the workspace
source install/setup.bash
To launch the VICON data streaming system with the default parameters:
ros2 launch mocap_to_px4 mocap_to_px4.launch.py server:=192.168.0.100 uav_topic:='/mocap/drone/drone'
The launch file provides several configurable parameters for flexibility:
server
: IP address of the VICON server (default:192.168.0.100
).buffer_size
: Buffer size for the VICON client (default:256
).topic_namespace
: Namespace for the published VICON topics (default:mocap
).uav_topic
: ROS topic for UAV motion capture data (default:/mocap/drone/drone
).px4_visual_odometry_topic
: PX4 topic for publishing visual odometry data (default:/fmu/in/vehicle_visual_odometry
).
-
VICON Streaming Node:
- Package:
mocap_vicon_client
- Executable:
vicon_client
- Description: Streams motion capture data from the VICON server and publishes it to ROS topics.
- Package:
-
PX4 Remapping Node:
- Package:
mocap_to_px4
- Executable:
mocap_remap_to_px4
- Description: Remaps motion capture data and publishes it in a format compatible with PX4 visual odometry.
- Package: