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

作者: 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
相关推荐
懂压力传感器的涌客4 小时前
机器人触觉传感器方案中FSR如何选型与集成
人工智能·机器人·压力传感器·fsr·源头工厂·fsr压力传感器
明志数科4 小时前
机器人数据采集流程的工程实践:三条主流路线对比与选型分析
计算机视觉·自然语言处理·机器人
Hello Mr.Z5 小时前
microduck_rl(MuJoCo+PPO+WandB+UV训练机器人)
机器人·uv·rl·ppo·microduck
rcms152702692185 小时前
Yaskawa XU-RCM2500T-4机器人手臂模块
机器人
海盗12346 小时前
AI 新闻日报 2026-09-07:GitHub 多模型编排、OpenClaw 2.0 多智能体、人形机器人破人类纪录
人工智能·机器人·github
天空属于哈夫克36 小时前
企业微信开发:如何处理接口返回的异常数据?
机器人·自动化·企业微信
嘉立创FPC苗工7 小时前
软硬共生:FPC与机器人的双向赋能,解锁智能装备进化新势能
人工智能·机器人·制造·fpc·电路板
初恋叫萱萱7 小时前
企业微信智能化办公机器人部署与大语言模型集成实操深度指南
语言模型·机器人·企业微信
正在走向自律7 小时前
爆火全网的2026机器人运动会:从赛场竞速到具身智能产业化的技术全解析
人工智能·机器人·具身智能·人形机器人·机器人运动会·百米竞速
倍利福猎头公司官方账号7 小时前
2026机器人猎头公司怎么选?收费标准与合作注意事项【HR版】
大数据·数据库·机器人·求职招聘·业界资讯