wheeltec轮趣ROS教育机器人的网络连接

一、术语解析

宿主机:宿主机是指物理主机,比如用于开发测试的笔记本电脑和台式机电脑。

虚拟机:虚拟机是指安装在宿主机的VMware,推荐在宿主机上安装虚拟机,官方提供虚拟机的镜像以及配套的开发环境

ROS主机:是指ROS小车上的主机;

二、相关介绍

0. ROS教育机器人-树莓派4B版(麦克纳姆轮)

在这里插入图片描述

在这里插入图片描述

1. 虚拟机信息

配置项 配置信息
主机名 ubuntu
账户名 wheeltec_client
登录密码 dongguan
静态IP 192.168.0.136
Ubuntu版本 18.04.6 LTS

在这里插入图片描述

2. ROS主机信息

软件配置信息

配置项 配置信息
主机名 wheeltec
账户名 wheeltec
密码 dongguan
静态IP 192.168.0.100
WiFi名称 WHEELTEC_RASPBERRY_NOETIC
WiFi密码 dongguan
WIFI协议 Wi-Fi 4 (802.11n)
网络频带 2.4 GHz
OS版本 Ubuntu 20.04.4 LTS
ROS版本 Melodic

硬件配置信息

配置项 配置信息
主控名称 树莓派
CPU型号 四核Cortex-A72@1.8GHz
系统架构 aarch64
内存 4GB
内存卡 32G(MicroSD卡)

CPU信息

wheeltec@wheeltec:~$ lscpu
Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
Vendor ID:                       ARM
Model:                           3
Model name:                      Cortex-A72
Stepping:                        r0p3
CPU max MHz:                     1800.0000
CPU min MHz:                     600.0000
BogoMIPS:                        108.00
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; __user pointer sanitization
Vulnerability Spectre v2:        Vulnerable
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fp asimd evtstrm crc32 cpuid

内存信息

内存资源信息

wheeltec@wheeltec:~$ free -h
              total        used        free      shared  buff/cache   available
Mem:          3.7Gi       465Mi       550Mi       4.0Mi       2.7Gi       3.1Gi
Swap:            0B          0B          0B

内存卡读取速度

wheeltec@wheeltec:~$ sudo hdparm -t /dev/mmcblk0p2
[sudo] password for wheeltec:

/dev/mmcblk0p2:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 Timing buffered disk reads: 144 MB in  3.03 seconds =  47.56 MB/sec

micro SD卡信息

wheeltec@wheeltec:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           380M  4.4M  375M   2% /run
/dev/mmcblk0p2   29G   21G  7.6G  73% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop2       62M   62M     0 100% /snap/lxd/22761
/dev/loop0       60M   60M     0 100% /snap/core20/1627
/dev/loop1       60M   60M     0 100% /snap/core20/1977
/dev/loop4       47M   47M     0 100% /snap/snapd/19459
/dev/loop3       92M   92M     0 100% /snap/lxd/24065
/dev/mmcblk0p1  253M  129M  124M  52% /boot/firmware
tmpfs           380M  8.0K  380M   1% /run/user/1001
tmpfs           380M   32K  380M   1% /run/user/128

系统信息

wheeltec@wheeltec:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal

三、常用操作

1. 宿主机ssh连接ROS小车

1.1 连接WiFi

在宿主机上连接ROS小车自带的WiFi。

在这里插入图片描述

连接成功后,查看WiFi信息:

在这里插入图片描述

1.2 ping测试网络

ROS小车的静态IP是:192.168.0.100,在宿主机上ping ROS小车的iP是否连通。

在这里插入图片描述

能ping通,说明宿主机与ROS小车的网络连通。

1.3 ssh登录

IP 192.168.0.100
用户名 wheeltec
密码 dongguan
ssh wheeltec@192.168.0.100

在这里插入图片描述

2. 虚拟机与ROS小车通信

ROS小车发出WiFi,虚拟机连接该WiFi,即可实现虚拟机与ROS小车的通信。

默认情况下,ROS小车的静态IP为 192.168.0.100。只有当虚拟机与ROS小车在同一个网络才能进行通信,因此需要设置虚拟机为静态IP。关于设置虚拟机的静态IP的方法,请参见下文【 设置虚拟机的静态IP】。

ip
ROS小车 192.168.0.100
虚拟机 192.168.0.136
宿主机 192.168.0.190

3. 设置虚拟机的静态IP

默认情况下,虚拟机使用的是动态分配的IP地址,使用的过程中可能会出现IP地址不停变化的情况,因此设置静态IP地址可以为后续减少很多麻烦。

3.1 设置网络适配器

关闭虚拟机,设置网络适配器,将网络连接设置为“桥接模式”。

在这里插入图片描述

