qth_yarp API¶
Qth to Value Functions¶
The following functions can be used to fetch a yarp.Value
representing Qth properties or event.
-
qth_yarp.get_property(topic, initial_value=None, register=False, description=None, one_to_many=False, delete_on_unregister=True, qth_client=None, **kwargs)[source]¶ Return a (continuous)
yarp.Valuecontaining the value of a qth property.Parameters: - topic : str
The Qth topic name. (Not verified for existance).
- initial_value : object
The initial value to assign to the returned
yarp.Valuewhile waiting for the property to arrive from Qth. Defaults toNonebut you may wish to choose an alternative dummy value which won’t crash later processing.If (and only if)
registeris True, also sets the Qth property to this value.- register : bool
If True, registers this property with Qth. The ‘description’ argument must also be provided if this is True.
- description : str
If
registeris True, the description of the property to include with the registration.- one_to_many : bool
If
registeris True, is this a one-to-many (True) or many-to-one (False) property. Defaults to many-to-one (False).- on_unregister : value
(Keyword-only argument). The value to set this property to when this Qth client disconnects. If not provided, no change is made. If this argument is used, set
delete_on_unregisterto False since it defaults toTrueand will conflict with this argument.- delete_on_unregister : bool
(Keyword-only argument). Should this value be deleted when this Qth client disconnects? Defaults to
True.- qth_client :
qth.Client The Qth
qth.Clientobject to use. If not provided, uses the client returned byget_default_qth_client().
-
qth_yarp.watch_event(topic, register=False, description=None, one_to_many=False, qth_client=None, **kwargs)[source]¶ Return an (instantaneous)
yarp.Valuerepresenting a qth event.Parameters: - topic : str
The Qth topic name. (Not verified for existance).
- register : bool
If True, registers this event with Qth. The ‘description’ argument must also be provided if this is True.
- description : str
If
registeris True, the description of the event to include with the registration.- one_to_many : bool
If
registeris True, is this a one-to-many (True) or many-to-one (False) event. Defaults to many-to-one (False).- on_unregister : value
(Keyword-only argument). The value send for this event to when this Qth client disconnects. If not provided, event is sent.
- qth_client :
qth.Client The Qth
qth.Clientobject to use. If not provided, uses the client returned byget_default_qth_client().
The next two functions use a yarp.Value to set or send a Qth
property or event.
-
qth_yarp.set_property(topic, value, register=False, description=None, one_to_many=True, delete_on_unregister=True, ignore_no_value=True, qth_client=None, **kwargs)[source]¶ Set a Qth property to the value of a continuous
yarp.Value.Parameters: - topic : str
The Qth topic name. (Not verified for existance).
- value :
Value The
yarp.Valuewhose value will be written to the specified qth property.- register : bool
If True, registers this property with Qth. The ‘description’ argument must also be provided if this is True.
- description : str
If
registeris True, the description of the property to include with the registration.- one_to_many : bool
If
registeris True, is this a one-to-many (True) or many-to-one (False) property. Defaults to one-to-many (True).- on_unregister : value
(Keyword-only argument). The value to set this property to when this Qth client disconnects. If not provided, no change is made. If this argument is used, set
delete_on_unregisterto False since it defaults toTrueand will conflict with this argument.- delete_on_unregister : bool
(Keyword-only argument). Should this value be deleted when this Qth client disconnects? Defaults to
True.- ignore_no_value : bool
(Keyword-only argument). Should the property not be written when ‘NoValue’ is set. Defaults to
True. IfFalse, the property will be deleted when set to ‘NoValue’.- qth_client :
qth.Client The Qth
qth.Clientobject to use. If not provided, uses the client returned byget_default_qth_client().
-
qth_yarp.send_event(topic, value, register=False, description=None, one_to_many=True, qth_client=None, **kwargs)[source]¶ Return an (instantaneous)
yarp.Valuerepresenting a qth event.Parameters: - topic : str
The Qth topic name. (Not verified for existance).
- value :
yarp.Value An instantaneous
yarp.Valuewhose changes will be turned into qth events.- register : bool
If True, registers this event with Qth. The ‘description’ argument must also be provided if this is True.
- description : str
If
registeris True, the description of the event to include with the registration.- one_to_many : bool
If
registeris True, is this a one-to-many (True) or many-to-one (False) event. Defaults to one-to-many (True).- on_unregister : value
(Keyword-only argument). The value send for this event to when this Qth client disconnects. If not provided, event is sent.
- qth_client :
qth.Client The Qth
qth.Clientobject to use. If not provided, uses the client returned byget_default_qth_client().
In all cases, the Values will not be updated, nor will value changes be sent to
Qth until the asyncio mainloop is started. See
run_forever().
Specifying the Qth Client¶
The functions defined above accept a qth_client parameter giving the
qth.Client object to use. The following function can be used
(before any calls to the qth_yarp functions) to specify a specific
qth.Client instance to use.
-
qth_yarp.set_default_qth_client(client)[source]¶ Set the default
qth.Clientobject to be used by qth_yarp.
If this function is not called, a Qth qth.Client will be created
automatically. To fetch the Qth instance used, call:
-
qth_yarp.get_default_qth_client()[source]¶ Get the default
qth.Clientobject.One will be created with the name
qth_yarp_based_clientif no client has been provided byset_default_client().