今天在虚拟机的ubuntu系统中,运行roscore后,终端没有任何执行处理,终端执行rostopic list命令,依然没有任何相应。
经观察发现,今天所使用的无线与之前不同,终端执行ifconfig,有如下显示:
eth0 Link encap:Ethernet HWaddr 00:0c:29:61:26:4b
inet addr:192.168.2.76 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe61:264b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3427 errors:0 dropped:0 overruns:0 frame:0
TX packets:388 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:243011 (243.0 KB) TX bytes:39583 (39.5 KB)
当前IP为192.168.2.76,与之前配置不同,而在.bashrc中的
ROS_IP并不是192.168.2.76,因此在.bashrc中添加(或修改)ROS_IP为ifconfig指令显示的IP即可:
export ROS_IP=192.168.2.76
注意:修改后需要重新source .bashrc,并重启终端。另外,若此时ROS_MASTER_URI有赋值,则需要将该行注释掉。
此时再执行roscore,正常执行:
... logging to /home/zyn/.ros/log/1f48c646-0136-11e9-814c-000c2961264b/roslaunch-ubuntu-11580.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://192.168.2.76:41576/
ros_comm version 1.11.21
SUMMARY
========
PARAMETERS
* /rosdistro: indigo
* /rosversion: 1.11.21
NODES
auto-starting new master
process[master]: started with pid [11592]
ROS_MASTER_URI=http://192.168.2.76:11311/
setting /run_id to 1f48c646-0136-11e9-814c-000c2961264b
process[rosout-1]: started with pid [11605]
started core service [/rosout]
另起终端,执行 rostopic list,显示
/rosout
/rosout_agg
全部运行正常,问题解决。
版权声明:本文为bbtang5568原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。