Repository navigation
Add GoToZone task-sequence event - #136
chart-singapore wants to merge 6 commits into
Conversation
Signed-off-by: kjchee <keai_jiang_chee@cgh.com.sg>
Signed-off-by: kjchee <keai_jiang_chee@cgh.com.sg>
| class GoToZone::Description : public Event::Description | ||
| { | ||
| public: | ||
| struct Modifiers |
There was a problem hiding this comment.
The policy for all the C++ rmf_ libraries is that all public-facing APIs must use the pimpl pattern.
This should be changed to
class Modifiers
{
public:
const std::string& group_hint() const;
Modifiers& set_group_hint(std::string hint);
std::optional<double> orientation_hint() const;
Modifiers& set_orientation_hint(std::optional<double> hint);
const std::vector<std::string>& preferred_waypoints() const;
Modifiers& set_preferred_waypoints(std::vector<std::string> waypoints);
class Implementation;
private:
rmf_utils::impl_ptr<Implementation> _pimpl;
};| namespace { | ||
| // Wraps a GoToPlace Activity::Model and rejects robots whose current | ||
| // waypoint is inside the target zone. Prevents robots already in the | ||
| // zone from winning bids for zone tasks targeting the same zone. |
There was a problem hiding this comment.
I believe we discussed this and concluded that we should not block robots who are already in a zone from being used for a GoToZone task.
If the entire purpose of a task is to have a robot in a zone, the task should be allowed to use a robot that's already in the zone.
There was a problem hiding this comment.
Fixed in commit 81613a2.
Initially I just removed the ZoneGuardModel, but that alone wasn't enough. Eg, a robot already parked on a zone waypoint still lost the next GoToZone to the one at its charger.
After investigation, it turns out the GoToPlace one-of model picks its goal in make_model, from the invariant state. For the first phase of a task that's an empty State() (Task.cpp:387), so the nearest-goal loop never runs and every robot gets costed to goals[0].
So to fix that issue, now GoToZone gets its own small model, one GoToPlace per zone vertex, and estimate_finish takes whichever finishes first for that robot. A robot already on a zone vertex bids zero. Tested on chart_lab map, the 2nd GoToZone now goes to the robot already inside.
Signed-off-by: kjchee <keai_jiang_chee@cgh.com.sg>
Signed-off-by: kjchee <keai_jiang_chee@cgh.com.sg>
Signed-off-by: kjchee <keai_jiang_chee@cgh.com.sg>
New feature implementation
Implemented feature
This is part of an 8-repo Simple GoToZone feature. Tracked in Stage A of open-rmf/rmf#726.
Adds
GoToZonetormf_task_sequence::events— a task-level description that constructs aGoToPlaceactivity model over all zone internal vertices, wrapped in aZoneGuardModelfor bidding protection (prevent bidding from the robot already in the target zone). This is the task-planner-side entry point for zone tasks.Implementation description
GoToZone::DescriptionFactory:
GoToZone::Description::make(zone_name, modifiers), wheremodifiersisstd::optional<Modifiers>(defaultstd::nullopt). TheModifiersstruct carriesgroup_hint,orientation_hint, andpreferred_waypoints.make_model()— looks up the zone viaGraph::find_known_zone, collects waypoint indices for every internal vertex resolvable viagraph.find_waypoint(name), builds aGoToPlace::Description::make_for_one_of(goals)activity model, and wraps it inZoneGuardModel. Returnsnullptrif the zone is unknown, if every internal-vertex name fails to resolve to a waypoint, or if the innerGoToPlacemodel fails to build.generate_header()— produces the task header (category, description, duration).ZoneGuardModelWraps an inner
Activity::ConstModelPtr, purpose is to overrideestimate_finish(). For each candidate robot: if the robot's current waypoint is already one of the zone's internal-vertex waypoints, returnsstd::nullopt(purpose: excluding that robot from bidding on this zone task while keeping it available for every other task type).This guard works at the
estimate_finishlevel (per-robot) rather than atmake_model(per-task) because the per-candidate robot state is only available on eachestimate_finishcall.GenAI Use
We follow OSRA's policy on GenAI tools