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

作者: 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 小时前
具身智能数据供给的分层:分布式采集与入厂采集的工程边界分析
人工智能·机器学习·机器人
微小冷5 小时前
Python凸优化cvxpy初步
python·机器人·凸优化·数学规划·cvxpy
XMAIPC_Robot8 小时前
CODESYS 实时控制 + RK182X 大模型算力扩展|RK3576 工业边缘控制器设计
人工智能·fpga开发·机器人·rk3588+fpga
福建清洁设备厂家9 小时前
福建洗地机哪个牌子好?工厂物业商用清洁设备选型指南
机器人·洗地机·清洁设备·驾驶式洗地机·手推式洗地机·智能清洁机器人·全自动清洁机器人
初学大模型10 小时前
先剔后识:OpenCV三维预处理与YOLO语义检测协同的机器人视觉系统可行性分析
人工智能·opencv·yolo·计算机视觉·机器人
PascalXie10 小时前
水下机器人除了声纳,还能用什么感知方案?
计算机视觉·机器人
xwz小王子10 小时前
中科院自动化所、智源等 | DIDO:世界动作模型告别多步去噪,交互动态蒸馏进单步,性能不降反增,推理提速32%!
机器人
硅谷秋水10 小时前
RoboEdit:将人类操作视频转化为可扩展的机器人经验
人工智能·机器学习·计算机视觉·机器人
阿尔法工场研究院11 小时前
宇树们不想重蹈新造车的覆辙
大数据·人工智能·科技·机器人
老张老张11 小时前
具身智能三大核心赛道
机器人·具身智能