Class RobotUpdateHandle

Nested Relationships

Nested Types

Class Documentation

class rmf_fleet_adapter::agv::RobotUpdateHandle

You will be given an instance of this class every time you add a new robot to your fleet. Use that instance to send updates to RoMi-H about your robot’s state.

Public Types

enum Tier

Values:

enumerator Info

General status information, does not require special attention.

enumerator Warning

Something unusual that might require attention.

enumerator Error

A critical failure that requires immediate operator attention.

using ActionExecutor = std::function<void(const std::string &category, const nlohmann::json &description, ActionExecution execution)>

Signature for a callback to request the robot to perform an action

Parameters
  • [in] category: A category of the action to be performed

  • [in] description: A description of the action to be performed

  • [in] execution: An ActionExecution object that will be provided to the user for updating the state of the action.

Public Functions

void interrupted()
void replan()

Tell the RMF schedule that the robot needs a new plan. A new plan will be generated, starting from the last position that was given by update_position(). It is best to call update_position() with the latest position of the robot before calling this function.

void update_position(std::size_t waypoint, double orientation)

Update the current position of the robot by specifying the waypoint that the robot is on and its orientation.

void update_position(const Eigen::Vector3d &position, const std::vector<std::size_t> &lanes)

Update the current position of the robot by specifying the x, y, yaw position of the robot and one or more lanes that the robot is occupying.

Warning

At least one lane must be specified. If no lane information is available, then use the update_position(std::string, Eigen::Vector3d) signature of this function.

void update_position(const Eigen::Vector3d &position, std::size_t target_waypoint)

Update the current position of the robot by specifying the x, y, yaw position of the robot and the waypoint that it is moving towards.

This should be used if the robot has diverged significantly from its course but it is merging back onto a waypoint.

void update_position(const std::string &map_name, const Eigen::Vector3d &position, const double max_merge_waypoint_distance = 0.1, const double max_merge_lane_distance = 1.0, const double min_lane_length = 1e-8)

Update the current position of the robot by specifying the x, y, yaw position of the robot and what map the robot is on.

We will attempt to merge the robot back onto the navigation graph. The parameters for this function are passed along to rmf_traffic::agv::compute_plan_starts().

Warning

This function should only be used if the robot has diverged from the navigation graph somehow.

RobotUpdateHandle &set_charger_waypoint(const std::size_t charger_wp)

Set the waypoint where the charger for this robot is located. If not specified, the nearest waypoint in the graph with the is_charger() property will be assumed as the charger for this robot.

void update_battery_soc(const double battery_soc)

Update the current battery level of the robot by specifying its state of charge as a fraction of its total charge capacity

RobotUpdateHandle &maximum_delay(rmf_utils::optional<rmf_traffic::Duration> value)

Specify how high the delay of the current itinerary can become before it gets interrupted and replanned. A nullopt value will allow for an arbitrarily long delay to build up without being interrupted.

rmf_utils::optional<rmf_traffic::Duration> maximum_delay() const

Get the value for the maximum delay.

Note

The setter for the maximum_delay field is run asynchronously, so it may take some time for the return value of this getter to match the value that was given to the setter.

void set_action_executor(ActionExecutor action_executor)

Set the ActionExecutor for this robot.

void submit_direct_request(nlohmann::json task_request, std::string request_id, std::function<void(nlohmann::json response)> receive_response)

Submit a direct task request to this manager

Parameters
  • [in] task_request: A JSON description of the task request. It should match the task_request.json schema of rmf_api_msgs, in particular it must contain category and description properties.

  • [in] request_id: The unique ID for this task request.

  • [in] receive_response: Provide a callback to receive the response. The response will be a robot_task_response.json message from rmf_api_msgs (note: this message is not validated before being returned).

Interruption interrupt(std::vector<std::string> labels, std::function<void()> robot_is_interrupted)

Interrupt (pause) the current task, yielding control of the robot away from the fleet adapter’s task manager.

Return

a handle for this interruption.

Parameters
  • [in] labels: Labels that will be assigned to this interruption. It is recommended to include information about why the interruption is happening.

IssueTicket create_issue(Tier tier, std::string category, nlohmann::json detail)

Create a new issue for the robot.

Return

A ticket for this issue

Parameters
  • [in] tier: The severity of the issue

  • [in] category: A brief category to describe the issue

  • [in] detail: Full details of the issue that might be relevant to an operator or logging system.

void log_info(std::string text)

Add a log entry with Info severity.

void log_warning(std::string text)

Add a log entry with Warning severity.

void log_error(std::string text)

Add a log entry with Error severity.

Unstable &unstable()

Get a mutable reference to the unstable API extension.

const Unstable &unstable() const

Get a const reference to the unstable API extension.

class ActionExecution

The ActionExecution class should be used to manage the execution of and provide updates on ongoing actions.

Public Functions

void update_remaining_time(rmf_traffic::Duration remaining_time_estimate)
void finished()
bool okay() const
class Interruption

An object to maintain an interruption of the current task. When this object is destroyed, the task will resume.

Public Functions

void resume(std::vector<std::string> labels)

Call this function to resume the task while providing labels for resuming.

class IssueTicket

An object to maintain an issue that is happening with the robot. When this object is destroyed without calling resolve(), the issue will be “dropped”, which issues a warning to the log.

Public Functions

void resolve(nlohmann::json msg)

Indicate that the issue has been resolved. The provided message will be logged for this robot and the issue will be removed from the robot state.

class Unstable

This API is experimental and will not be supported in the future. Users are to avoid relying on these feature for any integration.

Public Types

enum Decision

Values:

enumerator Undefined
enumerator Clear
enumerator Crowded
using Decide = std::function<void(Decision)>

A callback with this signature will be given to the watchdog when the robot is ready to enter a lift. If the watchdog passes in a true, then the robot will proceed to enter the lift. If the watchdog passes in a false, then the fleet adapter will release its session with the lift and resume later.

using Watchdog = std::function<void(const std::string&, Decide)>

Public Functions

rmf_traffic::schedule::Participant *get_participant()

Get the schedule participant of this robot.

void set_lift_entry_watchdog(Watchdog watchdog, rmf_traffic::Duration wait_duration = std::chrono::seconds(10))

Set a callback that can be used to check whether the robot is clear to enter the lift.