mavros安装

官方地址:

https://github.com/mavlink/mavros

 因为github有时侯不好上,所以我自己弄了个gitee

https://gitee.com/qq408007026/mavros/tree/master

installation 的官方源码安装步骤为

sudo apt-get install python-catkin-tools python-rosinstall-generator -y
# For Noetic use that:
# sudo apt install python3-catkin-tools python3-rosinstall-generator python3-osrf-pycommon -y

# 1. Create the workspace: unneeded if you already has workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
wstool init src

# 2. Install MAVLink
#    we use the Kinetic reference for all ROS distros as it's not distro-specific and up to date
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall

# 3. Install MAVROS: get source (upstream - released)
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
# alternative: latest source
# rosinstall_generator --upstream-development mavros | tee -a /tmp/mavros.rosinstall
# For fetching all the dependencies into your catkin_ws, just add '--deps' to the above scripts
# ex: rosinstall_generator --upstream mavros --deps | tee -a /tmp/mavros.rosinstall

# 4. Create workspace & deps
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4
rosdep install --from-paths src --ignore-src -y

# 5. Install GeographicLib datasets:
./src/mavros/mavros/scripts/install_geographiclib_datasets.sh

# 6. Build source
catkin build

# 7. Make sure that you use setup.bash or setup.zsh from workspace.
#    Else rosrun can't find nodes from this workspace.
source devel/setup.bash

 就仿照示例,先建立一个工作区,把代码放进去

mkdir -p ~/work/mav_connection/src
cd ~/work/mav_connection/src
git clone https://gitee.com/qq408007026/mavros
cd ..
catkin init

报错 bash: catkin: command not found 

装一下catkin 

sudo apt-get install python-catkin-tools
wstool init src
rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall

如果报错ssl.SSLError: ('The read operation timed out',)就多尝试几次就OK了。  

wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4

 wstool update -t src -j4这句话一直报[mavlink,mavros] still active

解决mavros源码安装过程中wstool update -t src -j4报错(网络限制)问题_little han的博客-CSDN博客

找到src目录下.rosinstall文件 将原来的东西更换为

# THIS IS AN AUTOGENERATED FILE, LAST GENERATED USING wstool ON 2022-06-30
- git:
    local-name: mavlink
    uri: https://gitclone.com/github.com/mavlink/mavlink-gbp-release.git
    version: release/melodic/mavlink/2022.3.3-1
- git:
    local-name: mavros
    uri: https://gitclone.com/github.com/mavlink/mavros.git
    version: 1.13.0

 即可

rosdep install --from-paths src --ignore-src -y
sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh
catkin build

 编译到mavros报错c++: internal compiler error: Segmentation fault (program cc1plus)

解决方法:

1.重新安装系统

2.Ubuntu18编译卡壳, c++: internal compiler error: Segmentation fault (program cc1plus) · Issue #56 · RoboMaster/RoboRTS · GitHub

 sudo vim /etc/security/limits.conf

修改为

nvidia hard stack 10240
nvidia soft stack 10240
ubuntu hard stack 10240
ubuntu soft stack 10240
root hard stack 10240
root soft stack 10240

重启电脑

编译完事 

source devel/setup.bash

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值