【发布时间】:2021-04-27 13:58:16
【问题描述】:
我一直在尝试在 Ubuntu 20.04.2 LTS 上使用凌华科技的 Vortex OpenSplice Community edition 和 Python API(PyEnv 虚拟环境中的 Python 版本 3.6)。我已经关注PythonDCPSAPIGuide 并让 ($OSPL_HOME/tools/python/examples) 中的 python 示例正常工作。但是,我不知道如何使用idlpp 为静态生成的主题类创建与域参与者关联的主题。我怎么能做到这一点?
我有一个 IDL 文件,其中包含许多其他 IDL 文件的路径。我已使用以下 bash 脚本将这些 IDL 文件转换为 python 主题类:
#!/bin/bash
for FILE in *.idl; do
$OSPL_HOME/bin/idlpp -I $OSPL_HOME/etc/idl -S -l python -d . $FILE
done
这将创建一系列 python 包(python 主题类),我将它们导入到同一目录中的 python 脚本中。
使用这些包,我想在我的 python 脚本中创建或注册一个域参与者的主题。例如下面的python代码,(但是'create_topic'函数不存在):
# myExampleDDSFile.py
from dds import *
from foo import foo_type # idlpp generated module/class
from foo2 import foo_type2 # idlpp generated module/class
dp = DomainParticipant()
topic = dp.create_topic('foo_topic',foo_type) # this function doesn't exist for a domain participant
pub = dp.create_publisher()
这可能吗?如果可以,我如何注册我在 python 中与域参与者静态创建的主题?
我注意到在提供的 python 示例(例如 $OSPL_HOME/tools/python/examples/example1.py)中,使用下面的代码动态注册了一个主题,但我认为这与静态生成的 python 主题类无关:
# example1.py snippet
dp = DomainParticipant()
gen_info = ddsutil.get_dds_classes_from_idl('example1.idl', 'basic::module_SequenceOfStruct::SequenceOfStruct_struct')
topic = gen_info.register_topic(dp, 'Example1')
我在source code 中也看不到相关功能。
如果这是一个简单的问题或者我遗漏了什么,我深表歉意 - 我对 Vortex OpenSplice DDS 非常陌生。
任何帮助将不胜感激。
【问题讨论】:
标签: python data-distribution-service opensplice