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

简介: 本文提供了一个Bash脚本,用于在指定的局域网段内查找可Ping通的所有设备,如机器人臂或激光雷达等,以便于在多设备局域网环境中进行通信调试。

作者: Herman Ye @Auromix
版本: V1.0
测试环境: Ubuntu20.04
更新日期: 2023/09/13
注1: @Auromix 是一个机器人爱好者开源组织。
注2: 本文在更新日期经过测试,确认有效。

使用情景

同一机器人不同硬件设备通过局域网有线通信,但存在通信异常,通过命令或脚本来查找各设备。

命令行查看当前局域网段下的其他设备

提示: HWaddress 值为incomplete 是不正常的设备

arp -n

脚本查看当前局域网段下可Ping通的所有设备

#!/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
目录
相关文章
|
机器人
DNA机器人进化!这款软件能用几分钟造出复杂结构纳米设备,进入你的身体执行任务
DNA机器人进化!这款软件能用几分钟造出复杂结构纳米设备,进入你的身体执行任务
160 0
|
机器人 物联网
阿里云物联网平台设备上下线钉钉机器人告警
目前阿里云物联网平台新增了告警中心的功能,通过和场景联动配合,可以很好的监控设备状态。这里主要演示如何实现最常见的设备上下线钉钉机器人告警功能。
2857 0
阿里云物联网平台设备上下线钉钉机器人告警
|
新零售 人工智能 机器人
今日科技联播:SpaceX将向国际空间站发送新设备:人工智能机器人
SpaceX将向国际空间站发送新设备:人工智能机器人 SpaceX为美国国家航空航天局(NASA)执行第15次国际空间站载货飞行任务,除了食物、水以及科学实验设备外,此次还将运送一台人工智能机器人。这台机器人名为CIMON,它可以与国际空间站上的人类宇航员展开互动。
1258 0
|
机器学习/深度学习 JavaScript 物联网
温湿度计设备通过阿里云IoT物联网套件上报数据到钉钉群机器人实践
温湿度计通过MQTT协议连接到IoT套件,规则引擎针对数据上报Topic配置转发到函数计算(FunctionComputer)中编写好的函数pushData2DingTalk,Nodejs脚本函数处理数据,post到钉钉群机器人
4528 0
|
机器人
《制造业中的机器人、自动化和系统集成》—— 3.3 工艺设备
自动化系统可以分为两类:用来装配、机床上下料或常见的材料搬运操作的自动化系统;实现某种加工工艺的自动化系统。前一类往往使用安装于机器人上的抓手,而后一类需要一些工艺设备来控制和实施该项工艺。
2174 0
|
安全 机器人
《制造业中的机器人、自动化和系统集成》—— 第3章 自动化系统组件 3.1 搬运设备
除了机器人以外,自动化系统还包括其他组件,以实现完整的解决方案。本章主要介绍最常用的一些技术,包括搬运和喂料系统、视觉、抓手和工具转换器以及工装和夹具等。本章也讨论机器人应用所需要的工艺设备,着重介绍焊接、喷漆、调配和材料去除等应用,还讨论了装配自动化。
1690 0

热门文章

最新文章