当前位置:网站首页>ROS学习---远程启动ROS节点
ROS学习---远程启动ROS节点
2020-11-07 20:56:00 【Coxhuang】
文章目录
- 远程启动ROS节点
- #1 环境
- #2 需求
- #3 验证前提条件
- #3.1 验证免密登录
- #3.2 验证单机ros发布订阅
- #4 开始
- #4.1 配置
- #4.1.1 pc-master
- #4.1.2 pc-slave2
- #4.2 本地主机脚本
- #4.3 启动
- #4.1 配置
- #5 报错
- #5.1 not found in known_hosts
- #5.2 TypeError: 'NoneType' object is not callable
远程启动ROS节点
#1 环境
Ubuntu 16.04
机器配置 :
pc-master 192.168.3.230 本地 pc-slave2 192.168.3.232 远程
前提条件:
1. 可以在两台机器上实现单机的ROS发布和订阅
2. 两台机器可以免密登录
#2 需求
- 在实际应用中, 不同的功能会放在不同的服务器上
- 需要订阅不同服务器上的topic
#3 验证前提条件
#3.1 验证免密登录
两台服务器可以相互免密登录
具体免密登录教程 : https://blog.csdn.net/Coxhuang/article/details/106971890
#3.2 验证单机ros发布订阅
这里以pc-slave2服务器为例(因为后面要远程启动的也是pc-slave2上的节点)
talker :
listener :
#4 开始
**接下来, 我们要在pc-master服务区上启动远程服务器pc-slave2的talker节点 **
#4.1 配置
#4.1.1 pc-master
sudo vim /etc/hosts
在/etc/hosts文件中添加一下内容 :
192.168.3.230 pc-master 192.168.3.232 pc-slave2
sudo vim ~/.bashrc
在~/.bashrc中添加一下内容 :
export ROS_IP="192.168.3.230" export ROS_HOSTNAME=pc-master export ROS_MASTER_URI=http://pc-master:11311 export ROSLAUNCH_SSH_UNKNOWN=1
#4.1.2 pc-slave2
sudo vim /etc/hosts
在/etc/hosts文件中添加一下内容 :
192.168.3.230 pc-master 192.168.3.232 pc-slave2
sudo vim ~/.bashrc
在~/.bashrc中添加一下内容 :
export ROS_HOSTNAME=pc-slave2 export ROS_MASTER_URI=http://pc-master:11311 export ROSLAUNCH_SSH_UNKNOWN=1
sudo vim /opt/ros/kinetic/trunk_evn.sh
新增trunk_evn.sh文件
#!/bin/sh export ROS_IP=192.168.3.232 export ROS_HOSTNAME=pc-slave2 . /home/trunk/work/test/testworkspace/devel/setup.sh exec "$@"
sudo chmod 777 trunk_evn.sh
#4.2 本地主机脚本
在本地pc-master的package中编写launch脚本
vim /home/trunk/work/test/testworkspace/src/testpackage/launch/test.launch
<launch> <machine name="pc-slave2" address="192.168.3.232" user="trunk" env-loader="/opt/ros/kinetic/trunk_evn.sh"></machine> <node machine="pc-slave2" name="talker" pkg="testpackage" type="talker.py" output="screen" ></node> </launch>
#4.3 启动
roslaunch testpackage test.launch
#5 报错
#5.1 not found in known_hosts
... logging to /home/trunk/.ros/log/84cf4482-b84f-11ea-9d63-000c297ff566/roslaunch-pc-master-3868.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://pc-master:32881/ remote[192.168.3.232-0] starting roslaunch remote[192.168.3.232-0]: creating ssh connection to 192.168.3.232:22, user[trunk] /usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV self._cipher = factory.new(key, *args, **kwargs) remote[192.168.3.232-0]: failed to launch on pc-slave2: Unable to establish ssh connection to [[email protected]:22]: Server u'192.168.3.232' not found in known_hosts
解决思路 :
- 看日志
根据日志报错的提示来修改python底层源码,没有效果,日志显示, ros依然是运行在python2.7上,试着将ros运行在Python3上
- 把系统默认Python替换成Python3
sudo rm -rf /usr/bin/python sudo ln -s /usr/bin/python3 /usr/bin/python
2. 安装ros的编译基础软件包
sudo apt-get install python3-rosdep python3-rosinstall-generator python3-wstool python3-rosinstall build-essential sudo pip3 install catkin_pkg
3. 安装软件包依赖
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y sudo apt-get install libtbb-dev python3-pyqt5 sudo pip3 install empy numpy defusedxml netifaces # 修复 16.04 libboost_python3找不到的问题 sudo ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py35.so /usr/lib/x86_64-linux-gnu/libboost_python3.so
4. 完美解决
#5.2 TypeError: ‘NoneType’ object is not callable
修改Python底层代码
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
版权声明
本文为[Coxhuang]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1744579
边栏推荐
- ngnix集群高并发
- [漫谈] 软件设计的目标和途径
- 屏读时代,我们患上了注意力缺失候群症
- Using thread communication to solve the problem of cache penetrating database avalanche
- 编程界大佬教你:一行Python代码能做出哪些神奇的事情?
- 我们为什么需要软件工程——从一个简单的项目进行观察
- Thinkphp6中where条件中字段与字段比较条件的写法
- A detailed explanation of microservice architecture
- Ac86u KX Online
- Reflection on a case of bus card being stolen and swiped
猜你喜欢
use Xunit.DependencyInjection Transformation test project
从技术谈到管理,把系统优化的技术用到企业管理
websocket+probuf.原理篇
Web API series (3) unified exception handling
Awk implements SQL like join operation
Design pattern of facade and mediator
Git代码提交操作,以及git push提示failed to push some refs'XXX'
MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法
全网最硬核讲解计算机启动流程
看一遍就理解,图解单链表反转
随机推荐
想要忘记以前连接到Mac的WiFi网络,试试这个方法!
On hiz buffer
年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
ECMAScript7规范中的instanceof操作符
easyui dialog“缓存问题”
C language I blog assignment 03
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
Get started, GIT
Awk implements SQL like join operation
Practice of Xiaoxiong school development board: real equipment access of smart street lamp sandbox experiment
快速上手Git
Thinkphp6中where条件中字段与字段比较条件的写法
graph generation model
The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly
Technical debt is a lack of real understanding of business functions- daverupert.com
Share several vs Code plug-ins I use everyday
聊一聊数据库中的锁
微服务的出现和意义的探索
一次公交卡被“盗刷”事件带来的思考