目录
安装ROS
方法二
安装GeographicLib
最后编译
PX4测试
【ROS】多机协同+ROS安装使用
【无人机】APM、PX4框架
安装mavros
sudo apt-get install ros-kinetic-mavros ros-kinetic-mavros-extras
一直安装失败,不建议这样安装。
error!!!!
E: 无法定位软件包 ros-kinetic-mavros
安装依赖
sudo apt install -y python-pip
pip install \
pandas \
jinja2 \
pyserial \
cerberus \
pyulog \
numpy \
toml \
pyquaternion
sudo apt install -y \
ninja-build \
exiftool \
python-argparse \
python-empy \
python-toml \
python-numpy \
python-yaml \
python-dev \
python-pip \
ninja-build \
protobuf-compiler \
libeigen3-dev \
genromfs
# install ros-gazebo plugins
sudo apt install ros-kinetic-gazebo-*
sudo apt-get install python-catkin-tools python-rosinstall-generator -y
为mavros创建一个工作空间
mkdir -p ~/mavros_ws/src
cd ~/mavros_ws
初始化 mavros工作空间
catkin init
wstool init src
安装mavlink
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
安装mavros
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
rosinstall_generator --upstream-development mavros | tee -a /tmp/mavros.rosinstall
补全以上依赖
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j8
结束,完成。
继续!!!!
rosdep install --from-paths src --ignore-src -y
超级慢!!!!!
sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh
catkin build
如果遇见错误:c++: internal compiler error
需要增加虚拟机内存。
超级慢!!!!!
添加环境变量
echo "source ~/mavros_ws/devel/setup.bash" >> ~/.bashrc
sudo apt-get install python-jinja2
cd mavros_ws/src/
git clone https://github.com/PX4/Firmware.git
cd Firmware
sudo git submodule update --init --recursive
make posix_sitl_default gazebo
耐心等待,需要时间。。。
如遇错误,多试几次。。。
这个错误是网速引起的,建议在凌晨试一试。
sudo vi ~/.bashrc
#修改环境变量
# in the new terminal, scroll down to the bottom and add the following lines to the bottom
source ~/mavros_ws/devel/setup.bash
source ~/mavros_ws/src/Firmware/Tools/setup_gazebo.bash ~/mavros_ws/src/Firmware/ ~/mavros_ws/src/Firmware/build/posix_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/mavros_ws/src/Firmware
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/mavros_ws/src/Firmware/Tools/sitl_gazebo
export SVGA_VGPU10=0
source ~/.bashrc
关闭虚拟机3D(备选)
需要内存大!!!!!!!!!!!
可能仍会存在问题,可以和我私信,获取我的镜像。
roslaunch px4 mavros_posix_sitl.launch
rostopic echo /mavros/state