0 background
Ubuntu20.04 dual system
ROS Noetic
Mavros is essentially a function package of ROS. Because the author needs to carry out secondary development on it, I chose to install it from the source code.
Reference: Official repository link , official installation document
1 installation steps
First, make sure you have catkin related tools installed
# for noetic
sudo apt install python3-catkin-tools python3-rosinstall-generator python3-osrf-pycommon -y
or
# for version before noetic
sudo apt-get install python-catkin-tools python-rosinstall-generator -y
1.1 Create a workspace (or select an existing workspace)
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
wstool init src
1.2 Configure mavlink download information
mavlink is applicable to all ROS versions, just use the following command:
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
At this point, there should be no other content except a text file in the src directory of the workspace.
1.3 Configure mavros download information
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
At this point, there is still no content except a text file in the src directory of the workspace. This is normal.
1.4 Official installation
wstool merge -t src /tmp/mavros.rosinstall
This time there will be one more text file
wstool update -t src -j4
This command is the official download command. An error may occur during the process due to network speed issues. Just run it a few times.
If the download is successful,
the src directory of the workspace will appear as follows:
Run
rosdep install --from-paths src --ignore-src -y
I don’t understand.
Run the command:
./src/mavros/mavros/scripts/install_geographiclib_datasets.sh
After installation, searching in the root directory geographiclib
will yield the following results:
1.5 Compilation
catkin build
It may take a while to compile for the first time
and then you can use the source.
source ./devel/setup.bash