Skip to content

Conversation

@xiyuoh
Copy link
Member

@xiyuoh xiyuoh commented Jul 23, 2025

This PR targets #312 to bring in the following improvements to the task UI:

  • Add fleet param to Robot
  • Move Fleet field into More for dispatch tasks, and remove redundant Fleet name for all task requests
  • Moved tasks to toggle-able left panel, accessible through the top menu bar (new button next to Browse Fuel)
  • Creating new tasks happen in a separate window that appears in the center of the screen
  • In-place editing for existing tasks, with the exception of task kind description due to the need to access world
  • Optional serialization for tasks and other modifier fields
  • [EDIT]: Resolve More details button flicker

@mxgrey mxgrey moved this from Inbox to In Review in PMC Board Jul 24, 2025
@xiyuoh
Copy link
Member Author

xiyuoh commented Jul 29, 2025

After a little bit of poking around, it turns out that the UI flicker when clicking on the More details button was caused by having egui::Grid embedded inside a CollapsingHeader. Removing it fixes the issue. The grid was added to provide some alignment, but I think it's not worth having the entire UI glitching.

Another remaining bug is the the one-frame delay when toggling the Start time / Request time / Priority checkboxes. but I think they will be resolved with #325 where we handle UpdateModifierEvent with observers.

@mxgrey
Copy link
Collaborator

mxgrey commented Aug 11, 2025

It might be good for @Nielsencu to take a look at this and think about how to align these changes with some of the things we've discussed for the debugging tool. One similarity is that tasks have been moved to a toggleable panel on the left, similar to what we've discussed for the debugging tool.

@xiyuoh
Copy link
Member Author

xiyuoh commented Aug 25, 2025

While fixing merge conflicts from main, I found a small missing piece that should've been added in #325. Without this, any scenario elements with Inclusion property wouldn't have the corresponding modifier inserted automatically. We currently don't face this issue with model instances as the modifiers are manually inserted in the model loading workflow.

Pointing this out in case this PR gets closed in favor of a separate PR for the debugging tool - if that's the case I'll open a separate one for this particular fix.

Signed-off-by: Xiyu Oh <[email protected]>
@Nielsencu
Copy link
Contributor

I was thinking if it would make sense to combine both the tasks panel and debugger panel into one? The left panel would be divided vertically into two, where the tasks section would sit above the MAPF debugger section. I am not sure there are other functionalities for tasks at the moment, as far as I know they are only used for debugging MAPF. Given my understanding is correct, I think it makes sense to put them into one panel. We can even have a checkbox that toggles on and off the MAPF debugger section, if users only want to add tasks but do not want the debugger functionality (though I currently do not see the use case of only adding tasks without debugger).

@xiyuoh
Copy link
Member Author

xiyuoh commented Aug 26, 2025

@Nielsencu Shifting both tasks and debugger into the left panel sounds good to me! Tasks serve to represent and store different types of activities a robot is capable of carrying out, and we'll likely plan for more types of tasks beyond GoToPlace (which is what you're using for the mapf debugger). Being able to toggle the debugger section on/off is a great idea.

Copy link
Member

@luca-della-vedova luca-della-vedova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a spin and found a few issues:

Location for GoToPlace and Duration for WaitFor tasks are in the wrong UI block when doing inplace edits, specifically they don't seem to be contained in the task itself but in the root left side panel

image

and

image

It seems that changing a task type can reorder it in the list of tasks, for example starting from the state above, if I change Task 1081 from WaitFor to GoToPlace it gets automatically moved to the top of the list. For this I would suggest having a static sorting strategy, perhaps in alphabetical order of the task name?

image

I also noticed that GoToPlace tasks without a set location can still be added (both before and after this PR), is this intentional? Since a GoToPlace without a destination is invalid I feel the Add task button should be greyed out if it's not set.

