RemoteCommand#
- class lsst.ts.salobj.topics.RemoteCommand(salinfo, name)#
Bases:
WriteTopicIssue a specific command topic and wait for acknowldgement.
- Parameters:
salinfo (
SalInfo) – SAL component information.name (
str) – Command name, with no prefix, e.g. “start”.
Methods Summary
next_ackcmd(ackcmd[, timeout, wait_done])Wait for the next acknowledgement for the command.
set(**kwargs)Create a new
self.dataand set one or more fields.set_start([timeout, wait_done])Create a new
self.data, set zero or more fields, and start the command.set_write(*[, force_output])An override of WriteTopic.set_write that is disabled.
start([data, timeout, wait_done])Start a command.
write(**kwargs)An override of WriteTopic.write that is disabled.
Methods Documentation
- async next_ackcmd(ackcmd, timeout=3600, wait_done=True)#
Wait for the next acknowledgement for the command.
- Parameters:
ackcmd (
SalInfo.AckCmdType) – Command acknowledgement returned by the previous call toset_start,startornext_ackcmd.timeout (
float, optional) – Time limit, in seconds. If None then useDEFAULT_TIMEOUT. This time limit is for the entire command ifwait_doneis true, else it is for the next command acknowledgement. Ifwait_doneis true and the command is acknowledged withCMD_INPROGRESSthen the timeout is extended by the timeout value in the acknowledgement. Thus a slow command will not need a long timeout, so long as the command issues aCMD_INPROGRESSacknowledgement with a reasonabletimeoutvalue.wait_done (
bool, optional) – If true then wait for final command acknowledgement. If false then wait only for the next command acknowledgement If that acknowledgement is not final (the ack code is not inself.done_ack_codes), then you will almost certainly want to awaitnext_ackcmdagain.
- Returns:
ackcmd – Command acknowledgement.
- Return type:
SalInfo.AckCmdType- Raises:
lsst.ts.salobj.AckError – If the command fails or times out.
RuntimeError – If the command specified by
seq_numis unknown or has already finished.
- set(**kwargs)#
Create a new
self.dataand set one or more fields.- Parameters:
Dict of field name: new value for that field:
Any key whose value is
Noneis 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).
- Returns:
did_change – True if
self.datawas changed, or if this was the first call toset.- Return type:
- 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.
- async set_start(timeout=3600, wait_done=True, **kwargs)#
Create a new
self.data, set zero or more fields, and start the command.- Parameters:
timeout (
float, optional) – Time limit, in seconds. If None then useDEFAULT_TIMEOUT. This time limit is for the entire command ifwait_doneis true, else it is for the first command acknowledgement. Ifwait_doneis true and the command is acknowledged withCMD_INPROGRESSthen the timeout is extended by the timeout value in the acknowledgement. Thus a slow command will not need a long timeout, so long as the command issues aCMD_INPROGRESSacknowledgement with a reasonabletimeoutvalue.wait_done (
bool, optional) – If True then wait for final command acknowledgement. If False then wait only for the first command acknowledgement If that acknowledgement is not final (the ack code is not inself.done_ack_codes), then you will almost certainly want to awaitnext_ackcmd.**kwargs (
dict[str,any]) – The remaining keyword arguments are field name = new value for that field. Seesetfor more information about values.
- Returns:
ackcmd – Command acknowledgement.
- Return type:
SalInfo.AckCmdType- Raises:
lsst.ts.salobj.AckError – If the command fails.
lsst.ts.salobj.AckTimeoutError – If the command times out.
TypeError – If
datais not None and not an instance ofDataType.
- async set_write(*, force_output=None, **kwargs)#
An override of WriteTopic.set_write that is disabled.
- Parameters:
- Return type:
- async start(data=None, timeout=3600, wait_done=True)#
Start a command.
- Parameters:
data (
self.DataType, optional) – Command message. IfNonethen send the currentself.data.timeout (
float, optional) – Time limit, in seconds. If None then useDEFAULT_TIMEOUT. This time limit is for the entire command ifwait_doneis true, else it is for the first acknowledgement. Ifwait_doneis true and the command is acknowledged withCMD_INPROGRESSthen the timeout is extended by the timeout value in the acknowledgement. Thus a slow command will not need a long timeout, so long as the command issues aCMD_INPROGRESSacknowledgement with a reasonabletimeoutvalue.wait_done (
bool, optional) – If True then wait for final command acknowledgement. If False then wait only for the first command acknowledgement. If that acknowledgement is not final (the ack code is not inself.done_ack_codes), then you will almost certainly want to awaitnext_ackcmd.
- Returns:
ackcmd – Command acknowledgement.
- Return type:
SalInfo.AckCmdType- Raises:
lsst.ts.salobj.AckError – If the command fails.
lsst.ts.salobj.AckTimeoutError – If the command times out.
RuntimeError – If
self.salinfois not running.TypeError – If
datais not None and not an instance ofDataType.