Jump to content
OpenSplice DDS Forum

How to create a Vortex DDS topic using python and statically created classes?

Recommended Posts

Hi, I've been trying to use the Vortex OpenSplice Community edition  with Python (version 3.6 within a PyEnv virtual environment) on Ubuntu 20.04.2 LTS. I've followed the PythonDCPSAPIGuide and been able to get the python examples in ($OSPL_HOME/tools/python/examples) working. However I can't figure out how to create a topic in a domain participant for a statically generated topic class using 'idlpp'. How would I be able to do this  (I also can't see this in the documentation)?

What I have done so far:

I have an IDL file that has include paths for quite a few other IDL files. I have converted these IDL files to a python Topic classes using the following bash script: 


for FILE in *.idl; do
  $OSPL_HOME/bin/idlpp -I $OSPL_HOME/etc/idl -S -l python -d . $FILE

This creates a series of python packages (python topic classes) that I import into my python script which is in the same directory.

Using these packages I would like to create or register a topic with a domain participant in my python script. For example something like the following python code, (however the 'create_topic' function doesn't exist):

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()

Would this be possible and if so how would I be able to register a topic that I have statically created with a domain participant in python?

I noticed in the examples (e.g. $OSPL_HOME/tools/python/examples/example1.py) a topic is registered dynamically using the following code below, but I don't think this relates to statically generated python topic classes:

dp = DomainParticipant()
gen_info = ddsutil.get_dds_classes_from_idl('idl/HelloWorldData.idl', 'HelloWorldData::Msg')
topic = gen_info.register_topic(dp, 'Msg1')

I also couldn't see a relevant function in the source code here.
I apologise if this is a simple question or if I have missed something - I am very new to Vortex OpenSplice DDS.

Any help would be greatly appreciated.


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...