comuncation between python and labview using connextdss

2 posts / 0 new
Last post
Offline
Last seen: 2 months 1 week ago
Joined: 09/12/2023
Posts: 1
comuncation between python and labview using connextdss

Hello,

I'm just starting to learn how DDS works.

I have installed connextdss and downlaoded the python examples for the simple reader and writer. These work fine with the data written by one and read by the other.

Many of our existing project use LabVIEW so i've downloaded the rti Labview Toolkit and run the basic example VIs to read and write - again these work fine.

My question is how do enable the LabVIEW toolkit to read and write to the same data stream being generated by the python example? I'm assuming both python and LabVIEW are using the same install connextdds backend?

I've looked through the python XML file and tried using the two different topic names but LabVEIW doesn't seem to recieve any data. My guess is I need to use the advanced read fucntion but I'm unsure what these fields are asking and where i can find them in the XML?

Do I need to edit the XML to include the LabVIEW toolkit?

Thanks!

Ollie

 

<?xml version="1.0"?>
<!--
(c) 2005-2015 Copyright, Real-Time Innovations.  All rights reserved.
No duplications, whole or partial, manual or electronic, may be made
without express written permission.  Any such copies, or revisions thereof,
must display this notice unaltered.
This code contains trade secrets of Real-Time Innovations, Inc.
 -->
<ddsxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/current/rti_dds_qos_profiles.xsd">
    <!-- Qos Library -->
    <qos_libraryname="QosLibrary">
        <qos_profilename="DefaultProfile"
                     base_name="BuiltinQosLib::Generic.StrictReliable"
                     is_default_qos="true">
            <domain_participant_qos>
                <participant_name>
                    <name>Connector Shape Example</name>
                </participant_name>
            </domain_participant_qos>
        </qos_profile>
    </qos_library>
    <!-- types -->
    <types>
        <structname="ShapeType"extensibility="extensible">
            <membername="color"stringMaxLength="128"type="string"key="true"/>
            <membername="x"type="long"/>
            <membername="y"type="long"/>
            <membername="shapesize"type="long"/>
        </struct>
        <enumname="ShapeFillKind"extensibility="extensible">
            <enumeratorname="SOLID_FILL"value="0"/>
            <enumeratorname="TRANSPARENT_FILL"value="1"/>
            <enumeratorname="HORIZONTAL_HATCH_FILL"value="2"/>
            <enumeratorname="VERTICAL_HATCH_FILL"value="3"/>
        </enum>
        <structname="ShapeTypeExtended"baseType="ShapeType"extensibility="extensible">
            <membername="fillKind"type="nonBasic"nonBasicTypeName="ShapeFillKind"/>
            <membername="angle"type="float"/>
        </struct>
    </types>
    <!-- Domain Library -->
    <domain_libraryname="MyDomainLibrary">
        <domainname="MyDomain"domain_id="0">
            <register_typename="ShapeType"type_ref="ShapeType"/>
            <topicname="Square"register_type_ref="ShapeType"/>
            <topicname="Circle"register_type_ref="ShapeType"/>
        </domain>
    </domain_library>
    <!-- Participant library -->
    <domain_participant_libraryname="MyParticipantLibrary">
        <domain_participantname="MyPubParticipant"domain_ref="MyDomainLibrary::MyDomain">
            <publishername="MyPublisher">
                <data_writername="MySquareWriter"topic_ref="Square"/>
            </publisher>
        </domain_participant>
        <!-- We use separate participants because we run the writer and the reader
            on different applications, and wouldn't want to create the reader
            in writer.py, or the writer in reader.py -->
        <domain_participantname="MySubParticipant"domain_ref="MyDomainLibrary::MyDomain">
            <subscribername="MySubscriber">
                <data_readername="MySquareReader"topic_ref="Square"/>
            </subscriber>
        </domain_participant>
        <!-- You can also define the reader and writer inside the same
            connector instance if you plan to use both in the same application.
        -->
        <domain_participantname="MyParticipant"domain_ref="MyDomainLibrary::MyDomain">
            <publishername="MyPublisher">
                <data_writername="MySquareWriter"topic_ref="Square"/>
            </publisher>
            <subscribername="MySubscriber">
                <!-- Uncomment this if you don't want the Input to start receiving
                    data before you call Connector.get_input()
                -->
                <!--
                <subscriber_qos>
                    <entity_factory>
                        <autoenable_created_entities>false</autoenable_created_entities>
                    </entity_factory>
                </subscriber_qos>
                -->
                <data_readername="MySquareReader"topic_ref="Square"/>
            </subscriber>
        </domain_participant>
        <!-- The transform.py script reads Squares and writes Circles -->
        <domain_participantname="TransformationParticipant"domain_ref="MyDomainLibrary::MyDomain">
            <subscribername="MySubscriber">
                <data_readername="MySquareReader"topic_ref="Square"/>
            </subscriber>
            <publishername="MyPublisher">
                <data_writername="MyCircleWriter"topic_ref="Circle"/>
            </publisher>
        </domain_participant>
        <domain_participantname="CircleSubParticipant"domain_ref="MyDomainLibrary::MyDomain">
            <subscribername="MySubscriber">
                <data_readername="MyCircleReader"topic_ref="Circle"/>
            </subscriber>
        </domain_participant>
    </domain_participant_library>
</dds>
 
 

 

 

Ismael Mendez's picture
Offline
Last seen: 10 months 16 hours ago
Joined: 07/03/2017
Posts: 74

Hi om327,

The RTI DDS Toolkit uses Connext DDS in the backed. But not the one you have installed. It comes with its own Connext DDS libraries. The lates version of the LabVIEW toolkit (3.1.1) is based on Connext DDS 6.0.1.

You are not using the correct vis. You are using a builtin read vi for reading a Shapes DataType. This is not possible. The builtin read vis only works for simple types such as integers or booleans. There is a shipped example of the Shapes Demo in LabVIEW in the LabVIEW window go to Help->Find Examples->RTI DDS Toolkit->Shapes Demo. There you have a reader and a writer that will communicate with your Python application.

I assume at some point you want to use your own custom type instead the Shapes Demo example. For custom types (clusters) you need to generate specific LabVIEW code for that type. That code is generated specifically with a tool called "Complex Type Generator". It is installed with the DDS LabVIEW Toolkit. You have in the LabVIEW top bar Tools->RTI DDS LabVIEW Toolkit->RTI DDS Complex Type Generator. That tool accepts as inputs a ctl file. That ctl file will represent your DataType (same as idl/xml do in C or Pyhthon application). Unfortunately there is no way of translating automatically an xml or idl to a ctl. You have to do it manually.

Once you have your generated vis you can use in your LabVIEW code and communicate with your Python application. I recommend you to check section 4.2 "Lesson 2—Using ComplexType Generator to Publish and Subscribe to Complex Data (Clusters)" of the Getting Started Guide. You can open it by clicking in a labVIEW window in Help->RTI DDS LabVIEW Toolkit. there you have explained the process to sue custom types with the RTI DDS LabVIEW Toolkit.

 

Regards

Ismael