RemoteCommand¶
-
class
lsst.ts.salobj.topics.
RemoteCommand
(salinfo, name)¶ Bases:
lsst.ts.salobj.topics.WriteTopic
Issue a specific command topic and wait for acknowldgement.
Parameters: Attributes Summary
DataType
The class of data for this topic. data
Get or set internally cached data. has_data
Has data
ever been set?metadata
Get topic metadata as a TopicMetadata
, if available, elseNone
.Methods Summary
close
()Shut down and release resources. next_ackcmd
(ackcmd[, timeout, wait_done])Wait for the next acknowledement for the command put
([data, priority])Output this topic. set
(**kwargs)Set one or more fields of self.data
.set_start
([timeout, wait_done])Set zero or more command data fields and start a command. start
([data, timeout, wait_done])Start a command. Attributes Documentation
-
DataType
¶ The class of data for this topic.
-
data
¶ Get or set internally cached data.
Parameters: - data :
DataType
New data.
Raises: - TypeError
If
data
is not an instance ofDataType
Notes
You must not modify the returned data, nor assume that it will be constant. If you need a copy then make it yourself.
- data :
Methods Documentation
-
close
()¶ Shut down and release resources.
Intended to be called by SalInfo.close(), since that tracks all topics.
-
next_ackcmd
(ackcmd, timeout=3600, wait_done=True)¶ Wait for the next acknowledement for the command
Parameters: - ackcmd :
SalInfo.AckCmdType
The command acknowledgement returned by the previous wait (e.g. from
start
).- timeout :
float
(optional) Time limit, in seconds. If None then no time limit. This time limit is for the entire command if wait_done is true, else it is for the first acknowledgement after the initial “SAL__CMD_ACK”.
- wait_done :
bool
(optional) If True then wait for final command acknowledgement. If False then wait until the next command acknowledgement; if that acknowledgement is not final (the ack code is not in
done_ack_codes
), then you will almost certainly want to awaitnext_ackcmd
again.
Returns: - ackcmd :
SalInfo.AckCmdType
Command acknowledgement.
Raises: - salobj.AckError
If the command fails or times out.
- RuntimeError
If the command specified by
seq_num
is unknown or has already finished.
- ackcmd :
-
put
(data=None, priority=0)¶ Output this topic.
Parameters: Raises: - TypeError
If
data
is not None and not an instance ofDataType
.
-
set
(**kwargs)¶ Set one or more fields of
self.data
.Parameters: - **kwargs :
dict
[str
,any
] Dict of field name: new value for that field:
- Any key whose value is
None
is checked for existence, but the value of the field is not changed. - If the field being set is an array then the value must either be an array of the same length or a scalar (which replaces every element of the array).
- Any key whose value is
Returns: Raises: - AttributeError
If the topic does not have the specified field.
- ValueError
If the field cannot be set to the specified value.
Notes
If one or more fields cannot be set, the data may be partially updated. This is not ideal, but is pragmatic because it is difficult to copy SAL topics (see TSS-3195).
- **kwargs :
-
set_start
(timeout=3600, wait_done=True, **kwargs)¶ Set zero or more command data fields and start a command.
Parameters: - timeout :
float
(optional) Time limit, in seconds. If None then no time limit. This time limit is for the entire command if wait_done is true, else it is for the first acknowledgement after the initial “SAL__CMD_ACK”.
- wait_done :
bool
(optional) If True then wait for final command acknowledgement. If False then wait for the first acknowledgement after the initial “SAL__CMD_ACK”; if that acknowledgement is not final (the ack code is not in done_ack_codes), then you will almost certainly want to await
next_ackcmd
.- **kwargs :
dict
[str
,any
] The remaining keyword arguments are field name = new value for that field. See
set
for more information about values.
Returns: - ackcmd :
SalInfo.AckCmdType
Command acknowledgement.
Raises: - salobj.AckError
If the command fails.
- salobj.AckTimeoutError
If the command times out.
- TypeError
If
data
is not None and not an instance ofDataType
.
- timeout :
-
start
(data=None, timeout=3600, wait_done=True)¶ Start a command.
Parameters: - data :
self.DataType
(optional) Command data. If None then send the current data.
- timeout :
float
(optional) Time limit, in seconds. If None then no time limit. This time limit is for the entire command if wait_done is true, else it is for the first acknowledgement after the initial “SAL__CMD_ACK”.
- wait_done :
bool
(optional) If True then wait for final command acknowledgement. If False then wait for the first acknowledgement after the initial “SAL__CMD_ACK”; if that acknowledgement is not final (the ack code is not in done_ack_codes), then you will almost certainly want to await
next_ackcmd
.
Returns: - ackcmd :
SalInfo.AckCmdType
Command acknowledgement.
Raises: - salobj.AckError
If the command fails.
- salobj.AckTimeoutError
If the command times out.
- TypeError
If
data
is not None and not an instance ofDataType
.
- data :
-