ubuntu20+ros安装+小乌龟测试

开始学习机器人,首先是ros环境安装

1、ROS安装
sudo apt install curl gnupg2 lsb-release
curl http://repo.ros2.org/repos.key | sudo apt-key add - 
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
sudo apt update
sudo apt install ros-noetic-desktop-full
2、初始化ROS
sudo rosdep init
rosdep update
  • 问题1: sudo: rosdep:找不到命令

安装

sudo apt install python3-rosdep2
或者
sudo apt install python-rosdep2
  • 问题2:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

解决方案1:

sudo gedit /etc/hosts

199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

解决方案2:直接下载本地文件,并更改相应文件。

文件链接:链接: https://pan.baidu.com/s/1buhh86hURn-0K6llS7Ypfw 提取码: 2o8b ,下载解压并移动到/etc/ros/目录

新建文件/修改文件sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list

# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

替换为

# os-specific listings first
yaml file:///etc/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///etc/ros/rosdistro/master/rosdep/base.yaml
yaml file:///etc/ros/rosdistro/master/rosdep/python.yaml
yaml file:///etc/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro file:///etc/ros/rosdistro/master/releases/fuerte.yaml feurte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

至此,初始化成功

3、添加环境变量/问题zsh: command not found: roscore
bash:

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

zsh:

echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
4、测试小乌龟
#shell 1
rosrun

#shell 2
rosrun turtlesim turtlesim_node

#shell 3
rosrun turtlesim turtle_teleop_key

鼠标放在shell 3里面,按下上下左右键,可控制小乌龟,shell 2显示坐标
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值