Class Writer

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Writer >

Class Documentation

class 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.

Parameters:

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

Returns:

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

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:

description.[in] 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:
  • description[in] The description of the participant.

  • ready_callback[in] 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:

node[in] 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.