参考文章:https://blog.csdn.net/qq_43481884/article/details/108895044
第一步
代码语言:javascript复制ifconfig
结果为(注意查看自己的inet值并保存)
代码语言:javascript复制acc133: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.125.75.219 netmask 255.255.255.0 broadcast xxxxxx
inet6 fe80::1721:1dd1:6cc2:a311 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:a2:dd:da txqueuelen 1000 (Ethernet)
RX packets 173975 bytes 188553377 (188.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 75714 bytes 4684485 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet xxxxx netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2169 bytes 331712 (331.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2169 bytes 331712 (331.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
保存
inet 中的192.168.75.219 acc133
第二步
代码语言:javascript复制sudo gedit /etc/hosts
得到
代码语言:javascript复制xxxxxx localhost
xxxxxx ubuntu
...................
改为
代码语言:javascript复制xxxxxx localhost
xxxxxx ubuntu
192.125.75.219 acc133
...................
保存并退出
第三步
输入
代码语言:javascript复制ping ens33
得到的结果是否正常,正常使用Ctrl c退出
第四步
打开节点程序
代码语言:javascript复制rosrun turtlesim turtlesim_node
正常打开!!成功解决