ubuntu20.4安装配置ros系统(noetic)
  ls5g79zBZM03 2023年11月01日 103 0
不同ubuntu版本对应的ros版本
ubuntu版本 ros1版本 ros2版本
16.04 kinetic ardent
18.04 melodic dashing
20.04 noetic foxy

 

1、打开软件与更新,切换ubuntu软件源(国内中科大源)

2、打开终端,添加ros软件源(中科大镜像站)

 
  
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' 
 
  

3、配置公钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 

 

4、更新软件源

sudo apt update 
sudo apt upgrade 

 

5、安装ros系统(ps:命令中的noetic根据自己的ros版本名更换)

sudo apt install ros-noetic-desktop-full 

 

6、初始化rosdep

sudo apt install python3-rosdep2 
sudo gedit /etc/hosts 

 

在打开文件中添加下面这一条内容保存后关闭

199.232.28.133 raw.githubusercontent.com 

 

sudo rosdep init 

 

7、更新rosdep

rosdep update 

 

8、设置环境变量(ps:命令中的noetic根据自己的ros版本名更换)

sudo echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc 

 

9、使环境变量生效

source ~/.bashrc 

 

10、安装依赖

sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool build-essential 

 

 11、安装roslaunch

sudo apt install python3-roslaunch 
sudo apt install ros-noetic-roslaunch 

 

12、启动ros系统

roscore 

 

13、验证ros

另外再打开一个终端窗口安装ros-noetic-ros-tutorials(ps:命令中的noetic根据自己的ros版本名更换)

sudo apt-get install ros-noetic-ros-tutorials 

 

安装ros-noetic-rosbash(ps:命令中的noetic根据自己的ros版本名更换)

sudo apt install ros-noetic-rosbash 

 

启动小海龟仿真器

rosrun turtlesim turtlesim_node 

 

另外再打开一个终端窗口启动小海龟控制节点

rosrun turtlesim  turtle_teleop_key 

 

14、创建工作站,配置vscode

进入官网下载vscode

下载很慢可以将链接中的/stable前面的域名换成vscode.cdn.azure.cn即可实现加速下载

进入下载目录在终端打开进行安装

sudo dpkg -i code*.deb 

 

安装好后打开vscode

安装扩展chinese中文简体,cmake tools,c/c++,ros

也可以直接导入我的配置(设置-->配置文件-->导入配置文件)

https://vscode.dev/profile/github/ddb4a40e535ed44b2cfae8b316caa7e6 

 

在home目录下新建catkin_ws文件夹,进入该文件夹新建src,build,include文件夹

打开终端进入src文件夹

cd ~/catkin_ws/src 

 

克隆wpr_simulation(克隆很慢就执行注释的代码)

git clone https://github.com/6-robot/wpr_simulation.git 
#git clone https://ghproxy.com/https://github.com/6-robot/wpr_simulation.git

 

执行安装脚本

cd ~/catkin_ws/src/wpr_simulation/scripts 
./install_for_noetic.sh 

 

编译运行

cd ~/catkin_ws 
catkin_make 

 

设置环境变量,指定载入空间

echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc 

 

使环境变量生效

source ~/.bashrc 

 

打开VS Code,从文件夹打开选择~/catkin_ws文件夹

按住Ctrl+Shift+B,选择catkin_make:build

等待编译完成,再次按住Ctrl+Shift+B,点击catkin_make:build旁边的设置齿轮图标

在打开的task.json文件中将"group"那一行换成下面的

"group": {"kind":"build","isDefault": true}, 

 

保存以后每次编译只需要按住Ctrl+Shift+B即可

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  kZLEadpmxZsY   2024年05月17日   31   0   0 Linux
  kZLEadpmxZsY   2024年05月17日   44   0   0 Linux
  4hf9DKAg5W6h   2024年05月17日   43   0   0 Linux
  2xk0JyO908yA   2024年05月17日   63   0   0 Linux
  tAaiqedz71Vf   2024年05月17日   59   0   0 Linux
  2sqDzWaoi9Ck   2024年05月17日   52   0   0 Linux
LVM
  XWcNkifzer3j   2024年05月20日   52   0   0 Linux
ls5g79zBZM03