机器人多设备局域网可通调试

作者: Herman Ye @Auromix
版本: V1.0
测试环境: Ubuntu20.04
更新日期: 2023/09/13
1 @Auromix 是一个机器人爱好者开源组织。
2 本文在更新日期经过测试,确认有效。

使用情景

同一机器人不同硬件设备通过局域网有线通信,但存在通信异常,通过命令或脚本来查找各设备。

命令行查看当前局域网段下的其他设备

提示: HWaddress 值为incomplete 是不正常的设备

bash 复制代码
arp -n

脚本查看当前局域网段下可Ping通的所有设备

bash 复制代码
#!/bin/bash
#
# Copyright 2023 Herman Ye @Auromix
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Description: This script finds your device in the specified network segment, such as robot arm, lidar.
# Version: 1.0
# Date: 2023-09-13
# Author: Herman Ye @Auromix
#
# set -x


# Prompt the user to enter a network segment
read -p "Please enter a network segment (press Enter for default value 192.168.1): " network

# Set a default value if the user presses Enter
network="${network:-192.168.1}"

echo "Finding devices from $network.1 to $network.254"
# Initialize an array to store reachable devices
reachable_devices=()

# Iterate through all IP addresses in the specified network segment
for ip in ${network}.{1..254}; do
    # Use the ping command to check if the device is reachable
    # -c 1 means send only one ICMP request, -W 1 means wait for 1 second
    if ping -c 1 -W 1 $ip >/dev/null; then
        echo "Device at $ip is reachable"
        # Add reachable devices to the array
        reachable_devices+=("$ip")
    else
        echo "Device at $ip is not reachable"
    fi
done

# Print information about all reachable devices
echo "All reachable devices:"
for device in "${reachable_devices[@]}"; do
    echo "$device"
done
相关推荐
LiYingL5 小时前
什么是 DualTHOR?用于提高双臂机器人实际适应能力的新一代模拟器
机器人
机器人行业研究员12 小时前
为何机器人开始学叠衣服?六维力传感器赋予的能力正推动落地场景变革
机器人·人机交互·六维力传感器·关节力传感器
秋刀鱼 ..13 小时前
第五届遥感与测绘国际学术会议(RSSM 2026)
大数据·运维·人工智能·机器人·自动化
RPA机器人就用八爪鱼14 小时前
RPA 平台架构设计核心:构建企业级自动化的底层逻辑
机器人·rpa
沫儿笙14 小时前
KUKA库卡焊接机器人tag焊接节气
人工智能·机器人
xwz小王子14 小时前
星尘智能自研Lumo-1模型:让机器人心手合一,迈进推理-行动闭环时代
机器人·心手合一
测试人社区—小叶子14 小时前
接口测试全攻略:从Swagger到MockServer
运维·c++·人工智能·测试工具·机器人·自动化·测试用例
测试人社区-小明15 小时前
AI在金融软件测试中的实践
人工智能·测试工具·金融·pycharm·机器人·github·量子计算
梦想的旅途216 小时前
企业微信“群机器人”消息推送的限制与绕过思路技术分析
机器人·企业微信
点云SLAM1 天前
四元数 (Quaternion)动力学左乘/右乘约定下之误差态 EKF 的连续线性化与离散化传播示例(11)
机器人·slam·位姿估计·imu·四元数·误差状态ekf