Class Task::Active
Defined in File Task.hpp
Nested Relationships
This class is a nested type of Class Task.
Class Documentation
-
class Active
Public Types
-
using Backup = detail::Backup
Backup data for the task. The state of the task is represented by a string. The meaning and format of the string is up to the Task implementation to decide.
Each Backup is tagged with a sequence number. As the Task makes progress, it can issue new Backups with higher sequence numbers. Only the Backup with the highest sequence number will be kept.
Public Functions
-
virtual Event::Status status_overview() const = 0
Get a quick overview status of how the task is going.
-
virtual bool finished() const = 0
Check if this task is finished, which could include successful completion or cancellation.
-
virtual const std::vector<Phase::ConstCompletedPtr> &completed_phases() const = 0
Descriptions of the phases that have been completed.
-
virtual Phase::ConstActivePtr active_phase() const = 0
Interface for the phase that is currently active.
-
virtual std::optional<rmf_traffic::Time> active_phase_start_time() const = 0
Time that the current active phase started.
-
virtual const std::vector<Phase::Pending> &pending_phases() const = 0
Descriptions of the phases that are expected in the future.
-
virtual const ConstTagPtr &tag() const = 0
The tag of this Task.
-
virtual rmf_traffic::Duration estimate_remaining_time() const = 0
Estimate the overall finishing time of the task.
-
virtual Resume interrupt(std::function<void()> task_is_interrupted) = 0
Tell this Task that it needs to be interrupted. An interruption means the robot may be commanded to do other tasks before this task resumes.
Interruptions may occur to allow operators to take manual control of the robot, or to engage automatic behaviors in response to emergencies, e.g. fire alarms or code blues.
-
virtual void cancel() = 0
Tell the Task that it has been canceled. The behavior that follows a cancellation will vary between different Tasks, but generally it means that the robot should no longer try to complete its Task and should instead try to return itself to an unencumbered state as quickly as possible.
The Task may continue to perform some phases after being canceled. The pending_phases are likely to change after the Task is canceled, being replaced with phases that will help to relieve the robot so it can return to an unencumbered state.
The Task should continue to be tracked as normal. When its finished callback is triggered, the cancellation is complete.
-
virtual void kill() = 0
Kill this Task. The behavior that follows a kill will vary between different Tasks, but generally it means that the robot should be returned to a safe idle state as soon as possible, even if it remains encumbered by something related to this Task.
The Task should continue to be tracked as normal. When its finished callback is triggered, the killing is complete.
The kill() command supersedes the cancel() command. Calling cancel() after calling kill() will have no effect.
-
virtual void skip(uint64_t phase_id, bool value = true) = 0
Skip a specific phase within the task. This can be issued by operators if manual intervention is needed to unblock a task.
If a pending phase is specified, that phase will be skipped when the Task reaches it.
- Parameters:
phase_id – [in] The ID of the phase that should be skipped.
value – [in] True if the phase should be skipped, false otherwise.
-
virtual void rewind(uint64_t phase_id) = 0
Rewind the Task to a specific phase. This can be issued by operators if a phase did not actually go as intended and needs to be repeated.
It is possible that the Task will rewind further back than the specified phase_id if the specified phase depends on an earlier one. This is up to the discretion of the Task implementation.
-
virtual ~Active() = default
-
using Backup = detail::Backup