记录PX4 安装全过程
系统环境:
- Ubuntu18.04.5 LTS x86_64
- Kernel: 5.4.0-80-generic
- ROS melodic 1.14.11
硬件:
- NUC8 i7-8650U & NUC10 i7-10710U
- 镭神激光雷达 C16 / Velodyne VPL-16
- Xsens Mti-300
- 路由器: AR750S
- 飞控: PX4
官方文档:
构建px4_ws
问题:
- -
最好需要一台新的Ubuntu18.04环境, 里面不配置任何东西. 换个源就够
脚本: sources-tools.sh
大概过程: ubuntu.sh
-> ubuntu_sim_ros_melodic.sh
-> PX4-Autopilot.git
运行前需要切换python3版本, 查看方式 python -V
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
顺便更新一下pip (虚拟机安装过程中发现问题)
sudo python -m pip install --upgrade --force pip
来源: https://docs.px4.io/master/en/dev_setup/dev_env_linux_ubuntu.html
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
# Run the ubuntu.sh with no arguments (in a bash shell) to install everything
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
# 安装后要重启
sudo reboot
wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_ros_melodic.sh
bash ubuntu_sim_ros_melodic.sh
不出意外的话这里步骤会把 PX4-Autopilot的ROS 工作空间编译通过
进入PX4源码目录,编译
cd ~/PX4-Autopilot [tab]
# Jmavsim
make px4_sitl jmavsim
# Gazebo
make px4_sitl gazebo
进入PX4源码目录,测试roslaunch
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd):$(pwd)/Tools/sitl_gazebo
roslaunch px4 multi_uav_mavros_sitl.launch
来源: https://docs.px4.io/master/en/ros/mavros_installation.html
sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
sudo bash ./install_geographiclib_datasets.sh
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws
catkin init
wstool init src
1.Install MAVLink: 已经修改成 melodic
rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
2.MAVROS Released/stable
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
3.Create workspace & deps
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4
rosdep install --from-paths src --ignore-src -y
4.GeographicLib datasets
./src/mavros/mavros/scripts/install_geographiclib_datasets.sh
5.Build source
catkin build
6.setup.bash
source devel/setup.bash
测试
#Error: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r0armvum/pymavlink/
解决方法:
sudo python -m pip install --upgrade --force pip
来源:
Github: librealsense
ROS: realsense-ros
Github: velodyne
ROS wiki: Getting Started with the Velodyne VLP16
Github: lslidar_c16
博客: 镭神激光雷达官方驱动安装适配
Official website: Spatial
ROS wiki: advanced_navigation_driver