Skip to content

Conversation

@bjoernschroeder
Copy link
Collaborator

@bjoernschroeder bjoernschroeder commented Jul 16, 2023

Share PML files and implementation for plans between ros1 and ros2 turtlesim. This PR only includes changes for ros2.

  • Turtlesim is moved to the folder supplementary/alica_ros_turtlesim/
  • alica_turtlesim contains shared PML files, configs and includes
  • libalica-trutrlesim contains plan and behaviour implementations shared by ros1 and ros2
  • ros2 contains ros specific implementations like base_app, launch files and behaviours using ros elements
    ros1 PR: Share lib between ros1 and ros2 turtlesim #502

@bjoernschroeder bjoernschroeder requested review from a team and veerajsk July 20, 2023 09:39
${geometry_msgs_LIBRARIES}
)

add_subdirectory(../libalica-turtlesim ../libalica-turtlesim)
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the "subdirectory" is not an actual subdirectory of ros1 we have to provide a relative build path for it. This allows us to build alica_ros_turtlesim without it being a package

@bjoernschroeder bjoernschroeder force-pushed the bas_ros2_shared_lib branch 2 times, most recently from f76aa34 to bc73b96 Compare July 27, 2023 07:34
@bjoernschroeder bjoernschroeder requested review from a team and veerajsk August 2, 2023 07:48
Comment on lines +47 to +49
LockedBlackboardRW bb(ac->editGlobalBlackboard());
bb.set<std::shared_ptr<turtlesim::TurtleInterfaces>>("turtle", std::make_shared<turtlesim::TurtleRos2Interfaces>(name));
bb.set("spawned", false);
Copy link
Contributor

Choose a reason for hiding this comment

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

we want do it after creating external thread?

* after is more like about order in code, we don't have any gurarntees when thread will be created

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The order doesnt matter in this case, whats important is that before we intiialize the alicaContext, we set the value in the blackboard. Only after that plans and behaviours will be executed and they need acess to this blackboard value.


rclcpp::CallbackGroup::SharedPtr spawnCallback = _nh->create_callback_group(rclcpp::CallbackGroupType::Reentrant);
_spawnClient = _nh->create_client<turtlesim::srv::Spawn>("/spawn", rmw_qos_profile_services_default, spawnCallback);
_spinThread = std::thread([this]() { _spinner.spin(); });
Copy link
Contributor

Choose a reason for hiding this comment

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

not clear for me how this thread should stop execution and why it's not joined. (same above but OOS)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We usually kill the app with ctrl+c and dont do a proper clean up, maybe we should cancel the spinner and join the thread when we receive the kill signal.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess ROS has a ctrl+c handler which not immediately kills the whole system and trying to shut it down properly
It could be great if we could make it more aligned with C++ standard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants