rticonnextdds_connector

5 posts / 0 new
Last post
Offline
Last seen: 7 years 4 months ago
Joined: 02/07/2017
Posts: 14
rticonnextdds_connector

I am trying to get the py.test examples working with my .xml file and test data.. 

I keep getting this error: 

DDS_DynamicDataTypePlugin_process_primitive_cdr_value:invalid enumerator value
DDS_DynamicDataTypePlugin_parametrized_cdr_to_cdr:error copying CDR value
DDS_DynamicDataTypePlugin_parametrized_cdr_to_cdr:error converting from extended CDR to CDR
DDS_DynamicDataTypePlugin_deserialize:error converting from extended CDR to CDR
PRESCstReaderCollator_storeSampleData:!deserialize

I am using the test_rticonnectdds_datflow.py example and modifying this by inserting my data and using my .xml file..

I am sure i am using the correct data types.. but i can't figure this out.

code 

def testMsg(self):
"""
A class-scoped `pytest.fixture <https://pytest.org/latest/builtin.html#_pytest.python.fixture>`_
which instantiates a test message to test the flow of data between an Input and Output object.

:returns: A class scoped test message
:rtype: `Dictionary <https://docs.python.org/3/tutorial/datastructures.html#dictionaries>`_

"""
return {"level": 2, "state": 2, "objectId": 100, "alertId": 1000, "acknowledged": False, "description": "alert because of pump high press"}

 

def test_getTypes(self,rtiInputFixture,testMsg):
"""
This function tests the correct operation of
:func:`rticonnextdds_connector.Samples.getString`,
:func:`rticonnextdds_connector.Samples.getNumber` and
:func:`rticonnextdds_connector.Samples.getBoolean`.
Received values should be the same as that of :func:`testMsg`

:param rtiInputFixture: :func:`conftest.rtiInputFixture`
:type rtiInputFixture: `pytest.fixture <https://pytest.org/latest/builtin.html#_pytest.python.fixture>`_
:param testMsg: :func:`testMsg`
:type testMsg: `pytest.fixture <https://pytest.org/latest/builtin.html#_pytest.python.fixture>`_
"""

lev = rtiInputFixture.samples.getNumber(2, "level")
stat = rtiInputFixture.samples.getNumber(2, "state")
obid = rtiInputFixture.samples.getNumber(100, "objectId")
alid = rtiInputFixture.samples.getNumber(1000, "alertId")
ack = rtiInputFixture.samples.getBoolean(0, "acknowledged")
desc = rtiInputFixture.samples.getString(0, "description")
assert lev == testMsg['level'] and stat == testMsg['state'] \
and obid == testMsg['objectId'] \
and alid == testMsg['alertId'] \
and ack == testMsg['acknowledged'] \
and desc == testMsg['description']

 

best regards,

Nick

Organization:
gianpiero's picture
Offline
Last seen: 11 months 2 weeks ago
Joined: 06/02/2010
Posts: 177

Hello Nick,

I would suggest to use the python examples that are in examples/python/simple. I will start with those so you remove all the 'testing' logic and we can focus on the error you are getting. 

If you are still getting the error once you move to those simple example, would it be possible for you to share a reproducer so i can look into it?

Best,
  Gianpieor

Offline
Last seen: 7 years 4 months ago
Joined: 02/07/2017
Posts: 14

Hi Gianpiero, i am getting the examples to work ok.. they also work with my modified datasets.. (.xml file) .. I am having trouble when using the py.test examples in test/python/example/test_rticonnextdds_dataflow.py I think my problem  is with the old data staying in the DDS Cache.. I am trying to add a cleanup function in Conftest.py

I am trying to call delete on rti.connector or clear_members on rti.output..  

best regards,

Nick

 

 

Offline
Last seen: 7 years 4 months ago
Joined: 02/07/2017
Posts: 14

yes the examples work fine.. its just i have trouble running the py.tests with my own data.. do you think you could try?  im attaching my .xml file... Ive tried to add the data into a modified test_rticonnextdds_dataflow.py

when the first assert is occuring i get no data being passed.. 

 

File Attachments: 
gianpiero's picture
Offline
Last seen: 11 months 2 weeks ago
Joined: 06/02/2010
Posts: 177

Hello,

If I understand correctly you have old data when you do write in a loop? Is that correct? If yes, did u try to do output:clear_members() right after your write ?

--Gianpiero