当前位置:   article > 正文

Ubuntu 20.04(双系统)+ 机器人开发环境搭建 速通教程,长期更新_双系统里安装robotware stdio

双系统里安装robotware stdio

前言

该教程适用于经常需要装环境的同学,下面的安装过程都经过笔者验证,追求的是尽可能快速的安装体验。如果存在疏漏/错误请在评论区指出,我会尽快更新。

Windows+Ubuntu20.04双系统

双系统教程:很经典的双系统教程,笔者经常参考这个教程装双系统,唯一美中不足的是在硬盘划分这一步没有详细说明。
硬盘分区选项:给出了参考的硬盘划分方式。

换软件源

ubuntu20.04换源,只保留清华源就行。

安装中文输入法

推荐安装google中文输入法,搜狗输入法可能无法正常安装。
如果不小心安装了搜狗输入法且无法正常使用,使用sudo apt-get purge sogoupinyin卸载,完全卸载参考

设置root密码

设置root密码:sudo passwd root,以便在必要时可以使用su

常用办公软件安装

安装C++开发环境

参考链接:git代理配置、安装gcc/g++/makecmakeQT5

#>>>>> git >>>>>
sudo apt-get install git
# 配置git代理(如果能科学上网的话)
# git config --global http.proxy http://127.0.0.1:xxxx
# git config --global https.proxy http://127.0.0.1:xxxx

#>>>>> gcc,g++,make >>>>>
sudo apt-get install build-essential

#>>>>> cmake >>>>>
==> TODO: 先上https://cmake.org/download/找安装包,解压到home
==> TODO: cd到cmake解压得到的文件夹内
==> 或者把cmake-3.30.0-rc3-linux-x86_64.sh下载到home,然后直接执行也行
sudo apt-get install libssl-dev
./bootstrap
make
sudo make install

#>>>>> QT5 >>>>>
# 在完成以上安装步骤后,继续执行下面的指令
sudo apt-get install clang
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
sudo apt-get install qtcreator
sudo apt-get install qt5*
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

安装Python开发环境

参考链接:安装anaconda+conda换源+pip换源、创建Py37环境、装错版本时卸载anaconda

#>>>>> anaconda >>>>>
==> TODO: 在清华源下载安装脚本https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
# 注意当前最新版本其实是Anaconda3-2022.10-Linux-x86_64.sh,旧版可能无法正常使用
bash ~/Downloads/Anaconda3-2022.10-Linux-x86_64.sh

#>>>>> conda换源 >>>>>
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --set show_channel_urls yes

#>>>>> pip换源 >>>>>
gedit ~/.pip/pip.conf
==> TODO: 写入下面的内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

#>>>>> 创建Py37环境,等待时间较长 >>>>>
conda create -n Py37 python=3.7
conda active Py37
pip install numpy scipy matplotlib pandas seaborn PyQt5 PyQt5-tools
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

安装JetBrains全家桶

安装CLion(需付费)、PyCharm

安装ROS Noetic、MAVROS

参考链接:安装ROS noeticmavros
完成ROS安装后,在Pycharm中导入rospy

#>>>>> ROS neotic >>>>>
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt install ros-noetic-desktop-full
# 方便国内下载
sudo apt-get install python3-pip
sudo pip3 install 6-rosdep
sudo 6-rosdep
sudo rosdep init
rosdep update
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
conda activate Py37
sudo apt-get install python3-rosinstall python3-rosinstall-generator python3-wstool
# 验证ros是否安装成功
roscore

#>>>>> mavros >>>>>
cd ~
sudo apt-get update
sudo apt-get upgrade
sudo apt install ros-noetic-mavros ros-noetic-mavros-extras
wget https://ghproxy.com/https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
sudo chmod a+x ./install_geographiclib_datasets.sh
# 这一步可能要执行很久,可以参考https://gitee.com/MrZhaosx/geographic-lib进行加速
sudo ./install_geographiclib_datasets.sh
# 验证mavros是否安装成功
roscd mavros
cd ~
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

安装PX4、QGC、MAVSDK

参考链接:PX4QGCmavsdk-pythonmavsdk-c++
刚下载好的PX4-Autopilot文件夹,未编译版:PX4-Autopilot-no-compiled-20221121

#>>>>> PX4 >>>>>
# 如果有条件科学上网,可以尝试官方提供的下载方式;如果无法科学上网,建议直接下载其他人下载好的包,效果是一样的
# 科学上网时注意正确配置:
# git config --global http.proxy http://127.0.0.1:xxxx
# git config --global https.proxy http://127.0.0.1:xxxx

# 下面展示的是希望在v1.13.1版本下进行PX4开发时的配置方法
###### 方法一:从github下载代码并下载所需的子模块 ######
cd ~
# 递归下载所有子模块(去掉--recursive不影响正确性,只是笔者是这么执行的)
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot
# 切换到v1.13.1,同时创建分支dev_1_13_1
git checkout -b dev_1_13_1 v1.13.1
# 下载v1.13.1需要的所有子模块
git submodule sync --recursive
git submodule update --init --recursive
# 保存当前修改
git add .
git commit -m "准备编译"
git checkout main
###### 方法二:直接下载百度网盘中的压缩文件 ######
# 压缩文件解压后就是执行上述指令的结果
cd PX4-Autopilot
bash ./Tools/setup/ubuntu.sh
git checkout v1.13.1
# 应当编译成功
make px4_sitl_default gazebo

###### 切换到其他指定版本的参考步骤 ######
git clone https://github.com/PX4/PX4-Autopilot.git
git checkout -b dev_1_13_1 v1.13.1
# 如果是已经编译过的文件,需要make clean才能编译
make clean
git submodule sync --recursive
git submodule update --init --recursive
make px4_sitl_default gazebo

#>>>>> QGC >>>>>
# 参考https://docs.qgroundcontrol.com/master/zh/qgc-user-guide/getting_started/download_and_install.html
cd ~
sudo usermod -a -G dialout $USER
sudo apt-get remove modemmanager -y
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
sudo apt install libqt5gui5 -y
sudo apt install libfuse2 -y
wget https://d176tv9ibo4jno.cloudfront.net/latest/QGroundControl.AppImage
chmod +x ./QGroundControl.AppImage

#>>>>> MAVSDK-Python >>>>>
conda activate Py37
pip3 install mavsdk

#>>>>> MAVSDK-C++ >>>>>
cd ~/Downloads
wget https://github.com/mavlink/MAVSDK/releases/download/v1.4.8/libmavsdk-dev_1.4.8_ubuntu20.04_amd64.deb
sudo dpkg -i libmavsdk-dev_1.4.8_ubuntu20.04_amd64.deb
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

检查是否安装成功

能正确执行MAVROS例程,视为安装成功。

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号