image

},
"robots": {
"52": {
"fleet": "HospitalRobot",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add tasks to this file so we make it part of our CI pipeline? It can be done in a followup if you prefer

Color32::default()
};
let mut edit = false;
let in_edit_mode = edit_task.0.is_some_and(|e| e == task_entity);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not exactly here (a few lines below) but I'm a bit conflicted on using the task's Entity value for its display name, has there been a thought on having a NameInSite component for tasks? We could auto-generate it with a random ID the way we do in the RMF stack. Or if we want to go for IDs maybe just the SiteID? Entity values can be pretty random, I noticed that creating a new task in my test (screenshots in main review comment) created Task 1078, and creating a new one immediately after resulted in Task 1081, I would argue the very high + not even contiguous number is not too informative.

@Nielsencu
Copy link
Contributor

Nielsencu commented Aug 30, 2025

Just a few suggestions that I thought can be made as I was working with tasks

  1. Instead of saving the robot location as a string (I belive it's inserted in the description), I think it would be better if we can also access the location Entity independently as part of the task
  2. Similar to 1, currently robot assigned is saved as a string. Useful to save it as an entity instead
  3. When hovering the Select location:, it would be helpful to highlight the currently selected location on the map, because it can be confusing to find where is this location in the map for first-time users
  4. Add is_valid() to also account for robot location for direct tasks. Since a direct task without valid location means its not a valid task

Reasons for 1 and 2 is for easy-lookup. Currently, I have to iterate through all possible locations, match the string, and get the relevant location entity to find the anchor transform.

@xiyuoh
Copy link
Member Author

xiyuoh commented Sep 4, 2025

@luca-della-vedova @Nielsencu Thanks both for the detailed review and suggestions! I believe I managed to address all of them:

  • TaskKind widgets (GoToPlace, WaitFor UI) no longer below the task list, but within the same task widget where edits are being made (f129a4a)
  • Order of tasks could be changed if edits were made - this was initially set as a future TODO to incorporate sorting based on start_time and request_time, but I just added in a simple implementation this time. (a2390aa) The tasks are now sorted as such:
    • If the task has a non-empty start_time, we'll use it for sorting.
    • If the task does not have a start_time, but has a non-empty request_time, we'll use the request_time for sorting.
    • If the task does not have start_time or request_time, we'll use its created_time for sorting. created_time is newly added and will just be the time at which the Task was first created (when Create New Task button is pressed).
    • Should not happen BUT if somehow a created_time was not successfully calculated and added to the Task upon creation, then the task will be pushed to the end of the queue and sorted by entity index.
  • TaskKind validity - GoToPlace now requires a valid location for the task to be added to the list. Along with this we can now define a IsTaskValidFn for each TaskKind. (c23dffa)
  • Use Entity to identify Robots and Locations in tasks instead of String names (8c278e2, f67cc3b)
  • Highlight Robots and Locations when they are hovered over during task creation (4946083)
  • Use timestamp as task identifier instead of Entity index (ec9443d)
  • Added sample tasks to test.site.json for CI

Other add-ons:

  • Applied alphabetical sorting for Locations when configuring GoToPlace, and Robots for Direct tasks.
  • Fix task saving/loading - the previous implementation was able to save tasks but not load them. All the fields in TaskParams were also set to skip_if_default, but we should really save all of them to avoid confusion between empty modifiers and no modifiers. Done in ec9443d and 3c43a73

@xiyuoh
Copy link
Member Author

xiyuoh commented Sep 5, 2025

CI failing, should be fixed by #385. Opened as a separate PR since it is not related to tasks specifically.

Comment on lines 585 to 593
ui.label("Fleet:").on_hover_text(
"(Optional) The name of the fleet for this robot. \
If specified, other fleets will not bid for this task.",
);
if !in_edit_mode {
ui.label(task_request.fleet_name().unwrap_or("None".to_string()));
} else {
edit_fleet_widget(ui, &mut new_task);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that on my machine "some" tooltips don't work, specifically Fleet doesn't but Requester does, can you reproduce?
I also wonder since we are pre-populating the fleet, do we actually want the fleet parameter to be editable or should it just be fixed?
Making it editable creates a risk of disconnect, for example TinyRobot1 is spawned in the world as part of Fleet1, users decide to assign a direct task to it and choose it from the dropdown, the fleet is automatically initialized to Fleet1, which is great.
However, the field is editable so users can change the fleet name to Fleet2 and still create a valid task but it seems to me that is an invalid task that should not be allowed.
What do you think?

Copy link
Member Author

@xiyuoh xiyuoh Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think you're right, it was quite an inconsistent design. I'll make this non-editable.
7de9d83

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that on my machine "some" tooltips don't work, specifically Fleet doesn't but Requester does, can you reproduce?

That's weird, on my end I'm able to see all the tooltips

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

5 participants