ROS2 CANopen 使用教程(二)

本文涉及的产品
文档翻译,文档翻译 1千页
文本翻译,文本翻译 100万字符
图片翻译,图片翻译 100张
简介: ROS2 CANopen 使用教程

ROS2 CANopen 使用教程(一)+https://developer.aliyun.com/article/1585394

2.3.3 设备部分

       通过设备配置可以配置所连接 CANopen 设备的特性。

注意事项

       需要注意的是,在选择操作(简单节点或托管节点)时,应仅选择生命周期驱动程序或仅选择简单驱动程序。

       混合使用将不起作用!

配置项 描述

driver

The fully qualified class name of the driver to use.

(要使用的驱动程序的全限定类名。)

package

The ros2 package name in which the driver class can be found.

(可以找到驱动程序类的 ros2 软件包名称。)

enable_lazy_load

A flag that states whether the driver is loaded on start-up.

(表示是否在启动时加载驱动程序的标志。)

dcf

The filename of the EDS/DCF describing the slave (mandatory).

(描述从属设备的 EDS/DCF 文件名(必须填写)。)

dcf_path

The directory in which the generated .bin file will be available at runtime (default: see options section).

(运行时生成的 .bin 文件所在的目录(默认值:参见选项部分)。)

node_id

The node-ID (default: 255, can be omitted if specified in the DCF).

(节点 ID(默认值:255,如果在 DCF 中指定,则可省略)。)

revision_number

The revision number (default: 0x00000000, can be omitted if specified in the DCF).

(修订版本号(默认值:0x00000000,如果在 DCF 中指定,则可省略)。)

serial_number

The serial number (default: 0x00000000, can be omitted if specified in the DCF).

(序列号(默认值:0x00000000,可在 DCF 中省略)。)

heartbeat_multiplier

The multiplication factor used to obtain master heartbeat consumer time from the slave heartbeat producer time (default: see options section).

(用于从心跳生产者时间中获取主心跳消费者时间的乘法系数(默认值:参见选项部分)。)

heartbeat_consumer

Specifies whether the slave should monitor the heartbeat of the master (default: false).

(指定从属设备是否应监控主设备的心跳(默认值:false)。)

heartbeat_producer

The heartbeat producer time in ms (default: 0).

(以毫秒为单位的心跳生产者时间(默认值:0)。)

error_behavior

A dictionary of error behaviors for different classes or errors (default: {}, see object 1029).

(针对不同类别或错误的错误行为字典(默认值:{},参见对象 1029)。)

rpdo

The Receive-PDO configuration (see below).

(接收-PDO 配置(见下文)。)

tpdo

The Transmit-PDO configuration (see below).

(发送-PDO 配置(见下文)。)

boot

Specifies whether the slave will be configured and booted by the master (default: true, see bit 2 in object 1F81).

(指定从站是否由主站配置和启动(默认值:true,参见对象 1F81 中的第 2 位)。)

mandatory

Specifies whether the slave is mandatory (default: false, see bit 3 in object 1F81).

(指定从属设备是否必须使用(默认值:false,参见对象 1F81 中的第 3 位)。)

reset_communication

Specifies whether the NMT reset communication command may be sent to the slave (default: true, see bit 4 in object 1F81).

(指定是否可以向从属设备发送 NMT 复位通信命令(默认值:true,参见对象 1F81 中的第 4 位)。)

software_file

The name of the file containing the firmware (default: “”, see object 1F58).

(含有固件的文件名(默认值:"",参见对象 1F58)。)

software_version

The expected software version (default: 0x00000000, see object 1F55).(预期软件版本(默认值:0x00000000,参见对象 1F55)。)

configuration_file

The name of the file containing the configuration (default: “<dcf_path>/<name>.bin” (where <name> is the section name), see object 1F22).(包含配置的文件名(默认值:"<dcf_path>/<name>.bin"(其中 <name> 为部分名称),请参见对象 1F22)。)

restore_configuration

The sub-index of object 1011 to be used when restoring the configuration (default: 0x00).(恢复配置时使用的对象 1011 的子索引(默认值:0x00)。)

sdo_timeout_ms

The timeout to use for SDO reads/writes to this device. (default: 20ms)

(用于 SDO 读/写该设备的超时。(默认值:20ms))

sdo

Additional SDO requests to be sent during configuration (see below).

(配置期间要发送的附加 SDO 请求(见下文)。)

