executive_smach
executive_smach copied to clipboard
Porting SMACH to ROS2
Hi guys, I am porting all my ROS applications to ROS2, and therefore, as I use SMACH to control some part of my autonomous robot mission, I need to port SMACH to ROS2. I looked at all the GitHub forks of SMACH but found no ROS2 version.
I will start a ROS2 branch on a fork, and try to port everything to ROS2 during the coming days.
First, have I missed something? Is there a ROS2 version under development? If not, if anybody wants to contribute in the porting, and/or testing of the ROS2 version, let me know!
Best,
it's there, if someone wants to have a look
https://github.com/lesire/executive_smach/tree/ros2-eloquent
The most difficult part was to manage threads (i.e. ROS2 Executors), and the fact that all subscribers/publishers/clients must be declared within ROS2 Nodes. ROS2 States now need a pointer to the ROS2 Node executing the SM in their constructors.
Except the Action Wrapper (somebody uses it??), all the other features have been ported to ROS2. Nevertheless, I only made the tests work, and therefore I am not sure yet that the threading management is functional in a standard 'main' script (without the unittesting framework). And also, it may need some helper functions to initialize correctly ROS2 and the Node.
Other important point: smach_viewer is on an independent repo, and if I have barely tested the IntrospectionClient, all the porting of smach_viewer has to be done (to ROS2 and Python3).
I would have needed to use the action wrapper quite excessive, as I was going to implement a behavior tree with it that mostly included larger sub-trees. As it was a hierarchical BT like concept, long open service-calls were prone to fail. I would have needed to alter my concept to actions. At least in ROS1 you get some strange behaviors when you have a service call too long open on the network.
But awesome to see someone has ported SMACH to ROS2! I wanted to tackle it during summer when I would have been up to speed with my other ROS2 related projects. Be sure to mention it here: https://discourse.ros.org/t/smach-for-ros-2/3175
Thanks for the interest. Yeah, I did not mention it yet because I was hoping to have some more time for testing or starting to port also the viewer... maybe a bit too optimistic
That's great you've been porting SMACH! What is the status? Can I use it on Foxy?
This issue has been mentioned on ROS Discourse. There might be relevant details there:
https://discourse.ros.org/t/smach-for-ros-2/3175/4
I saw this codebase that has reportedly made the switch to foxy - https://github.com/jeffrey870517/executive_smach
It has been a year, I think it is time to bump this topic. This last post by @Hermanoid is the most bleeding edge of this topic I can find.
I am tempted to try out the referenced code, but SMACH without smach_viewer is a proposition that is hard to stomach. An introspection tool is vital.
It looks like DeepX, inc. has a foxy version of executive_smach
and executive_smach_visualization
, but I haven't had eyes on them:
- https://github.com/DeepX-inc/executive_smach
- https://github.com/DeepX-inc/executive_smach_visualization
It has been more than 3 years and this issue is still open. I recommend checking YASMIN: Yet Another State MachINe library for ROS 2 :wink:
I'm listed as a maintainer, so I'm sorry for not taking any action til now. I just pushed ros2 branch based off of noetic-devel
branch. If anyone could open a pull request against that branch, that'll be great.
A few of you have posted links to ros2-ified forked repos? Note you can even open a PR using that (even if that is not the repo you have a control over, I think).
Yes indeed @130s ,
I've created the pull request #100 from the Deep-X-inc fork. Thanks a lot for looking into it !
Status:
- [x] ROS2-ified --> https://github.com/ros/executive_smach/pull/100, https://github.com/ros/executive_smach/pull/101 (thanks @bsteenput!)
- [x] Made release (3.0.1)
- Requested adding to index (so that the pkg info will be on index.ros.org, also deb installer will be generated), following https://docs.ros.org/en/humble/How-To-Guides/Releasing/Release-Team-Repository.html
- [ ] Requested to add source entry -> https://github.com/ros/rosdistro/pull/37620
- [ ] Requested to add a GBP repo -> https://github.com/ros2-gbp/ros2-gbp-github-org/issues/275
- [ ] Requested to add a release entry
This issue has been mentioned on ROS Discourse. There might be relevant details there:
https://discourse.ros.org/t/smach-for-ros-2/3175/7
Glad to see that porting SMACH to ROS 2 is moving so fast :+1: Taking advantage of the fact that this thread is active again, it is worth mentioning the issue of visualization. Being able to view the state machine in real time is a crucial part of using SMACH. So I suggest that we simultaneously port the executive_smach_visualization package to ROS 2 :wink:
@jkaniuka Understood, but let's open a ticket separately on executive_smach_visualization/issues. Would you mind doing that? I don't seem to have maintainer access in that repo, and I doubt I can extend my bandwidth to do another release work real soon.
First released version for ros2, 3.0.2 is out.
Requested making an installer:
- rolling https://github.com/ros/rosdistro/pull/37814
- iron https://github.com/ros/rosdistro/pull/37815
- humble https://github.com/ros/rosdistro/pull/37813