Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeBasedFilter Policy Not Functional #193

Open
swhinton opened this issue May 19, 2023 · 0 comments
Open

TimeBasedFilter Policy Not Functional #193

swhinton opened this issue May 19, 2023 · 0 comments

Comments

@swhinton
Copy link

cyclonedds version = 0.10.3
cyclonedds-python version = 0.10.2

Assuming I understand the use case for the TimeBasedFilter QoS, I have been unable to get the TimeBasedFilter QoS policy to work. I have not experimented with the base C implementation or the C++ binding.

For a sanity check, I altered examples/vehicle, but I uncovered the problem in my specific application.

Expected behavior: subscriber.py prints the topic at approximately 1 Hz.
Actual behavior: subscriber.py prints the topic at approximately 10 Hz.

# Removed specific Topic QoS, using default.

domain_participant = DomainParticipant(0)
topic = Topic(domain_participant, 'Vehicle', Vehicle)
publisher = Publisher(domain_participant)
writer = DataWriter(publisher, topic)


vehicle = Vehicle(name="Dallara IL-15", x=200, y=200)


while True:
    vehicle.x += random.choice([-1, 0, 1])
    vehicle.y += random.choice([-1, 0, 1])
    writer.write(vehicle)
    print(">> Wrote vehicle")
    time.sleep(0.1)  # Changed to achieve ~ 10 Hz publish rate
class MyListener(Listener):
    def on_liveliness_changed(self, reader, status):
        print(">> Liveliness event")


listener = MyListener()

# Removed specific Topic QoS, using default.

reader_qos = Qos(
    Policy.TimeBasedFilter(duration(seconds=1))
)

domain_participant = DomainParticipant(0)
topic = Topic(domain_participant, 'Vehicle', Vehicle)
subscriber = Subscriber(domain_participant)
reader = DataReader(domain_participant, topic, reader_qos, listener=listener)


for sample in reader.take_iter(timeout=duration(seconds=2)):
    print(sample, datetime.now()) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant