资讯详情

第三章 IGH及preempt-rt的安装及与零差云控模组的连接

零差云控关节模块

https://www.zeroerr.cn/download/eRob.html 获取最新的零差云控数据

第一章 零差云控关节模块介绍

第二章 电机拆解

第三章 IGH及preempt-rt的安装

第四章 命令行读取电机信息

第五章 装配和控制机械臂


文章目录

前言

本文使用linux是ubuntu18.04,双系统。IGH使用的是ethercat IGH1.5.2。

一、零差云控eRob70I的ethercat通信

在这里插入图片描述

图来源于零差云控关节模组使用手册。

红框内为ethercat接线方式,通过两条双绞线(共四条线)连接,线包中提供的线短,质量不是很好。建议自行购买双绞线和JST接头自己做线。 由主站网卡-slave1-slave2- ···-slaveN,包括每个网口ecat in 及ecat out,ecat in连接主站网卡或上一个模块,ecat out连接下一个模块,连接最后一个模块 模组的ecat out使用冗余时可以使用无连接。

1、IGH通信单个关节模块

直流电源48V供电、ethercat通信线连接、编码器电池安装复位后,即可进行通信测试 1、启动主站

$ sudo /etc/init.d/ethercat restart 

2.查看电机信息

$ sudo ethercat cstruct -a 0 

电机的各种信息如下: 注:以下信息不显示,大概是这样,以后再改

static struct{ 
             unsigned int operation_mode;     unsigned int target_position;     unsigned int digital_outputs;     unsigned int ctrl_word;     unsigned int position_actual_value;     unsigned int digital_inputs;     unsigned int status_word;     int actual_current;     unsigned int actual_speed;     int  actual_torque; }offset,offset1,offset2,offset3,offset4,offset5; static ec_pdo_entry_info_t slave_0_pdo_entries[] = { 
             { 
        0x607a, 0x00, 32}, 
       
        /* Target Position */ 
        { 
         
        0x60fe
        , 
        0x00
        , 
        32
        }
        , 
        /* Digital outputs */ 
        { 
         
        0x6040
        , 
        0x00
        , 
        16
        }
        , 
        /* Control Word */ 
        /*TxPdo 0x1A00*/ 
        { 
         
        0x6064
        , 
        0x00
        , 
        32
        }
        , 
        /* Position Actual Value */ 
        { 
         
        0x60fd
        , 
        0x00
        , 
        32
        }
        , 
        /* Digital inputs */ 
        { 
         
        0x6041
        , 
        0x00
        , 
        16
        }
        , 
        /* Status Word */ 
        }
        ; 
        static 
        ec_pdo_info_t slave_0_pdos
        [
        ] 
        = 
        { 
          
        { 
         
        0x1600
        , 
        3
        , slave_0_pdo_entries 
        + 
        0
        }
        , 
        { 
         
        0x1a00
        , 
        3
        , slave_0_pdo_entries 
        + 
        3
        }
        , 
        }
        ; 
        static 
        ec_sync_info_t slave_0_syncs
        [
        ] 
        = 
        { 
          
        { 
         
        0
        , EC_DIR_OUTPUT
        , 
        0
        , 
        NULL
        , EC_WD_DISABLE
        }
        , 
        { 
         
        1
        , EC_DIR_INPUT
        , 
        0
        , 
        NULL
        , EC_WD_DISABLE
        }
        , 
        { 
         
        2
        , EC_DIR_OUTPUT
        , 
        1
        , slave_0_pdos 
        + 
        0
        , EC_WD_ENABLE
        }
        , 
        { 
         
        3
        , EC_DIR_INPUT
        , 
        1
        , slave_0_pdos 
        + 
        1
        , EC_WD_DISABLE
        }
        , 
        { 
         
        0xff
        } 
        }
        ; 
       

二、实时补丁preempt-rt的安装

1、下载安装包

1 | https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/

下载 linux-4.4.270.tar.gz

2 | http://cdn.kernel.org/pub/linux/kernel/projects/rt/4.4/

下载 patch-4.4.277-rt224.patch

2、创建文件夹

$ cd ~
$ mkdir linux-4.4.270-rt222

并将步骤1下载的文件放到该目录下.

3、打补丁, 安装编译工具, 配置菜单

