-
Notifications
You must be signed in to change notification settings - Fork 141
add lifecycle_msgs #24
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
|
|
||
| project(lifecycle_msgs) | ||
|
|
||
| if(NOT WIN32) | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra") | ||
| endif() | ||
|
|
||
| find_package(ament_cmake REQUIRED) | ||
| find_package(rosidl_default_generators REQUIRED) | ||
| find_package(std_msgs REQUIRED) | ||
|
|
||
| set(msg_files | ||
| "msg/Transition.msg" | ||
| ) | ||
| set(srv_files | ||
| "srv/ChangeState.srv" | ||
| "srv/GetState.srv" | ||
| ) | ||
|
|
||
| rosidl_generate_interfaces(${PROJECT_NAME} | ||
| ${msg_files} | ||
| ${srv_files} | ||
| DEPENDENCIES std_msgs | ||
| ADD_LINTER_TESTS | ||
| ) | ||
|
|
||
| ament_export_dependencies(rosidl_default_runtime) | ||
|
|
||
| ament_package() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Default values for primary states | ||
| # as described on | ||
| # http://design.ros2.org/articles/node_lifecycle.html | ||
|
|
||
| uint8 STATE_UNKNOWN = 0 | ||
| uint8 STATE_UNCONFIGURED = 1 | ||
| uint8 STATE_INACTIVE = 2 | ||
| uint8 STATE_ACTIVE = 3 | ||
| uint8 STATE_FINALIZED = 4 | ||
|
|
||
| uint8 start_state | ||
| uint8 goal_state | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if ease of introspection would mean that the state name should be used instead of enumeration values? I can see the efficiency value in using one-byte numbers, but I can also see the value in being able to see state names from the command line. What concerns me is that unlike the enumeration used in the implementation, these messages form an external, visible interface. I guess this probably needs more thinking about in terms of how we'll interact with a node's life cycle state machine. If there is a command line tool to manage them, then it can provide readability through its interface, but if we're going to end up using rostopic and rosservice to do it, then the messages themselves would need to be human-readable. I think I prefer the former. Either way, the state enumerations should probably be in the message, as @tfoote suggested.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to this, there was a discussion at some point about making For example: If you echo'ed that you'd get something like this: This is done by In the end, it seems like a shame to avoid the optimization on a message type that is likely to be sent so many times in virtually all systems. My vote would be to keep the optimization and try to mitigate the introspection issues with tooling, but I can see the point of why strings for states would be compelling. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0"?> | ||
| <?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
| <package format="2"> | ||
| <name>lifecycle_msgs</name> | ||
| <version>0.0.0</version> | ||
| <description>A package containing some lifecycle related message and service definitions.</description> | ||
| <maintainer email="karsten@osrfoundation.org">Karsten Knese</maintainer> | ||
| <license>Apache License 2.0</license> | ||
|
|
||
| <buildtool_depend>ament_cmake</buildtool_depend> | ||
| <buildtool_depend>rosidl_default_generators</buildtool_depend> | ||
|
|
||
| <build_depend>std_msgs</build_depend> | ||
|
|
||
| <exec_depend>rosidl_default_runtime</exec_depend> | ||
| <exec_depend>std_msgs</exec_depend> | ||
|
|
||
| <test_depend>ament_lint_common</test_depend> | ||
|
|
||
| <export> | ||
| <build_type>ament_cmake</build_type> | ||
| </export> | ||
| </package> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| uint8 TRANSITION_CONFIGURING = 10 | ||
| uint8 TRANSITION_CLEANINGUP = 11 | ||
| uint8 TRANSITION_SHUTTINGDOWN = 12 | ||
| uint8 TRANSITION_ACTIVATING = 13 | ||
| uint8 TRANSITION_DEACTIVATING = 14 | ||
| uint8 TRANSITION_ERRORPROCESSING = 15 | ||
|
|
||
| string node_name | ||
| uint8 transition | ||
| --- | ||
| bool success |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| string node_name | ||
| --- | ||
| uint8 current_state | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should constants be defined for the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about putting the constants for the default life cycle state in a separate file that gets included by both message definitions? |
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you need to depend on
std_msgsif you are using only primitive types (dependency can be removed frompackage.xmltoo)