3.2 设置虚拟网络

设置虚拟网络,将网络连接模式为“桥接模式”。

在这里插入图片描述

特别注意,如果使用windows系统在连通网线的同时又使用无线网卡(WiFi),可能会出现网络配置修改之后虚拟机的网络无法使用的情况,因此官方建议只使用无线网卡。

3.3 设置静态IP

新配置一个“有线配置”。为了区分其他有线配置,需要自定义“新配置名称”

新配置名称 Static IP
地址 192.168.0.136
子网掩码 225.225.225.0
网关 192.168.0.1

在这里插入图片描述

配置完成后,查看配置信息。

在这里插入图片描述

3.4 ping ROS小车

在虚拟机上ping ROS小车的ip。

在这里插入图片描述

四、FAQ

1. ping ROS小车不通

wheeltec-client@ubuntu:~$ ping 192.168.0.100
PING 192.168.0.100 (192.168.0.100) 56(84) bytes of data.
From 192.168.0.136 icmp_seq=1 Destination Host Unreachable
From 192.168.0.136 icmp_seq=2 Destination Host Unreachable
From 192.168.0.136 icmp_seq=3 Destination Host Unreachable
From 192.168.0.136 icmp_seq=4 Destination Host Unreachable
From 192.168.0.136 icmp_seq=5 Destination Host Unreachable
# 错误原因
虚拟机与ROS小车不在同一个网段,导致无法通信

# 解决办法
参考上文的【设置虚拟机的静态IP】

2. 虚拟机ssh连接ROS小车失败

wheeltec-client@ubuntu:~$ ssh wheeltec@192.168.0.100
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:U0UQNK4E3/QW4/AT4Zt3SaBUqz1f/dkQA3edjdmg2x4.
Please contact your system administrator.
Add correct host key in /home/wheeltec-client/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/wheeltec-client/.ssh/known_hosts:1
  remove with:
  ssh-keygen -f "/home/wheeltec-client/.ssh/known_hosts" -R "192.168.0.100"
ECDSA host key for 192.168.0.100 has changed and you have requested strict checking.
Host key verification failed.
# 解决办法
ssh-keygen -f "/home/wheeltec-client/.ssh/known_hosts" -R "192.168.0.100"

输出结果

wheeltec-client@ubuntu:~$ ssh-keygen -f "/home/wheeltec-client/.ssh/known_hosts" -R "192.168.0.100"
# Host 192.168.0.100 found: line 1
/home/wheeltec-client/.ssh/known_hosts updated.
Original contents retained as /home/wheeltec-client/.ssh/known_hosts.old
wheeltec-client@ubuntu:~$ ssh wheeltec@192.168.0.100
The authenticity of host '192.168.0.100 (192.168.0.100)' can't be established.
ECDSA key fingerprint is SHA256:U0UQNK4E3/QW4/AT4Zt3SaBUqz1f/dkQA3edjdmg2x4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.100' (ECDSA) to the list of known hosts.
wheeltec@192.168.0.100's password: 
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-1069-raspi aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun Jul 16 09:37:46 UTC 2023

  System load:  2.85               Processes:                265
  Usage of /:   70.0% of 28.94GB   Users logged in:          1
  Memory usage: 14%                IPv4 address for docker0: 172.17.0.1
  Swap usage:   0%                 IPv4 address for wlan0:   192.168.0.100
  Temperature:  39.4 C


673 updates can be applied immediately.
299 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

New release '22.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Sun Jul 16 08:53:50 2023 from 192.168.0.190

相关推荐

  1. 智能小车-wheeltec(原版代码)

    2024-04-08 13:24:02       12 阅读
  2. 51单片机基于时间片简单rtos

    2024-04-08 13:24:02       36 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-08 13:24:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-08 13:24:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-08 13:24:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-08 13:24:02       20 阅读

热门阅读

  1. 什么是存储服务器?

    2024-04-08 13:24:02       12 阅读
  2. 人机协同会带来基础领域的新的科技革命

    2024-04-08 13:24:02       9 阅读
  3. SpringBoot项目中常用注解总结

    2024-04-08 13:24:02       17 阅读
  4. windows@命令行管理用户和用户组

    2024-04-08 13:24:02       16 阅读
  5. 【架构二】胖瘦客户端

    2024-04-08 13:24:02       12 阅读
  6. onnxruntime-gpu飘红报错怎么解决?

    2024-04-08 13:24:02       15 阅读
  7. SpringBoot生成一维码和二维码

    2024-04-08 13:24:02       15 阅读
  8. 系统架构评估_1.相关概念

    2024-04-08 13:24:02       13 阅读
  9. 【flask快速上手(一)】

    2024-04-08 13:24:02       14 阅读