BaseTopic

class lsst.ts.salobj.topics.BaseTopic(*, salinfo, name, sal_prefix)

Bases: abc.ABC

Base class for topics.

Parameters:
salinfo : SalInfo

SAL component information

name : str

Topic name, without a “command_” or “logevent_” prefix.

sal_prefix : str

SAL topic prefix: one of “command_”, “logevent_” or “”

Raises:
RuntimeError

If the topic cannot be constructed.

Attributes:
salinfo : SalInfo

The salinfo constructor argument.

name : str

The name constructor argument.

sal_name : str

The topic name used by SAL. For example: “logevent_summaryState”.

log : logging.Logger

A logger.

qos_set : salobj.QosSet

Quality of service set.

volatile : bool

Does this topic have volatile durability?

attr_name : str

Name of topic attribute in Controller and Remote. For example: “evt_summaryState”.

rev_code : str

Revision hash code for the topic. This code changes whenever the schema for the topic changes, and it is part of the DDS topic name. For example: “90255bf1”

dds_name : str

Name of topic seen by DDS. For example: “Test_logevent_summaryState_90255bf1”.

Attributes Summary

DataType The type (class) for a message of this topic.
metadata Get topic metadata as a TopicMetadata, if available, else None.
volatile Does this topic have volatile durability?

Attributes Documentation

DataType

The type (class) for a message of this topic.

When you read or write a message for this topic you are reading or writing an instance of DataType.

Notes

The preferred way to write a message for a topic is:

  • RemoteCommand.set_start to start a command.
  • CommandEvent.set_put to write an event.
  • CommandTelemetry.set_put to write a telemetry message.

However, it is also possible to use DataType to create a message, then write, it as separate operations. For example, assuming we have a Remote for SAL component “Test”:

# The preferred way to issue a command:
await = remote.cmd_wait.set_put(duration=2, timeout=5)

# But an alternative is to first create the command,
# then send it, as two separate operations:
message = remote.cmd_wait.DataType(duration=2)
await remote.cmd_wait.start(message, timeout=5)

# Or, even more verbosely:
message = remote.cmd_wait.DataType()
message.duration = 2
await remote.cmd_wait.start(message, timeout=5)
metadata

Get topic metadata as a TopicMetadata, if available, else None.

volatile

Does this topic have volatile durability?