Skip to content

Prompt [PARTICIPANT Error] error #52

Open
@1130164523

Description

@1130164523

I would like to use the "contentfilteredtopic" feature. Here is my test code. Could you please tell me where I went wrong?
Here is the full error message:
2023-06-10 16:01:28.942 [DDSSQLFILTER Error] No TypeObject found for type HelloWorldtype -> Function eprosima::fastdds::dds::DDSSQLFilter::DDSFilterFactory::create_content_filter 2023-06-10 16:01:28.942 [PARTICIPANT Error] Could not create filter of class DDSSQL for expression "index > 5 -> Function eprosima::fastdds::dds::DomainParticipantImpl::create_contentfilteredtopic

Here is the full code:
`
import asyncio
import os
import argparse
import time
from ctypes import byref
from threading import Condition

if os.name == 'nt':
import win32api

win32api.LoadLibrary('HelloWorld')

import fastdds
import HelloWorld

class ReaderListener(fastdds.DataReaderListener):
def init(self, callback):
super().init()
self._callback = callback

def on_data_available(self, reader):
    info = fastdds.SampleInfo()
    data = HelloWorld.HelloWorld()
    reader.take_next_sample(data, info)
    self._callback.put_nowait(f"Received {data.message()} {data.index()}")

def on_subscription_matched(self, datareader, info):
    print(f"ReaderListener info.current_count_change {info.current_count_change}")
    if (0 < info.current_count_change):
        print("Subscribers matching Publishers {}\r\n".format(info.last_publication_handle))
    else:
        print("Publisher with mismatched subscribers {}\r\n".format(info.last_publication_handle))

class Reader():
def init(self, domain=0, callback=None):
factory = fastdds.DomainParticipantFactory.get_instance()
self.participant_qos = fastdds.DomainParticipantQos()
factory.get_default_participant_qos(self.participant_qos)
self.participant = factory.create_participant(domain, self.participant_qos)

    self.topic_data_type = HelloWorld.HelloWorldPubSubType()
    self.topic_data_type.setName("HelloWorldtype")
    self.type_support = fastdds.TypeSupport(self.topic_data_type)
    self.participant.register_type(self.type_support)


    self.topic_qos2 = fastdds.TopicQos()
    self.participant.get_default_topic_qos(self.topic_qos2)
    self.topic2 = self.participant.create_topic("HelloWorldTopic2", "HelloWorldtype", self.topic_qos2)


    self.filter_topic =self.participant.create_contentfilteredtopic("FilteredTopic", self.topic2,r"index > 5", [])

    self.subscriber_qos = fastdds. SubscriberQos()
    self.participant.get_default_subscriber_qos(self.subscriber_qos)
    self.subscriber = self.participant.create_subscriber(self.subscriber_qos)

    self.listener2 = ReaderListener(callback)
    self.reader_qos2 = fastdds.DataReaderQos()
    self.subscriber.get_default_datareader_qos(self.reader_qos2)
    self.reader = self.subscriber.create_datareader(self.filter_topic, self.reader_qos2, self.listener2)

def __del__(self):
    factory = fastdds.DomainParticipantFactory.get_instance()
    self.participant.delete_contained_entities()
    factory.delete_participant(self.participant)

import asyncio.queues

async def task_handler(_queue):

while True:
    try:

        eventobj = await _queue.get()
        print(eventobj)
        _queue.task_done()
    except Exception as e:
        print(e)

async def msg(info):
print(11)

if name == 'main':
async def main():
try:
_queue = asyncio.Queue()
bb = Reader(callback=_queue)
asyncio.create_task(task_handler(_queue))
while 1:
await asyncio.sleep(1)
except Exception as e:
print(e)

    del bb


asyncio.run(main())

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions