Linuxcnc-ethercat从入门到放弃(1)、环境搭建

news/2025/1/16 11:12:36/

项目开源网站 LinuxCNCicon-default.png?t=N6B9https://www.linuxcnc.org/当前release版本2.8.4

Downloads (linuxcnc.org)icon-default.png?t=N6B9https://www.linuxcnc.org/downloads/可以直接下载安装好linuxcnc的实时debian系统,直接刻盘安装就可以了

 安装IgH主站,网上有很多教程可供参考

git clone https://gitlab.com/etherlab.org/ethercat.git

安装linuxcnc-ethercat

git clone https://github.com/sittner/linuxcnc-ethercat

  1. cd linuxcnc-ethercat

  2. sudo make configure

  3. sudo make

  4. sudo install

安装cia402,控制ethercat伺服需要用到

git clone https://github.com/dbraun1981/hal-cia402

cd hal-cia402

sudo compile --install cia402.comp

配置文件放在linuxcnc/configs/sim.axis下

sd710.ini

# This config file was created 2023-07-27 05:34:43.371981 by the update_ini script
# The original config files may be found in the /home/taotech/linuxcnc/configs/sim.axis/sd710.old.old directory[EMC]
# The version string for this INI file.
VERSION = 1.1
MACHINE = EtherCAT Machine
DEBUG = 1[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 0
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python[RS274NGC]PARAMETER_FILE = linuxcnc.var[EMCMOT]EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD =  0
SERVO_PERIOD = 1000000[TASK]
TASK = milltask
CYCLE_TIME = 0.005[HAL]
HALFILE = sd710.hal[HALUI][TRAJ]
AXES = 1
HOME = 0 0 0
COORDINATES = X
LINEAR_UNITS = mm
ANGULAR_UNITS = deg
DEFAULT_LINEAR_VELOCITY = 100
MAX_LINEAR_VELOCITY = 400[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl[KINS]
KINEMATICS = trivkins coordinates=X
#This is a best-guess at the number of joints, it should be checked
JOINTS = 1[AXIS_X]
MIN_LIMIT = -200
MAX_LIMIT = 500
MAX_VELOCITY = 375.0
MAX_ACCELERATION = 2000.0[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 375.0
MAX_ACCELERATION = 2000.0
STEPGEN_MAXACCEL = 0
SCALE = 1
FERROR = 1
MIN_FERROR = 2000
MIN_LIMIT = -200
MAX_LIMIT = 500
HOME_DELAY = 50
HOME_VEL = 1
HOME_OFFSET =                    100.0
HOME_SEARCH_VEL =                0.0
HOME_LATCH_VEL =                 0.0
HOME_USE_INDEX =                 NO
HOME_IGNORE_LIMITS =             NO
HOME_SEQUENCE = 0

sd710.hal

###########################################################
#
# CIA 402 example snippet Hal
#
######################################################################################################################
# Setup
###########################################################loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTSloadusr -W lcec_conf sd710.xml
loadrt lcec
loadrt cia402 count=1
loadrt pid names=s-pid,0-pid###########################################################
# Functions servo-thread
###########################################################addf lcec.read-all servo-thread
addf cia402.0.read-all servo-threadaddf motion-command-handler servo-thread
addf motion-controller servo-thread
addf s-pid.do-pid-calcs servo-thread
addf 0-pid.do-pid-calcs servo-threadaddf cia402.0.write-all servo-threadaddf lcec.write-all servo-thread#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1#config#
# Joint 0
#
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 800#from servo(ethercat) to cia402
net 0-statusword      lcec.0.0.cia-statusword => cia402.0.statusword
net 0-drv-act-pos     lcec.0.0.actual-position => cia402.0.drv-actual-position#from motion to cianet 0-home-index <= joint.0.index-enable  => cia402.0.home
net 0-enable     <= joint.0.amp-enable-out => cia402.0.enable
net 0-amp-fault  => joint.0.amp-fault-in   <= cia402.0.drv-fault
net 0-pos-cmd    <= joint.0.motor-pos-cmd  => cia402.0.pos-cmd
net 0-pos-fb     => joint.0.motor-pos-fb   <= cia402.0.pos-fb
#net 0-home          lcec.0.0.in-5          => joint.0.home-sw-in#from cia402 to servo(ethercat)
net 0-controlword         cia402.0.controlword => lcec.0.0.cia-controlword
net 0-drv-target-pos      cia402.0.drv-target-position => lcec.0.0.target-position

sd710.xml

masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
<slave idx="0" type="generic" vid="00850104" pid="01030507" configPdos="true">
<syncManager idx="0" dir="out"/>
<syncManager idx="1" dir="in"/>
<syncManager idx="2" dir="out">
<pdo idx="1601">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1A01">
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
</pdo>
</syncManager>
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="250000"/>
</slave>
</master>
</masters>

配置完成后可以启动linuxcnc软件,选择sd710启动

效果参考

linuxcnc-ethercat单轴_哔哩哔哩_bilibiliicon-default.png?t=N6B9https://www.bilibili.com/video/BV1w94y1e7jc/?vd_source=235dd4c4dfb5d45fd9bed45715a82077#reply177527865760


http://www.ppmy.cn/news/987126.html

相关文章

cyber_back

1.1 话题通信 模式&#xff1a; 以发布订阅的方式实现不同节点之间数据交互的通信模式。 如图1-1所示&#xff0c;Listener-Talker通信首先创建了两个Node&#xff0c;分别是Talker Node和 Listener Node。 每个Node实例化Writer类和Reader类对Channel进行消息的读写。 Writer…

ansible 中的fetch模块的作用是什么

Ansible中的fetch模块用于从远程主机上复制文件到控制主机上。 fetch模块允许用户在远程主机上复制文件或目录&#xff0c;并将其下载到控制主机上的指定位置。它可以在执行Playbook期间执行此操作&#xff0c;也可以在Ad-Hoc命令中使用。 fetch模块的一些常见用途包括&#…

day43-Spring_IOC

0目录 1.2.3 1. Spring_IOC 1.1 定义&#xff1a;轻量级框架&#xff0c;java EE的春天&#xff0c;主流框架 1.2 Spring特性&#xff1a;IOC控制反转&#xff1b;AOP面相切面 1.3 组成部分&#xff1a;Spring在SSM中所起到的作用&#xff08;SpringMVC和Mybatis框架的黏…

若依-前台无法正常启动,npm run dev失败

问题场景&#xff1a; 使用若依Vue前端分离版-基于SpringBoot的权限管理系统进行实战。 问题描述与解决 拉取若依项目后&#xff0c;根据官方开发文档&#xff08;项目readme文档&#xff09;进行依赖下载安装后&#xff0c;启动失败。 出现以下几个问题&#xff1a; 运行n…

简单工厂模式VS策略模式

简单工厂模式VS策略模式 今天复习设计模式&#xff0c;由于简单工厂模式和策略模式太像了&#xff0c;重新整理梳理一下 简单工厂模式MUL图&#xff1a; 策略模式UML图&#xff1a; 1、简单工厂模式中只管创建实例&#xff0c;具体怎么使用工厂实例由调用方决定&#xff0c…

火车头神码ai伪原创【php源码】

大家好&#xff0c;小编来为大家解答以下问题&#xff0c;python中常用的类&#xff0c;python 类的用法&#xff0c;现在让我们一起来看看吧&#xff01; 火车头采集ai伪原创插件截图&#xff1a;

图数据库Neo4j学习三——cypher语法总结

1MATCH 1.1作用 MATCH是Cypher查询语言中用于从图数据库中检索数据的关键字。它的作用是在图中查找满足指定条件的节点和边&#xff0c;并返回这些节点和边的属性信息。 在MATCH语句中&#xff0c;通过节点标签和边类型来限定查找范围&#xff0c;然后通过WHERE语句来筛选符合…

PS - Photoshop 抠图与剪贴蒙版功能与 Stable Diffusion 重绘

欢迎关注我的CSDN&#xff1a;https://spike.blog.csdn.net/ 本文地址&#xff1a;https://spike.blog.csdn.net/article/details/131978632 Photoshop 的剪贴蒙版是一种将上层图层的内容限制在下层图层的形状范围内的方法&#xff0c;也就是说&#xff0c;上层图层只能在下层图…