Python DDS: OSError: exception: access violation

6 posts / 0 new
Last post
Offline
Last seen: 4 years 7 months ago
Joined: 03/01/2020
Posts: 8
Python DDS: OSError: exception: access violation

Dear All!

 

I am trying to publish some sensor data via DDS from Python code.

Basically, the relevant parts of the code are:

with rti.open_connector(config_name="MyParticipantLibrary::MyPubParticipantT", url="Definition.xml") as connector:
self.output=connector.get_output("a::MyWriterT")
self.output.wait_for_subscriptions()

self.dds_instance=self.output.instance

 

And after some steps within the statemachine:

self.dds_instance.set_number("temperature",30)
self.output.write()

On both red lines it throws an exception of access violation with traceback to:

File "...\site-packages\rticonnextdds_connector\rticonnextdds_connector.py", line 944, in set_number
_check_retcode(connector_binding.set_number_into_samples(
OSError: exception: access violation reading 0x066E10B0

 

The strange thing is that if I copy the red lines right after the first code, it runs correctly.

Do you have any idea what can be the issue?

Thanks in advance:

 

Benedek

 

 

Offline
Last seen: 2 months 1 week ago
Joined: 10/22/2018
Posts: 91

Hey,

Are you able to share your Definition.xml file?

Offline
Last seen: 4 years 7 months ago
Joined: 03/01/2020
Posts: 8

sure, however I don't think that causes the error, because if I copy the red lines right after the first code, it works.

File Attachments: 
Offline
Last seen: 2 months 1 week ago
Joined: 10/22/2018
Posts: 91

Ok, sorry I missed that.

So if you don't do the steps within the state machine it works? In which case, what do you do within the state machine? Are you modifying any of the Connector objects?

Since you have said that the exception occurs on both of the red lines, I would guess it could be related to the output object (since that object is common between both operations)

Offline
Last seen: 4 years 7 months ago
Joined: 03/01/2020
Posts: 8

Basically, not that much:

  • create a new instance of the server class --> in its constructor do the lines of the first code
  • then go to another state
  • in that state call the send_data_to_server method that runs the red lines 

For me, it seems I cannot access to any methods related to the connector I previously opened, altough I can access the attributes.

Offline
Last seen: 4 years 7 months ago
Joined: 03/01/2020
Posts: 8

I think I got it:

I should use 

self.connector=rti.Connector(config_name="MyParticipantLibrary::MyPubParticipantT", url="Definition.xml")

instead of rti.open_connector method.

Thanks anyway,

 

Benedek