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

作者: 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
相关推荐
这张生成的图像能检测吗3 小时前
(论文速读)一种基于双目视觉的机器人螺纹装配预对准姿态估计方法
人工智能·计算机视觉·机器人·手眼标定·位姿估计·双目视觉·螺纹装配
学术小白人4 小时前
【落幕通知】2025年能源互联网与电气工程国际学术会议(EIEE 2025)在大连圆满闭幕
大数据·人工智能·机器人·能源·信号处理·rdlink研发家
科普瑞传感仪器4 小时前
基于六维力传感器的机器人柔性装配,如何提升发动机零部件装配质量?
java·前端·人工智能·机器人·无人机
龙亘川5 小时前
2025 年中国养老机器人行业全景分析:技术演进、市场格局与商业化路径
大数据·人工智能·机器人
捷米特网关模块通讯6 小时前
DeviceNet主站转ProfiNet热插拔网关:西门子1500在线更换焊接机器人I/O不停产
机器人·数据采集·西门子plc·工业自动化·物联网网关·网关模块
yoyo君~10 小时前
深入理解PX4飞控系统:多线程并发、原子操作与单例模式完全指南
学习·单例模式·机器人·无人机
沫儿笙10 小时前
柯马弧焊机器人气流智能调节
人工智能·物联网·机器人
TMT星球10 小时前
曹操出行携手越疆科技共同拓展机器人技术的应用场景和应用能力
人工智能·科技·机器人
·s.*10 小时前
So-arm 101机械臂训练搭建全流程
linux·ubuntu·机器人
铮铭18 小时前
扩散模型简介:The Annotated Diffusion Model
人工智能·机器人·强化学习·世界模型