The difference between `event` and `phase` (#334)

Posted by @liugehaizaixue:

In ‘rmf_fleet_adapter’, the components of tasks include events, phases, services, and tasks. I would like to know their specific definitions and differences.

For example, when should I use ‘events’ or’ phases’ when defining a task on my own`

Chosen answer

Answer chosen by @liugehaizaixue at 2023-07-18T11:46:49Z.
Answered by @mxgrey:

This is mostly correct. LegacyPhase is a wrapper around the old implementations of “phases” so that we can adapt them into the new implementation of phases/events/activities without completely rewriting them. The new implementation of phases allows for more features than the old implementation.

As you said, the new phases consist of events and/or activities (we will probably remove the use of the world events and replace it all with activities in the future).

Events/Activities can also be hierarchical, consisting of their own child events/activities, so what makes them different from a “phase”? With the new phases, you can ask it to skip or rewind to the beginning of any phase. You cannot skip or rewind to the beginning of any event/activity.

For the next generation of RMF I’m thinking about generalizing this concept so that when you define a custom task you can put named checkpoints anywhere inside the task description, and then operators can request a skip/rewind to any checkpoint. However this is a low priority feature compared to traffic behavior improvements, so I don’t know when we would begin on this.

Posted by @mustafakurban:

Please let me know if you find out :slight_smile:

Posted by @liugehaizaixue:

In addition to phase and event , I have also learned about Activity , but I still don’t quite understand their definitions and differences.

I have learned about the definitions of “event”, “phase”, “activity”, and “task” in rmf_task/rmf_task_sequence. However, I have also seen “event”, “phase”, and “task” in rmf_ros2/fleet_adapter. What is the relationship between them? I am very keen on understanding the task system in rmf so that I can use it flexibly.

Posted by @liugehaizaixue:

I do not have a thorough understanding of the LegacyTask , LegacyPhases , and LegacyPhaseShim components. Moreover, the LegacyPhaseShim mentions a “new task event system,” and I am curious to learn more about the dissimilarities between the “new task event system” and the “old task event system.” I would highly appreciate it if someone could provide me with an in-depth explanation.

Posted by @liugehaizaixue:

I am not sure if my understanding of the following is correct:

The phase in the rmf_fleet_adapter is a legacy part that RMF currently wants to change to event.

The new phase is defined as a combination of a series of events, that is, a combination of activities, which can be seen in Compose.

If my understanding is incorrect, please correct me! Thank you!

Posted by @mxgrey:

This is mostly correct. LegacyPhase is a wrapper around the old implementations of “phases” so that we can adapt them into the new implementation of phases/events/activities without completely rewriting them. The new implementation of phases allows for more features than the old implementation.

As you said, the new phases consist of events and/or activities (we will probably remove the use of the world events and replace it all with activities in the future).

Events/Activities can also be hierarchical, consisting of their own child events/activities, so what makes them different from a “phase”? With the new phases, you can ask it to skip or rewind to the beginning of any phase. You cannot skip or rewind to the beginning of any event/activity.

For the next generation of RMF I’m thinking about generalizing this concept so that when you define a custom task you can put named checkpoints anywhere inside the task description, and then operators can request a skip/rewind to any checkpoint. However this is a low priority feature compared to traffic behavior improvements, so I don’t know when we would begin on this.


This is the chosen answer.

Posted by @liugehaizaixue:

This is mostly correct. LegacyPhase is a wrapper around the old implementations of “phases” so that we can adapt them into the new implementation of phases/events/activities without completely rewriting them. The new implementation of phases allows for more features than the old implementation.

As you said, the new phases consist of events and/or activities (we will probably remove the use of the world events and replace it all with activities in the future).

Events/Activities can also be hierarchical, consisting of their own child events/activities, so what makes them different from a “phase”? With the new phases, you can ask it to skip or rewind to the beginning of any phase. You cannot skip or rewind to the beginning of any event/activity.

For the next generation of RMF I’m thinking about generalizing this concept so that when you define a custom task you can put named checkpoints anywhere inside the task description, and then operators can request a skip/rewind to any checkpoint. However this is a low priority feature compared to traffic behavior improvements, so I don’t know when we would begin on this.

Thank you for your explanation. I am very interested in the flexible use of ‘phase’. I think it is full of possibilities.