Class Writer

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Writer >

Class Documentation

class rmf_traffic_ros2::schedule::Writer : public std::enable_shared_from_this<Writer>

The Writer class provides an API that allows a Node to create schedule Participants.

Public Functions

bool ready() const

Returns true if all the services needed by this writer are ready.

void wait_for_service() const

Wait for the necessary services to be available.

bool wait_for_service(rmf_traffic::Time stop) const

Wait for the necessary services to be available, or for the time point to be reached, whichever happens first.

Return

true if the necessary services are now available, false otherwise.

Parameters
  • [in] stop: The maximum time point that this will wait until

std::future<rmf_traffic::schedule::Participant> make_participant(rmf_traffic::schedule::ParticipantDescription description)

Begin creation of a schedule participant.

The node of this Writer needs to be spun in order for the Participant to finish being created.

Parameters
  • [in] description.: The description of the participant.

void async_make_participant(rmf_traffic::schedule::ParticipantDescription description, std::function<void(rmf_traffic::schedule::Participant)> ready_callback)

Asynchronously create a schedule participant.

When the Participant is ready to be used, the ready_callback will be triggered with the newly created Participant instance.

Parameters
  • [in] description: The description of the participant.

  • [in] ready_callback: The callback that will be triggered when the participant is ready.

Public Static Functions

static std::shared_ptr<Writer> make(const std::shared_ptr<rclcpp::Node> &node)

Create an instance of a writer. The writer and all Participants it creates depend on the life of the rclcpp::Node. It’s best to keep all of these as members of the Node.

Parameters
  • [in] node: The node that will manage the subscriptions of this writer. This will be held as a std::weak_ptr<rclcpp::Node> so it is okay to store the writer inside the node itself.