rticonnextdds-connector python3 problems

12 posts / 0 new
Last post
Offline
Last seen: 5 years 4 months ago
Joined: 03/26/2019
Posts: 4
rticonnextdds-connector python3 problems

Hey there, 

I'm trying to create a testing application for some of our systems and I'm using the python connector to implement it. I've been successful reading and pubishing data using the connector with python2.7, but when I try to use it with python3 I can't seem to ever get a valid sample. No errors are displayed but no data is ever received. 

According to the github the connector should support Python 3.6, but I seem to be having no luck getting it to work. Any help would be appreciated.

Thanks!

gianpiero's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

Hello Andrew,

Thank you for writing about your issue with the Python Connector. I just run the simple/writer.py and simple/reader.py that we have on github [here] and it seems to work. I am on a mac with python 3.6. 

Can you verify if the simple example works for you?

Best,
   Gianpiero

Offline
Last seen: 5 years 4 months ago
Joined: 03/26/2019
Posts: 4

Hi Gianpiero,

Sorry for the delayed response. It seems that there was a version mismatch between python 2 and 3. Python 2 was using the 0.3.3 version of the connector while Python3 was using 0.4.4. When I installed the 0.3.3 version for python 3 it seemed to work fine. Not sure what was causing the issue in the new version.

Regards,

Andrew

Offline
Last seen: 5 years 7 months ago
Joined: 04/04/2019
Posts: 2

Hello,

I am coming across a similar issue trying to test our system. I am using Python 2.7.15, and when I use 0.3.3 in my tool, I am able to read samples published by our system no problem. If I use version 0.4.4 in my tool however, the samples are not read. The one exception to this is when I use 0.3.3 first, stop my tool that uses the rti connector, install 0.4.4, and use the tool again. Then, for a minute or two, the tool is able to read the samples published by our system, then later fails to read any samples. The xml file I use doesn't change at all. 

I also made a simple reader and writer program similar to the Shapes example, only using the xml file for our system. When the samples are published by the simple writer, the reader is able to pick them up. It seems that 0.4.4 is causing some issues with the communication between connector and the samples published by our system?

Regards,

Daniel

 

gianpiero's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

Hello there,

@andrewindoe: glad you solved the issue. 

 @minad

As I mention in github:

There should not be difference between the two versions when it comes to receive samples. Be aware that now when you iterate through sample you have to start from 0 so old code may miss the first sample and go one over and crash.

Beside that, is what you call "our system" a c-system? Is it compiled against Connext 6? (Connector >= 0.4) is based on the new Connext 6.  You can look at this migration guide to learn more about compatibility between versions: 

https://community.rti.com/static/documentation/connext-dds/6.0.0/doc/manuals/migration_guide/index.html

I hope this helps,

 Gianpiero

Offline
Last seen: 5 years 7 months ago
Joined: 04/04/2019
Posts: 2

Hello,

Our system is written in traditional C++. It uses RTI 5.2.0. Is 0.4.4 not backwards compatible with older versions of RTI? If so I guess that could be the issue.

The iterating through samples starting at 0 isn't the issue, as I accounted for that when using 0.4.4.

Thanks,

Daniel 

 

gianpiero's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

Hi @minad,

That may be the issue. Connext 6 is backward compatible with older versions but you most likely have to do some extra qos configurations. For example for the wire compatibility. See here for more info. 

Best,
  Gianpiero

Offline
Last seen: 4 years 10 months ago
Joined: 04/13/2019
Posts: 9

Python Connector for Connext v6.0.0 "Failed to auto-enable entity"

I tried my *QoS.xml files that were working with RTI Connector for Connext DDS v5.3.* and I get these errors :

[D0000|Sub(80000009)|T=rov_beacon|CREATE Reader]
PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo:no space on heap for structure of size 2147482623 bytes aligned at 0 bytes
PRESPsService_enableLocalEndpointWithCursor:failed to attach endpoint to typePlugin
PRESPsService_enableLocalEndpoint:!enable local endpoint
DDS_Subscriber_create_datareader:ERROR: Failed to auto-enable entity
DDS_FactoryXmlPlugin_createDataReadersWithNamesI:!create DataReader
DDS_FactoryXmlPlugin_createDataReaders:!create DataReaders from XML DataReader "::MyParticipantLibrary::Zero::MySubscriber::MyRovBeaconReader"

On Win10 x64 I installed using git clone of rticonnextdds-connector-py.
Using Python 3.7.2, the .\examples\simple\reader.py could see the writer.py data.

I then incrementally added my QoS information to the ShapeExample.xml and had
no errors until I added my reader to <subscriber with the MySquareReader.
<data_reader name="MyRovBeaconReader" topic_ref="rov_beacon" />

I have the same results on Ubuntu 18.04.

Bill

Offline
Last seen: 4 years 10 months ago
Joined: 04/13/2019
Posts: 9

