Remapping Pose Data to PX4

This page gives details on how to remap the streamed Clover pose data to the PX4 for localization and control.

MAVROS provides a plugin to relay pose data published on /mavros/vision_pose/pose to PX4. Assuming that MAVROS is running, you just need to remap the pose topic that you get from the MoCap /vrpn_client_node/clover1/pose directly to /mavros/vision_pose/pose. The Clover packages already have a MAVROS launch file setup to connect the raspberry Pi to the flight controller using MAVROS.

The method presented involves using an application called topic_tools and is discussed further.

Topic Tools

The method of choice gives you the ability to turn the remap function on and off after launch. This functionality is useful because it allows you to view the /vrpn_client_node/clover1/pose topic and /mavros/vision_pose/pose topic separately in RViz to ensure the yaw offset is minimal before remapping and fusing the external vision pose and onboard pose estimation. A ROS package called topic_tools can be used to remap the topic where the package source can be found in its github here. The steps to build from source for ROS Noetic are shown:

cd /path/to/your/catkin_ws/src
git clone -b melodic-devel
cd /path/to/your/catkin_ws
rosdep update
rosdep install --from-paths src/ --ignore-src --rosdistro noetic

The following command can now be run on the Ubuntu Linux machine to remap the topic:

rosrun topic_tools relay /vrpn_client_node/clover1/pose /mavros/vision_pose/pose

All the reference frame configurations earlier were done to make sure the pose data was published on the ENU frame as ROS uses ENU frame by convention. With the remapping of the published topic to vision_pose topic, MAVROS will take care of the NED frame conversions and you don't have to manually do so.

topic_tools also provides another useful function named throttle. This allows you to adjust the bandwidth and message rate at whih the messages are being published or reemaped to a certain topic. I played around with this when I was debugging data fusion and timesync issues with MAVROS and the Clover.

Additional considerations

Another consideration when remapping the vrpn topic to the mavros vision topic is listed below, which involves coding a remap command into the sample.launch file.

From the description remap, the following command can be coded in vrpn launch file or sample.launch file to remap the vrpn topic to the vision_pose topic (assuming a rigid body name of clover1):

<remap from="/vrpn_client_node/clover1/pose" to="/mavros/vision_pose/pose"/>

Remapping applies to the lines following the remap. Nodes that are launched before any remap lines are not affected therefore insert the remap command before the vrpn_client_ros node in the sample.launch file.

Last updated