2.3.4 更多参考资料

       dcfgen 文档详细介绍了如何使用 dcfgen 工具生成 DCF: https://opensource.lely.com/canopen/docs/dcf-tools/

2.3.5 变量

       @bus_config_path@: 如果遵循配置包结构,则自动定义配置路径。

2.4 配置包 CMake

       为了构建配置包并从总线配置文件和 eds/dcf 文件生成必要的运行时工件,ly_core_libraries 包包含一个额外的 CMAKE 宏。

cogen_dcf(target)

       目标:配置的名称(例如,config/{bus_config_name_1} 就是 bus_config_name_1)

cogen_dcf(bus_config)

2.5 主驱动程序

       主驱动程序负责创建必要的 can 接口,并建立一个 canopen 事件循环,供驱动程序挂接。此外,该节点还提供通过 nmt 和 sdo 与节点通信的服务。

Master Drivers

Type

Package

Name

lifecycle

canopen_master_driver

ros2_canopen::LifecycleMasterDriver

simple

canopen_master_driver

ros2_canopen::MasterDriver

2.5.1 Services

Services

Type

Description

~/read_sdo

COReadID

Reads an SDO object specified by Index, Subindex and Datatype of the device with the specified nodeid.

(读取一个 SDO 对象,该对象由指定节点 ID 的设备的 Index、Subindex 和 Datatype 指定。)

~/write_sdo

COWriteID

Writes Data to an SDO object specified by Index, Subindex and Datatype on the device with the specified nodeid.

(向指定节点 ID 的设备上由 Index、Subindex 和 Datatype 指定的 SDO 对象写入数据。)

~/set_heartbeat

COHeartbeatID

Sets the heartbeat of the device with the specified nodeid to the heartbeat value (ms)

(将指定节点 ID 的设备心跳设置为心跳值(毫秒))

~/set_nmt

CONmtID

Sends the NMT command to the device with the specified nodeid

(向指定节点 ID 的设备发送 NMT 命令)

2.6 Proxy Driver(代理驱动程序)

代理驱动程序通过 ROS2 服务和报文转发特定设备的 CANopen 功能。

Proxy Drivers

Type

Package

Name

lifecycle

canopen_proxy_driver

ros2_canopen::LifecycleProxyDriver

simple

canopen_proxy_driver

ros2_canopen::ProxyDriver

2.6.1 Services

Services

Type

Description

~/nmt_reset_node

Trigger

Resets CANopen Device the Proxy Device Node manages.

(重置代理设备节点管理的 CANopen 设备。)

~/sdo_read

CORead

Reads an SDO object from the specified index, subindex and datatype of the remote device.

(从远程设备的指定索引、子索引和数据类型中读取 SDO 对象。)

~/sdo_write

COWrite

Writes data to an SDO object on the specified index, subindex and datatype of the remote device.

(根据远程设备的指定索引、子索引和数据类型向 SDO 对象写入数据。)

2.6.2 Publishers

Topic

Type

Description

~/nmt_state

String

Publishes NMT state on change

(更改时发布 NMT 状态)

~/rpdo

COData

Publishes received PDO objects on reception

(在接收时发布收到的 PDO 对象)

2.6.3 Subscribers

Topic

Type

Description

~/tpdo

COData

Writes received data to remote device if the specified object is RPDO mapped on remote device.

(如果指定对象是远程设备上的 RPDO 映射,则将接收到的数据写入远程设备。)

2.7 Cia402 驱动器

       Cia402 驱动器为运动控制器实现了 CIA402 配置文件,可设置驱动器状态、运行模式并向运动控制器发送目标值。

CIA402 Drivers

Type

Package

Name

lifecycle

canopen_402_driver

ros2_canopen::LifecycleCia402Driver

simple

canopen_402_driver

ros2_canopen::Cia402Driver

2.7.1 Services

Services

Type

Description

~/nmt_reset_node

Trigger

Resets CANopen Device the Proxy Device Node manages.

(重置代理设备节点管理的 CANopen 设备。)

~/sdo_read

CORead

Reads an SDO object from the specified index, subindex and datatype of the remote device.

(从远程设备的指定索引、子索引和数据类型中读取 SDO 对象。)

~/sdo_write

COWrite

Writes data to an SDO object on the specified index, subindex and datatype of the remote device.

(根据远程设备的指定索引、子索引和数据类型向 SDO 对象写入数据。)

~/init

Trigger

Initialises motion controller including referencing

(初始化运动控制器,包括参照)

~/recover

Trigger

Recovers motion controller

(恢复运动控制器)

~/halt

Trigger

Stops motion controller

(停止运动控制器)

~/position_mode

Trigger

Switches to profiled position mode

(切换到轮廓定位模式)

~/velocity_mode

Trigger

Switches to profiled velocity mode

(切换到速度曲线模式)

~/torque_mode

Trigger

Switches to profiled torque mode

(切换到曲线扭矩模式)

~/cyclic_position_mode

Trigger

Switches to cyclic position mode

(切换到循环位置模式)

~/cyclic_velocity_mode

Trigger

Switches to cyclic velocity mode

(切换到循环速度模式)

~/interpolated_position_mode

Trigger

Switches to interpolated position mode, only linear mode with fixed time is supported

(切换到内插位置模式,仅支持固定时间的线性模式)

~/target

CODouble

Sets the target value. Only accepted when an operation mode is set.

(设置目标值。仅在设置操作模式时接受。)

2.7.2 Publishers

Publishers

Type

Description

~/joint_states

sensor_msgs/msg/JointState

Joint states of the drive

(驱动器的关节状态)

~/nmt_state

String

Publishes NMT state on change

~/rpdo

COData

Publishes received PDO objects on reception

2.7.3 Subscribers

Topic

Type

Description

~/target

COTargetDouble

Sets target value.

~/tpdo

COData

Writes received data to remote device if the specified object is RPDO mapped on remote device.

2.7.4 总线配置参数

       可用于此驱动程序 bus.yml 的附加参数。

Parameter

Type

Description

polling

bool

Enables polling of the drive status. Default: true. If false, period will be used to run a ros2 timer as update loop. If true, the update loop will be triggered by the sync signal and directly executed in the canopen realtime loop. This requires all data processed in the update loop to be PDO, otherwise the loop will get stuck. This can speed reduce processor load significantly though.

(启用驱动器状态轮询。默认值:true。如果为假,将使用周期运行 ros2 定时器作为更新循环。如果为 true,更新循环将由同步信号触发,并直接在 canopen 实时循环中执行。这就要求更新循环中处理的所有数据都必须是 PDO,否则循环就会卡住。不过这可以大大降低处理器负载。)

period

Milliseconds

Refresh period for 402 state machine. Should be similar to sync period of master.

(402 状态机的刷新周期。应类似于主站的同步周期。)

switching_state

see below

The state to switch the operation mode in.

(切换运行模式的状态。)

scale_pos_to_dev

double

Scaling factor to convert from SI units to device units for position.

(缩放因子,用于将位置单位从国际单位制转换为设备单位。)

scale_vel_to_dev

double

Scaling factor to convert from SI units to device units for velocity.

(缩放因子,用于将速度单位从 SI 单位转换为设备单位。)

scale_pos_from_dev

double

Scaling factor to convert from device units to SI units for position.

(缩放因子,用于将设备单位转换为位置的 SI 单位。)

scale_vel_from_dev

double

Scaling factor to convert from device units to SI units for velocity.

(缩放因子,用于将速度单位从设备单位转换为 SI 单位。)

position_mode

int

The drives operation mode to use for the position interface

(位置接口使用的驱动器运行模式)

velocity_mode

int

The drives operation mode to use for the velocity interface

(速度接口使用的驱动器运行模式)

torque_mode

int

The drives operation mode to use for the torque interface

(扭矩接口使用的驱动器运行模式)

ROS2 CANopen 使用教程(三)+https://developer.aliyun.com/article/1585397

目录
相关文章
|
2月前
|
存储 自然语言处理 机器人
ROS2教程06 ROS2行动
这篇文章是关于ROS2(Robot Operating System 2)行动(Action)通信机制的教程,包括行动的概念、特点、命令行工具的使用,以及如何编写行动的客户端和服务器代码,并介绍了如何测试行动通信。
76 4
ROS2教程06 ROS2行动
|
2月前
|
机器人 Shell Python
ROS2教程05 ROS2服务
这篇文章是关于ROS2(Robot Operating System 2)服务的教程,涵盖了服务的概念、特性、命令行工具的使用,以及如何编写服务的服务器和客户端代码,并提供了测试服务通信机制的示例。
46 4
ROS2教程05 ROS2服务
|
2月前
|
传感器 算法 数据可视化
ROS2教程04 ROS2话题
这篇文章是关于ROS2(Robot Operating System 2)的教程,主要介绍了ROS2中话题的概念、特性、使用方式,以及如何编写发布者和订阅者的代码。
49 3
ROS2教程04 ROS2话题
|
2月前
|
存储 Ubuntu 安全
ROS2教程02 ROS2的安装、配置和测试
本文是关于ROS2(机器人操作系统2)的安装、配置和测试的教程。内容包括使用一键安装脚本快速安装ROS2 Humble版,手动安装步骤,设置语言环境、添加软件源、更新软件包、安装ROS2桌面版和开发工具,配置ROS2环境,创建工作空间,配置ROS2领域以避免网络冲突,以及如何删除ROS2。此外,还包括了测试ROS2是否安装成功的两个案例:基本的Topic通信测试和使用Turtlesim演示程序。适用于Ubuntu 22.04操作系统。
86 1
ROS2教程02 ROS2的安装、配置和测试
|
2月前
|
传感器 存储 Ubuntu
Azure Kinect DK + ROS1 Noetic使用教程
本文是Azure Kinect DK在Ubuntu20.04下配合ROS1 Noetic使用的教程,内容包括一键安装脚本、硬件介绍、安装SDK相关软件包、设置Udev规则、SDK基本测试、DK ROS基本测试,以及存在的一些重要缺陷和相关参考文献。教程详细指导了如何配置和使用Azure Kinect DK,提供了安装步骤和解决常见问题的方法。
45 1
Azure Kinect DK + ROS1 Noetic使用教程
|
2月前
|
传感器 自然语言处理 机器人
ROS2教程03 ROS2节点
本文是关于ROS2(机器人操作系统2)节点的教程,涵盖了节点的概念、特性、使用方法,以及如何编写、测试和使用ROS2节点相关的命令行工具。文章介绍了节点的独立性、任务执行、跨硬件分布和多语言编写能力。详细解释了如何启动节点、查看节点信息、编写节点代码(包括面向过程和面向对象的方法),以及如何为功能包添加依赖和入口点。此外,还探讨了重映射节点名称和使用节点命令行工具的方法,如 `ros2 node info` 和 `ros2 node list`。适合已安装ROS2 Humble和Ubuntu 22.04操作系统,并具有Shell基础知识的读者学习。
31 1
|
2月前
|
算法 数据可视化 机器人
ROS2教程01 ROS2介绍
本文是ROS2(机器人操作系统的下一代)的介绍教程,内容包括ROS2的诞生背景、核心功能、特点、框架以及与ROS1的比较。文章涵盖了ROS2的通信系统、框架和工具、生态系统、全球性社区支持、完全开源、跨平台特性、多机协同能力、实时系统支持和更强的稳定性。此外,还提供了ROS2架构的详细介绍资源链接,适合对ROS2感兴趣的读者学习和了解。
70 1
|
2月前
|
机器人 Shell 开发者
ROS2教程08 ROS2的功能包、依赖管理、工作空间配置与编译
这篇文章是关于ROS2(Robot Operating System 2)中功能包、依赖管理、工作空间配置和编译的教程,涵盖了ROS2工作空间的概念、如何获取和安装功能包的依赖、构建工作空间的步骤,以及如何创建和管理ROS2功能包,包括使用命令行工具对功能包进行操作的方法。
123 0
ROS2教程08 ROS2的功能包、依赖管理、工作空间配置与编译
|
2月前
|
编解码 机器人 C++
ROS2教程07 ROS2自定义消息接口
这篇文章是关于如何在ROS2(Robot Operating System 2)中创建和使用自定义消息类型的教程,包括消息类型的定义、特点、命令行工具的使用,以及如何编写和测试自定义消息类型接口的步骤。
24 0
ROS2教程07 ROS2自定义消息接口
|
2月前
|
传感器 NoSQL 算法
ROS Moveit 配置全网最详细教程
本文是关于ROS Moveit配置的全网最详细教程,提供了一键安装脚本,以及如何使用Moveit进行机器人运动规划的详细步骤和说明。文中还深入解析了Moveit的配置包文件、Moveit的源码,以及如何使用不同的运动规划算法(如CHOMP、LERP、STOMP)进行路径规划。
69 0
ROS Moveit 配置全网最详细教程

推荐镜像

更多
下一篇
无影云桌面