I'm working on a project which I'm using pprzlink in. I created a couple of decorator classes for subscribing to messages and I was wondering if they are a good addition to pprzlink.
There is IvySubscribe that will bind the function to a list of message types:
# To one message type
@IvySubscribe(ivy_link=ivy, message_types=[("ground", "NEW_AIRCRAFT")])
def new_aircraft_callback(ac_id, msg):
pass
# RegEx is also supported
@IvySubscribe(ivy_link=ivy, message_types=["(.*)")])
def new_aircraft_callback(ac_id, msg):
pass
# Subscribe to all
@IvySubscribe(ivy_link=ivy)
def get_all_messages(ac_id, msg):
pass
I created IvySubscribeOnce that stop listening for that type of message as soon as it receives one (useful for the new request messages):
I'm working on a project which I'm using pprzlink in. I created a couple of decorator classes for subscribing to messages and I was wondering if they are a good addition to pprzlink.
There is
IvySubscribe
that will bind the function to a list of message types:I created
IvySubscribeOnce
that stop listening for that type of message as soon as it receives one (useful for the new request messages):And if you needed to unbind manually you can use
get_all_messages.__ivy_subs__.unsubscribe()
.They are useful in my project, but whether it's a good idea to have them as a part of pprz_link itself, I don't know. What do you think?