ros2clifecycle_set and ros2service_call_change_state in lifecycle management is too slow.
See original GitHub issueBug report
Required Info:
- Operating System:
- ubuntu22.04
- Installation type:
- binary
- Version or commit hash:
- Humble
- DDS implementation:
- rmw_fastrtps_cpp
- Client library (if applicable):
- ros2cli
Steps to reproduce issue
the simple lifecycle node can be seen in https://github.com/micro-ROS/system_modes/tree/master/system_modes_examples
time ros2 lifecycle set /drive_base activate
Transitioning successful
real 0m2.030s
user 0m0.334s
sys 0m0.113s
time ros2 lifecycle set /drive_base deactivate
Transitioning successful
real 0m2.089s
user 0m0.419s
sys 0m0.083s
time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 3, label: activate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=3, label='activate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m2.128s
user 0m0.379s
sys 0m0.082s
time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 4, label: deactivate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=4, label='deactivate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m2.776s
user 0m0.343s
sys 0m0.096s
Additional information
repeated test of the same cmd can make it quicker, see the complete test log below
zs@zs-vm-2204:~/zs_ws/ga_ros$ time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 3, label: activate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=3, label='activate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m2.128s
user 0m0.379s
sys 0m0.082s
zs@zs-vm-2204:~/zs_ws/ga_ros$ time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 3, label: activate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=3, label='activate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=False)
real 0m1.231s
user 0m0.536s
sys 0m0.117s
zs@zs-vm-2204:~/zs_ws/ga_ros$ time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 4, label: deactivate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=4, label='deactivate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m2.776s
user 0m0.343s
sys 0m0.096s
zs@zs-vm-2204:~/zs_ws/ga_ros$ time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 3, label: activate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=3, label='activate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m1.017s
user 0m0.354s
sys 0m0.075s
zs@zs-vm-2204:~/zs_ws/ga_ros$ time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 4, label: deactivate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=4, label='deactivate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m2.737s
user 0m0.560s
sys 0m0.113s
zs@zs-vm-2204:~/zs_ws/ga_ros$ time ros2 service call /drive_base/change_state lifecycle_msgs/ChangeState "{transition: {id: 3, label: activate}}"
waiting for service to become available...
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=3, label='activate'))
response:
lifecycle_msgs.srv.ChangeState_Response(success=True)
real 0m3.112s
user 0m0.370s
sys 0m0.076s
zs@zs-vm-2204:~/zs_ws/ga_ros$
Thanks.
Issue Analytics
- State:
- Created 10 months ago
- Comments:7
Top Results From Across the Web
Amazon EFS lifecycle management - AWS Documentation
Amazon EFS lifecycle management uses an internal timer to track when a file was last accessed, and not the POSIX file system attributes...
Read more >Optimize costs by automatically managing the data lifecycle
Use Azure Storage lifecycle management policies to create automated rules for moving data between hot, cool, and archive tiers.
Read more >Contract Life Cycle Management Reviews 2022 - Gartner
Read Contract Life Cycle Management reviews verified by Gartner. Compare and find the best Contract Life Cycle Management for your organization.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
neither
rclpy
.ros2cli
hasNodeStrategy
to rely onros2 daemon
to reduce the time to get the connectivity map, but this can be opt-out.i guess that this could be, it would be worth to try.
I am not sure if this is right for everyone, it depends on the use case and requirement.
I am using 1th Gen Intel® Core™ i9-11900K @ 3.50GHz, and lifecycle_talker(w/o this line) can respond approximately 1 secnod.
I do not really know the requirement or expectation in performance perspective for this issue, but 1 second is reasonable for me. And this will also depends on the network configuration and node graph.
the reason that
ros2 lifecycle set
takes time is that it does many things under the hood.