$ cd ~/linux-4.4.270-rt222
$ tar -zxf linux-4.4.270.tar.gz
$ gunzip patch-4.4.277-rt224.patch.gz
$ cd linux-4.4.270
$ patch -p1 < ../patch-4.4.277-rt224.patch

注:以下三步,如果有报错,则需要改为国内源。改为国内源:点击 软件和更新—>ubuntu软件—>下载自—>更改为tsinghua源/其他

$ sudo apt-get build-dep linux
$ sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf fakeroot
$ sudo apt-get install kernel-package
$ yes '' | make oldconfig
$ make menuconfig

4、配置内核选项

(1) Enable CONFIG_PREEMPT_RT
     -> Processor type and features
      -> Preemption Model (Fully Preemptible Kernel (Real-Time))
       (X) Fully Preemptible Kernel (Real-Time)

    (2) Enable CONFIG_HIGH_RES_TIMERS
     -> General setup
      -> Timers subsystem
       [*] High Resolution Timer Support

    (3) Enable CONFIG_NO_HZ_FULL
     -> General setup
      -> Timers subsystem
       -> Timer tick handling (Full dynticks system (tickless))
        (X) Full dynticks system (tickless)

    (4) Set CONFIG_HZ_1000 (note: this is no longer in the General Setup menu, go back twice)
     -> Processor type and features
      -> Timer frequency (1000 HZ)
       (X) 1000 HZ

    (5) Set CPU_FREQ_DEFAULT_GOV_PERFORMANCE [=y]
     ->  Power management and ACPI options
      -> CPU Frequency scaling
       -> CPU Frequency scaling (CPU_FREQ [=y])
        -> Default CPUFreq governor (<choice> [=y])
         (X) performance

保存配置并退出.

5、编译内核 deb 安装包

$ sudo make-kpkg -j `nproc` --initrd kernel_image kernel_headers

6、安装内核

$ cd ..
$ sudo dpkg -i *.deb
$ sudo update-grub

注:若进入系统,显示“has invaid signature ,you need to load the kernel first”,需要进入bois->secure->secure boot,将其enable改为disabled。根据不同电脑会出现不让修改secure boot的情况,例如惠普电脑需要重启后,输入已经出现的4位数字,重复验证是本人操作。

7、重启电脑,选择使用内核 linux-4.4.270-rt222 进入系统

$ reboot

8、查看内核是否安装成功

$ uname -a
Linux stz 4.4.270-rt222 #1 SMP PREEMPT RT Wed Jul 21 19:00:00
CST 2021 x86_64 x86_64 x86_64 GNU/Linux

参考:https://www.cnblogs.com/zzugyl/p/14588114.html

经过上述的安装步骤之后,若想使用内核 linux-4.4.270-rt222 进入系统,需要在每次开机时都选择,如果想默认进入实时系统,需要sudo gedit etc/default/grub修改参数。

三、IGH的安装

IGH免费、开源、稳定性能良好,但是需要打实时补丁。

1、下载IGH程序源码

http://hg.code.sf.net/p/etherlabmaster/code https://sourceforge.net/p/etherlabmaster/code/ci/stable-1.5/tree/ 以上两个网址任意一个都可,点击DownloadSnapshot下载压缩包,并重命名为etherlab-stable1.5.zip

2、下载所需依赖

1 | sudo apt install autoconf automake libtool net-tools
2 | sudo apt-get install linux-headers-$(uname -r)

3、编译并安装

提示:其中,etherlab-stable1.5.zip为重命名后的名字

    1 | unzip etherlab-stable1.5.zip
    2 | cd ~/etherlab-stable1.5   
     
    3 | ./bootstrap
    4 | ./configure --enable-cycles --enable-hrtimer --enable-8139too=no
      #可以打开configure查看详细配置项,如果你没安装linux-headers,需要下载依赖linux-headers并指定--with-linux-dir=

    5 | make all modules
    6 | sudo make modules_install install
    7 | sudo depmod
    8 | sudo ln -fs /usr/local/etc/init.d/ethercat /etc/init.d/
    9 | sudo mkdir /etc/sysconfig
    10 | sudo ln -fs /usr/local/etc/sysconfig/ethercat /etc/sysconfig/
    11 | sudo -i
    echo KERNEL==\"EtherCAT[0-9]*\", MODE=\"0664\" > /etc/udev/rules.d/99-EtherCAT.rules

4、网络配置