I'm attaching the ShapeExample_QoS.xml file for my above post. Uncommenting the  <data_reader name="MyRovBeaconReader"... line will produce the above error.

I've been using this QoS.xml file OK with the Python Connector for Connext DDS v5.3.1.

I'm wondering if it has anything in common with marknelson's "Python on Windows" forum topic.

File Attachments: 
Offline
Last seen: 3 weeks 4 days ago
Joined: 10/22/2018
Posts: 91

Hi webhopper,

Using the XML file that you attached, I was able to reproduce your issue.

I believe that the issue is relatd to the unbounded strings in your type.
There is a migration guide topic on the subject here.
In summary, previously, unbounded strings (such as those in your ROVBeacon type) were in fact bounded to a default max length of 255. We removed this limitation with our latest release (Connext 6.0.0).

If your strings really are unbounded, then you will ned to modify the memory usage of the application. If they are not truly unbounded, you should use the stringMaxLength parameter to set their bound in the type of your XML file.


I tested this with your reproducer and was able to run the application in Connext 6.0.0 when I limited the string length.


Hope this helps,
Sam

Offline
Last seen: 4 years 10 months ago
Joined: 04/13/2019
Posts: 9

Sam,

Adding the stringMaxLength worked great! I didn't add it to the const strings. The only other change was the reader index from 1 to 0 and everything is working like 5.3.

Hopefully I'll be able to contribute something to the OpenROV Trident community.

Thanks much,

Bill

Offline
Last seen: 2 years 5 months ago
Joined: 11/28/2017
Posts: 3

Hey there, 

I'm trying to create an application that sends the node's information of a Kubernetes cluster. This application runs on a docker container executed in the cluster and gathers the required information (CPU, etc.). Once the application has the info, it sends it to other elements through rticonnextdds-connector python. Thus, I configured a datawriter to do that. Moreover, I also configured a datareader to receive some information from external components. Then, I enable only a participant with the datawriter and datareader previously mentioned. I have attached the .XML file with the whole configuration.

My application has several classes, and one of them is named DDS_Algo (see dds.txt file). I create an instance of DDS_Algo class from my main class to create the connector, the output and the input elements. In this manner, I can use the output element to send information through DDS from my main class. Meanwhile, in a parallel process, I execute a method of DDS_Algo class to read any information with the input element. 

In the beginning, everything appears to work fine, but then there is an error that stops the reader's execution. I searched for any clue, but unfortunately, I could not solve my problem. 

The app's output and the error are as follows:

<function Connector.get_version at 0x7fcfcfec75b0>

Waiting for publications...

{'name': 'kubernetes-control-plane1-dw'}

Waiting for data...

{'name': 'kubernetes-control-plane1-dr'}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 2}

{'Identificador': 'Node_Status', 'NodeId': 'kind-control-plane', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 1, 'length': 2}

{'Identificador': 'Node_Status', 'NodeId': 'kind-worker', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 2}

{'Identificador': 'Node_Status', 'NodeId': 'kind-worker2', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 1, 'length': 2}

{'Identificador': 'Node_Status', 'NodeId': 'kind-worker3', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'name': 'kubernetes-control-plane1-dr'}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 1}

{'Identificador': 'Node_Status', 'NodeId': 'kind-control-plane', 'TerminationPointId': '927.1178', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 3}

{'Identificador': 'Node_Status', 'NodeId': 'kind-worker', 'TerminationPointId': '100.2001', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 1, 'length': 3}

{'Identificador': 'Node_Status', 'NodeId': 'kind-worker2', 'TerminationPointId': '100.0852', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 2, 'length': 3}

{'Identificador': 'Node_Status', 'NodeId': 'kind-worker3', 'TerminationPointId': '100.3094', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}

{'name': 'kubernetes-control-plane1-dr'}

RTILuaMetamethodImpl_InDataIndexing:index must be > 0

Exception in thread Thread-6 (read_samples):

Traceback (most recent call last):

File "/usr/local/lib/python3.10/threading.py", line 1009, in _bootstrap_inner

self.run()

File "/usr/local/lib/python3.10/threading.py", line 946, in run

self._target(*self._args, **self._kwargs)

File "/app/dds.py", line 219, in read_samples

for sample in self.reader.samples.valid_data_iter:

File "/usr/local/lib/python3.10/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 782, in __next__

while self.index + 1 < self.length and not self.input.infos.isValid(self.index + 1):

File "/usr/local/lib/python3.10/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 599, in isValid

_check_retcode(retcode)

File "/usr/local/lib/python3.10/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 89, in _check_retcode

raise Error("DDS Exception: " + _get_last_dds_error_message())

rticonnextdds_connector.rticonnextdds_connector.Error: DDS Exception:

RTILuaMetamethodImpl_InDataIndexing:index must be > 0

I hope that anyone can help me because at this moment I'm blocked. 

I appreciate any help you can provide.

Alex