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

作者: 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
相关推荐
CES_Asia1 小时前
机器人“奥运会”燃动北京——CES Asia 2026全球机器人性能挑战赛与展览定档
大数据·人工智能·机器人
yoyo君~3 小时前
FAST-LIVO2 深度技术解析
算法·计算机视觉·机器人·无人机
Deepoch5 小时前
低幻觉AI:重塑科研与教育领域的可信智能新范式
大数据·人工智能·机器学习·机器人·具身模型·deepoc·低幻觉ai
Mryan20056 小时前
基于 Nao 机器人的摄像头和声呐结合寻路方式
python·机器人·nao 机器人·naoqi
RPA机器人就选八爪鱼6 小时前
银行业流程自动化升级:RPA 机器人赋能金融数智转型
大数据·人工智能·机器人·自动化·rpa
敢敢のwings6 小时前
人形机器人全身遥操OpenWBT系统技术解析
机器人
徐桑6 小时前
【强化学习笔记】从数学推导到电机控制:深入理解 Policy Gradient 与 Sim-to-Real。
机器人·强化学习
中科米堆6 小时前
机器人企业采用自动化三维测量方案,完成关节部件快速检测-中科米堆CASAIM
运维·机器人·自动化·3d全尺寸检测
九鼎创展科技6 小时前
「有温度的陪伴」:基于全志 V821 的情感共鸣型实体机器人详解
linux·人工智能·嵌入式硬件·机器人
CES_Asia6 小时前
资本赋能实体智能——2026 CES Asia机器人产业投资峰会定档北京
大数据·人工智能·microsoft·机器人