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

作者: 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
相关推荐
听你说328 小时前
伊萨推出 ROBBI 360 协作机器人焊接工作站 简化自动化焊接部署流程
人工智能·机器人·自动化
Dicy梦儿13 小时前
机器人奇异点分析工具
机器人
机器觉醒时代13 小时前
RL Token:破解 VLA “最后一厘米”精度难题,在线强化学习实现机器人精准操控
人工智能·机器人·强化学习·具身智能·vla模型
机器人零零壹14 小时前
越擎科技发布机器人离线编程软件应用白皮书,阐述机器人装配工艺规划、离线编程与虚拟调试方案的原理及优势
机器人·机器人仿真·工业软件·虚拟调试·irobotcam·装配仿真·产线仿真
小O的算法实验室14 小时前
2026年IEEE TEVC,面向农业多机器人任务分配的自适应多目标任务划分算法,深度解析+性能实测
算法·机器人·论文复现·智能算法·智能算法改进
码农三叔16 小时前
(1-2)控制系统基础与人形机器人特点:人形机器人控制的特殊挑战
人工智能·机器学习·机器人·人形机器人
maxmaxma16 小时前
ROS2 机器人 少年创客营:Day 7
人工智能·python·机器人·ros2
大学有意思17 小时前
2026深度解析广西英华国际职业学院新能源汽车技术专业
人工智能·机器人
DC...17 小时前
【力控】混合位置 / 力控制
算法·机器人·力控
福客AI智能客服18 小时前
智能客服平台:AI人工智能客服机器人正在重构企业服务体系
人工智能·机器人