Publishes messages and calls services at fixed points in simulation time, optionally looping. It plays a scripted sequence, such as joint position targets or velocity commands, without an external script. Keyframes follow simulation time, so pausing or stepping the simulation also pauses or steps the timeline, and the timeline starts over when the world is reset or the simulation time goes back. The timeline starts on the first unpaused step after the system is loaded, so a model spawned during the simulation starts its timeline when it appears. More...
#include <TimelinePublisher.hh>
Public Member Functions | |
| TimelinePublisher () | |
| Constructor. | |
| ~TimelinePublisher () override | |
| Destructor. | |
| void | Configure (const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr) override |
| Configure the system. | |
| void | PreUpdate (const UpdateInfo &_info, EntityComponentManager &_ecm) override |
| void | Reset (const UpdateInfo &_info, EntityComponentManager &_ecm) override |
Public Member Functions inherited from System | |
| System ()=default | |
| Constructor. | |
| virtual | ~System ()=default |
| Destructor. | |
Public Member Functions inherited from ISystemConfigure | |
| virtual | ~ISystemConfigure ()=default |
Public Member Functions inherited from ISystemPreUpdate | |
| virtual | ~ISystemPreUpdate ()=default |
Public Member Functions inherited from ISystemReset | |
| virtual | ~ISystemReset ()=default |
Additional Inherited Members | |
Public Types inherited from System | |
| using | PriorityType = int32_t |
| Signed integer type used for specifying priority of the execution order of PreUpdate and Update phases. | |
Static Public Attributes inherited from System | |
| static constexpr PriorityType | kDefaultPriority = {0} |
| Default priority value for execution order of the PreUpdate and Update phases. | |
| static constexpr std::string_view | kPriorityElementName |
| Name of the XML element from which the priority value will be parsed. | |
Detailed Description
Publishes messages and calls services at fixed points in simulation time, optionally looping. It plays a scripted sequence, such as joint position targets or velocity commands, without an external script. Keyframes follow simulation time, so pausing or stepping the simulation also pauses or steps the timeline, and the timeline starts over when the world is reset or the simulation time goes back. The timeline starts on the first unpaused step after the system is loaded, so a model spawned during the simulation starts its timeline when it appears.
System Parameters
<loop>: Whether the timeline starts over after<period>seconds. Defaults to false.<period>: Length of the timeline in seconds. Defaults to the time of the last keyframe, so the last keyframe and the first keyframe of the next cycle fire on the same step. Must be greater than zero when looping. If the last keyframe is later than the period, the period is extended to it. If a step covers more than one cycle, for example because the period is shorter than the step, only the latest cycle fires.<keyframe>: A point in the timeline. Thetimeattribute is the time in seconds since the start of the timeline. This element can be repeated, and keyframes may be listed in any order. Keyframes with the same time fire in the order they are listed. Each keyframe contains any number of:<output>: Message to publish. Thetopicattribute is the topic to publish on and thetypeattribute is the message type (e.g.gz.msgs.Double). The content of the element is the message in the protobuf text format.<service>: Service to call. Thenameattribute is the service name,reqTypeandrepTypeare the request and response message types,timeoutis the timeout in milliseconds (defaults to 1000) andreqMsgis the request in the protobuf text format. Instead of thereqMsgattribute, a long request can be the content of the element. Service calls are made in order from a worker thread, so they never block the simulation, but their effect isn't tied to an exact step. When a new cycle starts, calls still waiting from before the previous cycle are dropped, so a slow service can't make the calls fall further and further behind. Calls still waiting when the world is reset are dropped. Removing the system waits for the call in progress, up to its timeout.
Example
Move a joint back and forth, repeating every 4 seconds:
Constructor & Destructor Documentation
◆ TimelinePublisher()
Constructor.
◆ ~TimelinePublisher()
|
override |
Destructor.
Member Function Documentation
◆ Configure()
|
overridevirtual |
Configure the system.
- Parameters
-
[in] _entity The entity this plugin is attached to. [in] _sdf The SDF Element associated with this system plugin. [in] _ecm The EntityComponentManager of the given simulation instance. [in] _eventMgr The EventManager of the given simulation instance.
Implements ISystemConfigure.
◆ PreUpdate()
|
overridevirtual |
Implements ISystemPreUpdate.
◆ Reset()
|
overridevirtual |
Implements ISystemReset.
The documentation for this class was generated from the following file:
Public Member Functions inherited from