Class EasyTrafficLight
Defined in File EasyTrafficLight.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public std::enable_shared_from_this< EasyTrafficLight >
Class Documentation
-
class EasyTrafficLight : public std::enable_shared_from_this<EasyTrafficLight>
Public Types
-
enum class MovingInstruction : uint8_t
This instruction is given for moving updates. It.
Values:
-
enumerator MovingError
This indicates that your robot has not obeyed its instructions to stop. When this happens, it could mean serious problems for the overall traffic light system, including permanent deadlocks with other robots. This error may be seen if moving_from(~) is called during the time gap between the robot being instructed to pause and the feedback from the robot that it has paused.
-
enumerator ContinueAtNextCheckpoint
When the robot reaches the next checkpoint, it should continue.
-
enumerator WaitAtNextCheckpoint
When the robot reaches the next checkpoint, it must wait.
-
enumerator PauseImmediately
The robot should pause immediately. This typically means there has been a change of plans and now the robot is scheduled to give way to another.
-
enumerator MovingError
-
enum class WaitingInstruction : uint8_t
Values:
-
enumerator WaitingError
This indicates that your robot has not obeyed its instructions to stop. When this happens, it could mean serious problems for the overall traffic light system, including permanent deadlocks with other robots.
-
enumerator Resume
The robot can continue along its path. It no longer needs to wait here.
-
enumerator Wait
The robot must continue waiting here.
-
enumerator WaitingError
Public Functions
-
void follow_new_path(const std::vector<Waypoint> &new_path)
Update the traffic light with a new path for your robot.
Warning
This function will throw an exception if there are less than 2 waypoints in the path.
-
MovingInstruction moving_from(std::size_t checkpoint, Eigen::Vector3d location)
Tell the traffic light that the robot is moving.
Note
If your robot might not be able to stop in time to wait at the next checkpoint, then call moving_from(checkpoint+1, location) instead, even if your robot has not physically reached checkpoint+1 yet.
Warning
This function should only be called if the system has enough time for the robot to stop at the next checkpoint (i.e. accounting for the network latency of sending out the stop command and the maximum deceleration of the robot). The expectation is that if this function returns a WaitAtNextCheckpoint instruction, then the robot will definitely wait at the next checkpoint (until instructed otherwise). If that expectation is violated, you may get MovingError and/or WaitingError results, and the overall traffic flow may get interrupted or deadlocked.
- Parameters:
checkpoint – [in] The last checkpoint which the robot passed over.
location – [in] The current location of the robot.
- Returns:
what the robot should do when it reaches its next checkpoint. This may change in between calls to this function. The results may even change from ContinueAtNextCheckpoint to WaitAtNextCheckpoint if a negotiation decided to have this robot give way to another robot. You must always use the latest value received from this function.
-
WaitingInstruction waiting_at(std::size_t checkpoint)
Tell the traffic light that the robot is waiting at a checkpoint.
- Parameters:
checkpoint – [in] The checkpoint where the robot is waiting.
- Returns:
whether the robot should resume its travel or keep waiting.
-
WaitingInstruction waiting_after(std::size_t checkpoint, Eigen::Vector3d location)
Tell the traffic light that the robot is waiting at a location in-between waypoints.
- Parameters:
checkpoint – [in] The last checkpoint that the robot passed.
location – [in] The location where the robot is waiting.
-
std::size_t last_reached() const
Get the last checkpoint that the traffic light knows has been reached.
-
EasyTrafficLight &update_idle_location(std::string map_name, Eigen::Vector3d position)
Update the location of the robot while it is idle. This means the robot is sitting somewhere without the intention of going anywhere.
- Parameters:
map_name – [in] The name of the reference map where the robot is located.
position – [in] The (x, y, yaw) coordinates of the robot.
-
EasyTrafficLight &update_battery_soc(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.
-
EasyTrafficLight &replan()
Tell the fleet adapter to replan. This can help to break out of deadlocks.
-
EasyTrafficLight &fleet_state_publish_period(std::optional<rmf_traffic::Duration> value)
Specify a period for how often the fleet state message is published for this fleet. Passing in std::nullopt will disable the fleet state message publishing. The default value is 1s.
-
class Blocker
This class will be provided to the deadlock_callback when a deadlock has occurred due to an unresolvable conflict. Human intervention may be required at this point, because the RMF traffic negotiation system does not have a high enough level of control over the conflicting participants to resolve it.
-
enum class MovingInstruction : uint8_t