Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define external life cycle management interface #99

Open
wants to merge 12 commits into
base: gh-pages
Choose a base branch
from
Open

Define external life cycle management interface #99

wants to merge 12 commits into from

Conversation

gbiggs
Copy link
Member

@gbiggs gbiggs commented Nov 9, 2016

The previous version of the document only gave an ambiguous description of the external interface used to manage a node's life cycle. This pull request describes the interface in detail, including topic names, and message and service definitions.

@dirk-thomas
Copy link
Member

dirk-thomas commented Nov 9, 2016

Some high level feedback for now:

  • Do we need a specific service for every requested transition? Having a single service which takes an argument would make the API more flexible (since it would work for any state machine defined).
  • Currently ROS 2 does neither have the concept of a namespace nor latching. While we hope to support something similar in the future it might be problematic to refer to those terms in the design doc for now.

Regarding the Travis error: every sentence in the markdown files should start on a new line. Hopefully if you update the patch the ugly error should go away.

@gbiggs
Copy link
Member Author

gbiggs commented Nov 9, 2016

Both good points. Thanks, Dirk. I've made changes for both.

@Karsten1987
Copy link
Contributor

I'd like to propose to rename create and destroy into init and deinit respectively. I am having trouble with the word create, since we don't have a factory which creates nodes and we encourage users to inherit from a generic base class. That being said, a create function is more like a constructor and a destroy is a destructor which never really gets called externally.

Concretely speaking, this would result in an non-op constructor, getting called when a user instantiates a new node. The respective init function, then, which is responsible for enabling all pub/sub etc, can get triggered externally.

@gbiggs
Copy link
Member Author

gbiggs commented Nov 10, 2016

I don't feel that renaming them to init and deinit is correct. These two functions are more intended to be provided by a container system that has a factory to create and destroy nodes on demand, rather than by the nodes themselves. This is why they are not included in the node's external interface specification. If a managed node is created by a user in their own main(), then there will be no create and destroy calls.

If I clarify the document to make this clear, would that be satisfactory?

@jack-oquin
Copy link

If I clarify the document to make this clear, would that be satisfactory?

+1; that would be a useful improvement.

@jack-oquin
Copy link

Overall, this document looks good to me.

Maybe I just missed it, but where and how does the management interface return the current state?

@gbiggs
Copy link
Member Author

gbiggs commented Nov 11, 2016

The current state is broadcast on a topic, and is also accessible via a service.

@gbiggs
Copy link
Member Author

gbiggs commented Nov 11, 2016

I clarified that create and destroy are functions of a container system, but I think the document could do with more detail on what a container is and what interface it should provide. However, that needs more discussion about what, if anything, we want to do with containers.

It is expected that a common pattern will be to have a container class which loads a managed node implementation from a library and through a plugin architecture automatically exposes the required management interface via methods and the container is not subject to the lifecycle management.
However, it is fully valid to consider any implementation which provides this interface and follows the lifecycle policies a managed node.
Conversely, any object that provides these services but does not behave in the way defined in the life cycle state machine is malformed.
The interface shall be provided in a namespace named "infra/lifecycle" underneath the node's namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

As we don't have namespaces in ROS2.0 for the moment, I believe this paragraph can not be merged as is. Currently, the topics and services are advertised with *__get_state, *__change_state and *__transition_event

Copy link
Member

Choose a reason for hiding this comment

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

Which is still a kind of namespace - just not with a / but with __.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now that namespace support is being implemented, is this paragraph acceptable?

Copy link
Member

Choose a reason for hiding this comment

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

It should probably make use of the leading _ in topic names to make it "hidden":

http://design.ros2.org/articles/topic_and_service_names.html#hidden-topic-or-service-names

Otherwise, it uses a namespace as currently written, so I'm not sure what else you might be referring to.

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 was referring to @dirk-thomas 's comment that it doesn't use an actual namespace (separated with a /) but uses __ to mimic a namespace. The proposal from @Karsten1987 is to change the topics used by the lifecycle interface to not use namespaces.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I was getting at.

And on going to add the underscore to make it a hidden interface, I found myself unsure where to add it. On infra or on lifecycle? Is infra going to be a widely-used thing for ROS infrastructure topics? (I hope it is.)

Copy link
Member

Choose a reason for hiding this comment

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

I don't know how I feel about infra over infrastructure or impl or ros, or even just letting individual things create their own "impl" namespaces. For example, maybe the common namespace for these things should be just ~/_lifecycle/. But in general, namespacing the plumbing is something I think we should be doing.

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'm in favour of having all infrastructure stuff under a single namespace because it makes things tidier, but I can see the argument of "who defines/controls what is 'infrastructure' enough to go in there?".

Copy link
Member

Choose a reason for hiding this comment

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

I can see that angle too. It seems to be a bit a bikeshed thing atm. I'm fine with leaving it as-is because we can always come back and change it later once we get more of these "infrastructure" topics and services in place. Perhaps then a better pattern with emerge.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I make the infra namespace hidden. We can wait a while and see if anything else starts using this same namespace. If not, we can remove it.

uint8 SHUTTING_DOWN=12
uint8 ACTIVATING=13
uint8 DEACTIVATING=14
uint8 ERROR_PROCESSING=15
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Should the msg file follow the specification, or should the specification reference the msg? One needs to be considered the master definition, and the other needs to be kept in sync with it.

Although I prefer keeping the specification document as the master definition, when considering maintenance, having the spec link to the msg file would be easier.

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind either way. Linking to the spec might have the problem of tracking changes over time. Then again it may be just as hard to represent that in this document as well. So I don't see that one way is strictly better than the other. At least with the interface file being the sole authority, you can avoid some duplication of information if you choose.

Copy link
Member Author

Choose a reason for hiding this comment

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

Having thought about it more, I prefer keeping the spec as the master definition. In theory there could be other implementations. I will add a link, though.


### Life cycle state changes topic

When the node's life cycle changes, it shall broadcast the following message on the `infra/lifecycle/state_change` topic.
Copy link
Contributor

Choose a reason for hiding this comment

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

`<node_name>__transition_event'

Copy link
Member Author

Choose a reason for hiding this comment

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

See above about namespaces.


### Current life cycle state service

The node's current life cycle state shall be available via the `infra/lifecycle/get_state` service.
Copy link
Contributor

Choose a reason for hiding this comment

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

<node_name>__get_state

Copy link
Member Author

Choose a reason for hiding this comment

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

See above about namespaces.


### Transition request service

The service `infra/lifecycle/change_state` service shall be provided by the life cycle interface.
Copy link
Contributor

Choose a reason for hiding this comment

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

<node_name>__change_state

Copy link
Member Author

Choose a reason for hiding this comment

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

See above about namespaces.

@dirk-thomas
Copy link
Member

@gbiggs Can you please address the pending comments.

@clalancette clalancette added ready Work is about to start (Kanban column) requires-changes and removed ready Work is about to start (Kanban column) labels Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants