python - 实现 Python CANopen
问题描述
我是 CANopen 的新手,我正在努力使用它来连接微处理器和电池管理系统。我有几个问题。
制造商提供的电池管理系统等对象字典、电子数据表和设备配置文件?
我必须自己生成这些文件吗?
任何帮助将不胜感激!
解决方案
根据他们的文档,您需要提供电子数据表文件,查看 git repo ( https://github.com/christiansandberg/canopen/tree/3d3d46beae7f6aad65d58b1247eab5ae758fb9e2 ),很明显您需要 eds 文件:
# Add some nodes with corresponding Object Dictionaries
node = canopen.BaseNode402(35, '/home/andre/Code/test/jupiter.eds')
network.add_node(node)
# network.add_node(34, '/home/andre/Code/test/jupiter.eds')
# node = network[34]
创建节点时通常会提供对象字典文件node = network.add_node(6, 'od.eds')
,您可以在下面找到add_node
函数定义:
def add_node(self, node, object_dictionary=None, upload_eds=False):
"""Add a remote node to the network.
:param node:
Can be either an integer representing the node ID, a
:class:`canopen.RemoteNode` or :class:`canopen.LocalNode` object.
:param object_dictionary:
Can be either a string for specifying the path to an
Object Dictionary file or a
:class:`canopen.ObjectDictionary` object.
:param bool upload_eds:
Set ``True`` if EDS file should be uploaded from 0x1021.
:return:
The Node object that was added.
:rtype: canopen.RemoteNode
"""
也许您可以在这里找到所需的数据表:https ://compatibility.rockwellautomation.com/pages/search.aspx?crumb=117&q=EDS%20files
推荐阅读
- python - Python HTTP Server 远程下载文件
- python - Heroku 成功运行 heroku 容器后出现“缺少所需标志 -a --app”错误:push web 和 heroku 容器:release web
- python - python-semantic-release 用于同一存储库中的不同包?
- vue.js - 使用 Vuelidate 的表单验证未在屏幕上显示错误
- linux - Linux的系统调用GUI?
- reactjs - (Nx,React)快速刷新不适用于 /libs 下的任何文件,但在编辑 /apps 下的文件时有效
- javascript - Javascript 如果文档包含警报
- c++ - 可以将 std::transform() 设为异常无知吗?
- r - 您如何评估变量作为 R 中的选项名称?
- botframework - 如何在机器人之间共享上下文?