Remote#
- class lsst.ts.salobj.Remote(domain, name, index=None, *, readonly=False, include=None, exclude=None, evt_max_history=1, start=True, num_messages=1, consume_messages_timeout=0.1)#
Bases:
objectA class that issues commands to a SAL component and receives telemetry and events from that component.
If a SAL component listens to or commands other SAL components then it will have one Remote for each such component.
- Parameters:
domain (
Domain) –DDS Domain. If you have a
Controllerthen use itsdomainattribute. Otherwise create your ownDomainand close it when you are done, for example:async with Domain() as domain: dome = Remote(domain=domain, name="ATDome", index=0)
name (
str) – Name of SAL component.index (
intorNone, optional) – SAL component index, or 0 or None if the component is not indexed. A value is required if the component is indexed.readonly (
bool) – If True then do not provide commands.include (
iterableofstr, optional) – Names of topics (telemetry or events) to support, for example [“FilterChangeInPosition”, “TrackingTarget”] IfNonethen all are included except those inexclude.exclude (
iterableofstr, optional) – Names of topics (telemetry or events) to not support. Topic names must not have atel_orevt_prefix. IfNoneor empty then no topics are excluded.evt_max_history (
int, optional) – Maximum number of historical items to read for events. Set to 0 if your remote is not interested in “late joiner” data.start (
bool, optional) – Automatically start the read loop when constructed? Normally this should beTrue, but if you are adding topics piecemeal after constructing the remote then specifyFalseand callstartmanually after you have added all topics. Warning: ifFalsethenself.start_taskwill not exist and the remote cannot be used as an async context manager.num_messages (
int) – Number of messages to consume in the read loop.consume_messages_timeout (
float) – Timeout to wait for new messages to arrive in the read loop.
- Raises:
ValueError – If
includeandexcludeare both iterables (one or both must beNone).
- start_called#
Has the start method been called? The instance is fully started when start_task is done.
- Type:
- cmd_<command_name>
Remote command topic for each command supported by the component. Omitted if
readonlytrue.- Type:
- evt_<event_name>
Remote event for each event supported by the component, as specified by
includeand theexcludearguments.- Type:
- tel_<telemetry_name>
Remote telemetry topic for each telemetry topic supported by the component, as specified by the
includeandexcludearguments.- Type:
Notes
Here is an example that makes a Test remote and displays the topic-related attributes:
include salobj # the index is arbitrary, but a remote must use the same index # as the controller or CSC in order to communicate index = 5 test_remote = salobj.Remote("Test", index) print(dir(test_remote))
You should see the following topic-related attributes:
Commands, each an instance of
topics.RemoteCommand:cmd_standbycmd_start… and so on for all other standard CSC commands
cmd_setArrayscmd_setScalars
Events, each an instance of
topics.RemoteEvent:evt_configurationApplied… and so on for all other standard CSC log events
evt_arraysevt_scalars
Telemetry, each an instance of
topics.RemoteTelemetry:tel_arraystel_scalars
Methods Summary
close()Shut down and clean up resources.
start()Start the read loop by starting the contained SalInfo.
Methods Documentation
- async close()#
Shut down and clean up resources.
Close the contained
SalInfo, but not theDomain, because that may be used by other objects.May be called multiple times. The first call closes the SalInfo; subsequent calls wait until the Remote is closed.
- Return type:
- async start()#
Start the read loop by starting the contained SalInfo.
- Raises:
RuntimeError – If the SalInfo is already started, closing or closed.
- Return type: