Can't log data in JSON format for FlatData and Shared Memory

4 posts / 0 new
Last post
Offline
Last seen: 4 years 11 months ago
Joined: 07/22/2019
Posts: 11
Can't log data in JSON format for FlatData and Shared Memory

Hello, 

I was able to log data from a publisher/subscriber using the recording service and a plugin library I created that selects certain fields from an idl structure that uses FlatData and Shared Memory and printing them into a .dat file (similar to what's taught in the tutorials) which can be viewed in a text editor. Now I'm trying to dump all of this info into a JSON file and then view all the fields, but my generated .dat file is empty. I'm using a custom profile qos xml for both readers and writers which uses XCDR2 and I'm copying the same qos for my recording service. 

The console doesn't throw any errors (other than a multicast communication warning that I'm addressing in a different post, but it doesn't prevent my log to record data when I'm using a plugin library). Does anybody have an idea on why I can log data using a plugin library but not in a JSON format? 

I'm attaching both xml files for the pub/sub qos and recording service, as well as the generated json files. 

Thanks

AttachmentSize
Package icon json_logging.zip6.86 KB
Offline
Last seen: 3 years 9 months ago
Joined: 01/15/2013
Posts: 94

Hi David,

When you say "Now I'm trying to dump all of this info into a JSON file and then view all the fields, but my generated .dat file is empty", what do you mean exactly? Are you publishing the same data but Recording Service set to record in JSON-sqlite format is not recording anything? Or are you using your custom plugin to read the data?

Thanks,

Juanlu

Offline
Last seen: 4 years 11 months ago
Joined: 07/22/2019
Posts: 11

Hi Juanlu, 

Sorry if I wasn't very clear. I am not using my custom plugin anymore, I'm recording in JSON-sqlite format and it doesn't throw any errors, but when I inspect the .dat file with sqlite it shows empty. I'm trying to record the topic with type "Images::Image". I attached the xml file where I set the JSON recording and the output files as well. Here's the extract of the json recording service xml 

 

<recording_service name="ImageFileWriterJson">
<!-- Storage properties. These are passed to the plugin in the
plugin_library -->
<storage>
<sqlite>
<storage_format>JSON_SQLITE</storage_format>
<file>json_rti_recorder_default</file>
<file_suffix>dat</file_suffix>
</sqlite>
</storage>
<!-- Domain Participant, by default in domain 0. Use the
-domainIdBase command-line parameter to adjust -->
<domain_participant name="Domain0">
<domain_id>0</domain_id>
<participant_qos base_name="MyQosLib::ShmemOnly"/>
</domain_participant>

 

<session name="Session">
<!-- Use only the topic and type this example expects -->
<topic_group name="Images_Image" participant_ref="Domain0">
<allow_topic_name_filter>*</allow_topic_name_filter>
<allow_type_name_filter>Images::Image</allow_type_name_filter>
</topic_group>
</session>
</recording_service>

Offline
Last seen: 4 years 11 months ago
Joined: 07/22/2019
Posts: 11

I realized what was my mistake. When defining the domain_participant, I forgot to add the <register_type> filed for the topic I was trying to record. Once I added the line 

<register_type name="Images_Image" type_ref="Images::Image"/>

After <participant_qos> it's working now!