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

作者: 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
相关推荐
wwlsm_zql3 小时前
石头科技专利创新:清洁机器人维护简化,效率升级
人工智能·科技·microsoft·机器人
鲁邦通物联网4 小时前
开发者实践:配送机器人梯控的 API 对接、边缘调度与 MQTT 解耦
机器人·机器人梯控·agv梯控·非侵入式采集·配送机器人
视觉语言导航8 小时前
具身导航视角适应性增强!VIL:连续环境视觉语言导航的视角不变学习
人工智能·机器人·具身智能
猫先生Mr.Mao8 小时前
2025年10月AGI月评|OmniNWM/X-VLA/DreamOmni2等6大开源项目:自动驾驶、机器人、文档智能的“技术底座”全解析
人工智能·机器人·大模型·自动驾驶·agi·大模型部署·分布式推理框架
鲁邦通物联网8 小时前
开发者实践:医疗配送机器人梯控的 API 对接与 MQTT 边缘调度解耦
机器人·机器人梯控·agv梯控·非侵入式采集·医疗配送机器人
疆鸿智能研发小助手8 小时前
EtherCAT转PROFINET网关:助力KUKA机器人实现“焊”装自由!
网关·机器人·工业自动化·ethercat·profinet·协议转换网关
unicrom_深圳市由你创科技8 小时前
外骨骼机器人:下肢助力走路,减负 30% 的硬核机械魔法
机器人
WWZZ20258 小时前
快速上手大模型:深度学习4(实践:多层感知机)
人工智能·深度学习·计算机视觉·机器人·大模型·slam·具身智能
Big_潘大师15 小时前
C# 六自由度机械臂正反解计算
数学建模·机器人·c#·六自由度机械臂
元素之窗1 天前
ROS开发中`laser_scan_matcher`节点启动失败问题的分析与解决
机器人