这一步可以理解为给IGH 添加一个网卡,后期如果换网卡,可以在这儿修改新的网卡地址。

1| ifconfig                           #注:查询有线网卡的MAC地址
2| sudo nano /etc/sysconfig/ethercat  #注:修改两个地方。找到MASTER0_DEVICE=” ”,将自己的MAC地址写入;找到DEVICE_MODULES=” ”,将generic写入

MASTER0_DEVICE=”00:01:02:b4:a6:25”    #注:此为第一步查到的MAC地址
DEVICE_MODULES=”generic”              #注:设置网卡为默认generic

5、启动ethercat

在命令窗口键入 ethercat,查看ethercat的各种命令。若显示如下,则安装成功。

:~$ ethercat

Please specify a command!

Usage: ethercat <COMMAND> [OPTIONS] [ARGUMENTS]

Commands (can be abbreviated):
 alias      Write alias addresses.
 config     Show slave configurations.
 crc        CRC error register diagnosis.
 cstruct    Generate slave PDO information in C language.
 data       Output binary domain process data.
 debug      Set the master's debug level.
 domains    Show configured domains.
 download   Write an SDO entry to a slave.
 eoe        Display Ethernet over EtherCAT statictics.
 foe_read   Read a file from a slave via FoE.
 foe_write  Store a file on a slave via FoE.
 graph      Output the bus topology as a graph.
 master     Show master and Ethernet device information.
 pdos       List Sync managers, PDO assignment and mapping.
 reg_read   Output a slave's register contents.
 reg_write  Write data to a slave's registers.
 rescan     Rescan the bus.
 sdos       List SDO dictionaries.
 sii_read   Output a slave's SII contents.
 sii_write  Write SII contents to a slave.
 slaves     Display slaves on the bus.
 soe_read   Read an SoE IDN from a slave.
 soe_write  Write an SoE IDN to a slave.
 states     Request application-layer states.
 upload     Read an SDO entry from a slave.
 version    Show version information.
 xml        Generate slave information XML.

Global options:
 --master  -m <master>  Comma separated list of masters
                        to select, ranges are allowed.
                        Examples: '1,3', '5-7,9', '-3'.
                        Default: '-' (all).
 --force   -f           Force a command.
 --quiet   -q           Output less information.
 --verbose -v           Output more information.
 --help    -h           Show this help.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

Call 'ethercat <COMMAND> --help' for command-specific help.

Send bug reports to fp@igh-essen.com.
Please specify a command!

Usage: ethercat <COMMAND> [OPTIONS] [ARGUMENTS]

Commands (can be abbreviated):
 alias      Write alias addresses.
 config     Show slave configurations.
 crc        CRC error register diagnosis.
 cstruct    Generate slave PDO information in C language.
 data       Output binary domain process data.
 debug      Set the master's debug level.
 domains    Show configured domains.
 download   Write an SDO entry to a slave.
 eoe        Display Ethernet over EtherCAT statictics.
 foe_read   Read a file from a slave via FoE.
 foe_write  Store a file on a slave via FoE.
 graph      Output the bus topology as a graph.
 master     Show master and Ethernet device information.
 pdos       List Sync managers, PDO assignment and mapping.
 reg_read   Output a slave's register contents.
 reg_write  Write data to a slave's registers.
 rescan     Rescan the bus.
 sdos       List SDO dictionaries.
 sii_read   Output a slave's SII contents.
 sii_write  Write SII contents to a slave.
 slaves     Display slaves on the bus.
 soe_read   Read an SoE IDN from a slave.
 soe_write  Write an SoE IDN to a slave.
 states     Request application-layer states.
 upload     Read an SDO entry from a slave.
 version    Show version information.
 xml        Generate slave information XML.

Global options:
 --master  -m <master>  Comma separated list of masters
                        to select, ranges are allowed.
                        Examples: '1,3', '5-7,9', '-3'.
                        Default: '-' (all).
 --force   -f           Force a command.
 --quiet   -q           Output less information.
 --verbose -v           Output more information.
 --help    -h           Show this help.

Numerical values can be specified either with decimal (no
prefix), octal (prefix '0') or hexadecimal (prefix '0x') base.

Call 'ethercat <COMMAND> --help' for command-specific help.

Send bug reports to fp@igh-essen.com.

参考:https://blog.csdn.net/weixin_42584917/article/details/117654990

标签: jst连接器07p

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台