【无标题】

一、任务

在Ubuntu16/18/20系统中,安装对应版本的ROS软件,注意记录和分析所遇到的各式问题和解决措施。

(注意:电脑安装ROS有问题的同学,可以采用直接导入Ubuntu18+ROS 镜像的方式,节约时间。

镜像文件很大,约7GB,请从百度网盘下载 。

链接:https://pan.baidu.com/s/15CG3mXpxpqAYeBafS-vc8w 提取码:2022 )

熟悉ROS基本命令,并运行小海龟demo例子,通过键盘控制小海龟运动。同时用话题查看器查看两个node之间的消息传递;

用C++或python写一个程序,控制小海龟走一个圆形。

二、安装

1.下载rosdistro-master的压缩包

解压到主目录

cd ~
unzip rosdistro-master.zip
mv rosdistro-master rosdistro

2.修改文件 20-default.list

sudo gedit /home/lxq/rosdistro/rosdep/sources.list.d/20-default.list

修改成:

# os-specific listings first
yaml file:///home/lxq/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/lxq/rosdistro/rosdep/base.yaml
yaml file:///home/lxq/rosdistro/rosdep/python.yaml
yaml file:///home/lxq/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/lxq/rosdistro/releases/fuerte.yaml fuerte

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

2.修改文件 sources_list.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

3.修改文件 rep3.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

4.修改文件 init.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

执行以下命令:

sudo rosdep init
rosdep update
添加 ROS 环境变量

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

安装 rosinstall

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

第一次启动ROS时,需要进行环境变量配置

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

三、小海龟demo

打开第一个终端,执行以下命令

roscore

右键选择New Terminal打开第二个终端,执行以下命令

rosrun turtlesim turtlesim_node

小海龟出现
在这里插入图片描述
打开第三个终端,执行以下命令

 rosrun turtlesim turtle_teleop_key

然后就可以使用方向键控制小海龟了

四、消息传递

在一个终端运行talker

ros2 run demo_nodes_cpp talker

另一个运行Listener

ros2 run demo_nodes_py listener

在这里插入图片描述

总结

在安装ros的过程中遇到了很多错误难题,好在最后根据网上查阅资料得以解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值