Using Own ROS2 Interface
Introduction
In the previous section, we learned how to use ROS2's mavros
interfaces to communicate with the system.
However, sometimes, we may need to create our own interfaces to communicate with the system.
This section will guide you through creating your own ROS2 interface by analyzing a custom rosmav
interface.
Prerequisites
First, let's clone the rosmav
repository and install the necessary dependencies.
cd ~/auvc_ws/src
git clone https://github.com/blksail-edu/rosmav
cd ~/auvc_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --packages-select rosmav --symlink-install
source ~/auvc_ws/install/setup.zsh
If there are updates in the rosmav
repository, you can update the repository by running the following command:
cd ~/auvc_ws/src/rosmav
git pull
Testing the Interface
After building the rosmav
package, we can test the interface by running the following command:
ros2 run rosmav ros_bluerov2_interface
If the command runs successfully, you should see the following output:
[INFO] [1721669754.194733875] [ros_bluerov2_interface]: Heartbeat from system 1, component 0
The output may vary depending on the system ID and component ID. Nothing will be displayed if the system is not connected (to the real robot or simulator).