      * [ Unlocking the potential of Fast DDS middleware [community-contributed] ](../Tutorials/Advanced/FastDDS-Configuration.html)
      * [ Improved Dynamic Discovery ](../Tutorials/Advanced/Improved-Dynamic-Discovery.html)
      * [ Recording a bag from a node (C++) ](../Tutorials/Advanced/Recording-A-Bag-From-Your-Own-Node-CPP.html)
      * [ Recording a bag from a node (Python) ](../Tutorials/Advanced/Recording-A-Bag-From-Your-Own-Node-Py.html)
      * [ Reading from a bag file (C++) ](../Tutorials/Advanced/Reading-From-A-Bag-File-CPP.html)
      * [ How to use ros2_tracing to trace and analyze an application ](../Tutorials/Advanced/ROS2-Tracing-Trace-and-Analyze.html)
      * [ Simulators ](../Tutorials/Advanced/Simulators/Simulation-Main.html)
        * [ Webots ](../Tutorials/Advanced/Simulators/Webots/Simulation-Webots.html)
          * [ Installation (Ubuntu) ](../Tutorials/Advanced/Simulators/Webots/Installation-Ubuntu.html)
          * [ Installation (Windows) ](../Tutorials/Advanced/Simulators/Webots/Installation-Windows.html)
          * [ Installation (macOS) ](../Tutorials/Advanced/Simulators/Webots/Installation-MacOS.html)
          * [ Setting up a robot simulation (Basic) ](../Tutorials/Advanced/Simulators/Webots/Setting-Up-Simulation-Webots-Basic.html)
          * [ Setting up a robot simulation (Advanced) ](../Tutorials/Advanced/Simulators/Webots/Setting-Up-Simulation-Webots-Advanced.html)
          * [ Setting up a Reset Handler ](../Tutorials/Advanced/Simulators/Webots/Simulation-Reset-Handler.html)
          * [ The Ros2Supervisor Node ](../Tutorials/Advanced/Simulators/Webots/Simulation-Supervisor.html)
        * [ Gazebo ](../Tutorials/Advanced/Simulators/Gazebo/Simulation-Gazebo.html)
          * [ Setting up a robot simulation (Gazebo) ](../Tutorials/Advanced/Simulators/Gazebo/Gazebo.html)
      * [ Security ](../Tutorials/Advanced/Security/Security-Main.html)
        * [ Setting up security ](../Tutorials/Advanced/Security/Introducing-ros2-security.html)
        * [ Understanding the security keystore ](../Tutorials/Advanced/Security/The-Keystore.html)
        * [ Ensuring security across machines ](../Tutorials/Advanced/Security/Security-on-Two.html)
        * [ Examining network traffic ](../Tutorials/Advanced/Security/Examine-Traffic.html)
        * [ Setting access controls ](../Tutorials/Advanced/Security/Access-Controls.html)
        * [ Deployment Guidelines ](../Tutorials/Advanced/Security/Deployment-Guidelines.html)
    * [ Demos ](../Tutorials/Demos.html)
      * [ Using quality-of-service settings for lossy networks ](../Tutorials/Demos/Quality-of-Service.html)
      * [ Managing nodes with managed lifecycles ](../Tutorials/Demos/Managed-Nodes.html)
      * [ Setting up efficient intra-process communication ](../Tutorials/Demos/Intra-Process-Communication.html)
      * [ Recording and playing back data with ` rosbag  ` using the ROS 1 bridge ](../Tutorials/Demos/Rosbag-with-ROS1-Bridge.html)
      * [ Understanding real-time programming ](../Tutorials/Demos/Real-Time-Programming.html)
      * [ Experimenting with a dummy robot ](../Tutorials/Demos/dummy-robot-demo.html)
      * [ Logging ](../Tutorials/Demos/Logging-and-logger-configuration.html)
      * [ Creating a content filtering subscription ](../Tutorials/Demos/Content-Filtering-Subscription.html)
      * [ Configure service introspection ](../Tutorials/Demos/Service-Introspection.html)
    * [ Miscellaneous ](../Tutorials/Miscellaneous.html)
      * [ Deploying on IBM Cloud Kubernetes [community-contributed] ](../Tutorials/Miscellaneous/Deploying-ROS-2-on-IBM-Cloud.html)
      * [ Using Eclipse Oxygen with ` rviz2  ` [community-contributed] ](../Tutorials/Miscellaneous/Eclipse-Oxygen-with-ROS-2-and-rviz2.html)
      * [ Building a real-time Linux kernel [community-contributed] ](../Tutorials/Miscellaneous/Building-Realtime-rt_preempt-kernel-for-ROS-2.html)
      * [ Building a package with Eclipse 2021-06 ](../Tutorials/Miscellaneous/Building-ROS2-Package-with-eclipse-2021-06.html)
  * [ How-to Guides ](../How-To-Guides.html)


* Run the demos


The direction looks good to me.


[ Robotics  ](/tag/robotics?source=post_page-----209ed023d8e5---------------
robotics-----------------)


Explore


[ ![theme-lib.general.user-
avatar](https://avatars.profile.sap.com/0/3/id0336577110d1cbd36c828250edcfd13b280b394a75840b65aafa24d193501d3d_small.jpeg)
](/t5/user/viewprofilepage/user-id/189028 "View profile") ** by  [
sapna_ramaiah  ](/t5/user/viewprofilepage/user-id/189028 "View profile") ** •
_Employee_


> Move the ` rclcpp_components ` resource type to ` ros(2)_components ` to
> make it language irrelevant.


The command will return the unique ID of the loaded component as well as the
node name.


    $ ros2 component types
    (... components of other packages here)
    composition
      composition::Talker
      composition::Listener
      composition::NodeLikeListener
      composition::Server
      composition::Client
    (... components of other packages here)


The ` ros2  ` command line utility can now be used to inspect the state of the
container:


edited


Contributor  Author


In ROS1 (Robot Operating System), We can write the code either as a ROS _node_
or _nodelet_ . As I mentioned in a prior post, Node is a self-contained unit
of computation that performs a specific task within the system. It is
implemented as an executable file that can be run independently, and
communicates with other nodes through ROS messaging.


We read every piece of feedback, and take your input very seriously.


So we need two files with the same name but different content, that's pretty
confusing for the developers. I would come up with the solution to store two
files with different names ` my_composition_empty ` and ` my_composition ` ,
then specify the different paths to install them.


    * [ All features ](/features)
    * [ Documentation  ](https://docs.github.com)
    * [ GitHub Skills  ](https://skills.github.com/)
    * [ Blog  ](https://github.blog)


    $ ros2 component list
    /ComponentManager
       1  /talker2
       2  /ns/talker
       3  /ns2/talker3


Please try and see if it makes sense :)

---

All reactions


Namespace remappings of the container do not affect loaded components.


    # Terminal 1
    ros2 run rclcpp_components component_container


](https://medium.statuspage.io/?source=post_page-----
209ed023d8e5--------------------------------)


Sorry, something went wrong.


Copy link


You signed in with another tab or window. [ Reload ]() to refresh your
session.  You signed out in another tab or window. [ Reload ]() to refresh
your session.  You switched accounts on another tab or window. [ Reload ]() to
refresh your session.  Dismiss alert


Search


* 👍  1 reaction


* Open Source


|  1

[ View all ](/t5/forums/kudosleaderboardpage/board-id/crm-blog-
sap/timerange/one_week/page/1/tab/authors)


User  |  Count
---|---

[
![balajibalasubra](https://avatars.profile.sap.com/5/a/id5a3db491b87aaef10d519c41e29f9691da7675562d27d8ea252427d0896c6fb0_small.jpeg)
![Associate](/html/@C6690A74F301515E6881523D52BDF6AA/rank_icons/sap-logo-
small-14px.png) balajibalasubra  ](/t5/user/viewprofilepage/user-id/43526)


I don't have a clear implementation for the API yet, but the rclcpp
implementation should be considered as a reference: [ register node macro
](https://github.com/ros2/rclcpp/blob/master/rclcpp_components/include/rclcpp_components/register_node_macro.hpp#L33)


Blog


**component container**


[ ![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=80&v=4)
](/crystaldust)


[ ROS 2 Documentation: Rolling ![Logo](../_static/rolling-small.png)
](../index.html)
  * [ Installation ](../Installation.html)
    * [ Ubuntu (Debian packages) ](../Installation/Ubuntu-Install-Debians.html)
    * [ Windows (binary) ](../Installation/Windows-Install-Binary.html)
    * [ RHEL (RPM packages) ](../Installation/RHEL-Install-RPMs.html)
    * [ Alternatives ](../Installation/Alternatives.html)
      * [ Ubuntu (source) ](../Installation/Alternatives/Ubuntu-Development-Setup.html)
      * [ Ubuntu (binary) ](../Installation/Alternatives/Ubuntu-Install-Binary.html)
      * [ Windows (source) ](../Installation/Alternatives/Windows-Development-Setup.html)
      * [ RHEL (source) ](../Installation/Alternatives/RHEL-Development-Setup.html)
      * [ RHEL (binary) ](../Installation/Alternatives/RHEL-Install-Binary.html)
      * [ macOS (source) ](../Installation/Alternatives/macOS-Development-Setup.html)
      * [ Latest development (source) ](../Installation/Alternatives/Latest-Development-Setup.html)
    * [ Maintain source checkout ](../Installation/Maintaining-a-Source-Checkout.html)
    * [ Testing with pre-release binaries ](../Installation/Testing.html)
    * [ DDS implementations ](../Installation/DDS-Implementations.html)
      * [ Connext security plugins ](../Installation/DDS-Implementations/Install-Connext-Security-Plugins.html)
      * [ RTI Connext DDS ](../Installation/DDS-Implementations/Install-Connext-University-Eval.html)
      * [ Eclipse Cyclone DDS ](../Installation/DDS-Implementations/Working-with-Eclipse-CycloneDDS.html)
      * [ GurumNetworks GurumDDS ](../Installation/DDS-Implementations/Working-with-GurumNetworks-GurumDDS.html)
      * [ eProsima Fast DDS ](../Installation/DDS-Implementations/Working-with-eProsima-Fast-DDS.html)
  * [ Distributions ](../Releases.html)
    * [ Iron Irwini ( ` iron  ` ) ](../Releases/Release-Iron-Irwini.html)
      * [ Iron Irwini Changelog ](../Releases/Iron-Irwini-Complete-Changelog.html)
    * [ Humble Hawksbill ( ` humble  ` ) ](../Releases/Release-Humble-Hawksbill.html)
      * [ Humble Hawksbill changelog ](../Releases/Humble-Hawksbill-Complete-Changelog.html)
    * [ Rolling Ridley ( ` rolling  ` ) ](../Releases/Release-Rolling-Ridley.html)
    * [ Development Distribution ](../Releases/Development.html)
      * [ Jazzy Jalisco ( ` jazzy  ` ) ](../Releases/Release-Jazzy-Jalisco.html)
    * [ End-of-Life Distributions ](../Releases/End-of-Life.html)
      * [ Galactic Geochelone ( ` galactic  ` ) ](../Releases/Release-Galactic-Geochelone.html)
        * [ Galactic Geochelone changelog ](../Releases/Galactic-Geochelone-Complete-Changelog.html)
      * [ Foxy Fitzroy ( ` foxy  ` ) ](../Releases/Release-Foxy-Fitzroy.html)
      * [ Eloquent Elusor ( ` eloquent  ` ) ](../Releases/Release-Eloquent-Elusor.html)
      * [ Dashing Diademata ( ` dashing  ` ) ](../Releases/Release-Dashing-Diademata.html)
      * [ Crystal Clemmys ( ` crystal  ` ) ](../Releases/Release-Crystal-Clemmys.html)
      * [ Bouncy Bolson ( ` bouncy  ` ) ](../Releases/Release-Bouncy-Bolson.html)
      * [ Ardent Apalone ( ` ardent  ` ) ](../Releases/Release-Ardent-Apalone.html)
      * [ Beta 3 ( ` r2b3  ` ) ](../Releases/Beta3-Overview.html)


In the first shell, start the component container:


In the shell call (see [ source code
](https://github.com/ros2/demos/blob/master/composition/src/manual_composition.cpp)
):


Labels


Follow


Contributor  Author


> Just let ` ros2 component types ` command search the ` rclpy_components `
> entry points, we can refer to the actual component classes.


I'm interested in this, is there any more detail about the mechanism? I would
like to look into this and see if we can do something around it. Since I see
some talks about 3rd party modules in setup.py in stack overflow [ here
](https://stackoverflow.com/questions/44308548/how-should-i-handle-importing-
third-party-libraries-within-my-setup-py-script) , but it seems like they
don't consider the dependency availability problem.


__ [ ROS 2 Documentation: Xin ](../index.html)


|  3

[
![carmen_constantinescu](https://avatars.profile.sap.com/7/4/id74ea3ef03e3ba3f5eb8370613a59d9eab44fba3b621249b47c42d9cec2636458_small.jpeg)
![Product and Topic
Expert](/html/@C6690A74F301515E6881523D52BDF6AA/rank_icons/sap-logo-
small-14px.png) carmen_constant  inescu  ](/t5/user/viewprofilepage/user-
id/415235)


    from setuptools.command.develop import develop
    from rclpy.component import rclpy_register_component

    rclpy_components = [
      'composition::Talker=my_robot_app.components:Talker',
      'composition::Listener=my_robot_app.components:Listener',
    ]

    class develop_cmd_with_component_registration(develop):
      def run(self):
        develop.run(self)
        # It's just like a post install hook
        rclpy_register_component(rclpy_components)

    setup(
      name='my_robot_app',
      entry_points={
        'rclpy_components': rclpy_components
      },
      cmdclass={'develop': develop_cmd_with_component_registration}
    )


Milestone


Yes. Beside that I think the component container needs to expose an API what
type of components supports (as mentioned before).

---

All reactions


[ Sign up
](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-
name%3E%2F%3Crepo-
name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-
repo&source_repo=ros2%2Frclpy)


  * **117100** Views
  * **112** comments
  * **124** kudos


---

All reactions


That's a good idea, I see the CLI uses [ argcomplete
](https://pypi.org/project/argcomplete/) to match arguments, should I provide
a service whose name is in a specific pattern to make argcomplete recognize
the matching rules? I see your answer in a similar question [ here
](https://answers.ros.org/question/296464/ros2-tab-completion-not-working-
after-bouncy/) , the argcomplete should rely on the ament index resource.


While the command line tools are useful for debugging and diagnosing component
configurations, it is frequently more convenient to start a set of components
at the same time. To automate this action, we can use the functionality in `
ros2  launch  ` .


> the component class's path also needs to be stored in the ament resource
> index path so ` ros2 component types ` command will find it.


#  Composing multiple nodes in a single process  


#  ROS2 from the Ground Up: Part 4- Building Robust Robotics Systems with ROS2
Composition


    $ ros2 component list
    /ComponentManager


* [ Update Release Policy and Publication Frequency for Composable Storefront Libraries ](https://help.sap.com/docs/SAP_COMMERCE_COMPOSABLE_STOREFRONT/6c7b98dbe68f4a508cac17a207182f4c/ba62c2c708ec4751a2612a512177419b.html)


[ ![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=40&v=4)
](/crystaldust) [ crystaldust ](/crystaldust) closed this as [ completed
](/ros2/rclpy/issues?q=is%3Aissue+is%3Aclosed+archived%3Afalse+reason%3Acompleted)
Jun 17, 2020


Verify that the container is running via ` ros2  ` command line tools:


In the second shell load both the talker and listener as we have before:


That's true, so maybe we should add more resource types like rclpy_components
and ros2cli component verb would also obtain these types when listing
components.


](https://policy.medium.com/medium-terms-of-
service-9db0094a1e0f?source=post_page-----
209ed023d8e5--------------------------------)


Follow


Contributor  Author


    * [ IDEs and Debugging [community-contributed] ](../How-To-Guides/ROS-2-IDEs.html)
    * [ Setup ROS 2 with VSCode and Docker [community-contributed] ](../How-To-Guides/Setup-ROS-2-with-VSCode-and-Docker-Container.html)
    * [ Using Custom Rosdistro Version ](../How-To-Guides/Using-Custom-Rosdistro.html)
    * [ Building RQt from source ](../How-To-Guides/RQt-Source-Install.html)
      * [ Building RQt from source on macOS ](../How-To-Guides/RQt-Source-Install-MacOS.html)
      * [ Building RQt from source on Windows 10 ](../How-To-Guides/RQt-Source-Install-Windows10.html)
  * [ Concepts ](../Concepts.html)
    * [ Basic Concepts ](../Concepts/Basic.html)
      * [ Nodes ](../Concepts/Basic/About-Nodes.html)
      * [ Discovery ](../Concepts/Basic/About-Discovery.html)
      * [ Interfaces ](../Concepts/Basic/About-Interfaces.html)
      * [ Topics ](../Concepts/Basic/About-Topics.html)
      * [ Services ](../Concepts/Basic/About-Services.html)
      * [ Actions ](../Concepts/Basic/About-Actions.html)
      * [ Parameters ](../Concepts/Basic/About-Parameters.html)
      * [ Introspection with command line tools ](../Concepts/Basic/About-Command-Line-Tools.html)
      * [ Launch ](../Concepts/Basic/About-Launch.html)
      * [ Client libraries ](../Concepts/Basic/About-Client-Libraries.html)
    * [ Intermediate Concepts ](../Concepts/Intermediate.html)
      * [ The ROS_DOMAIN_ID ](../Concepts/Intermediate/About-Domain-ID.html)
      * [ Different ROS 2 middleware vendors ](../Concepts/Intermediate/About-Different-Middleware-Vendors.html)
      * [ Logging and logger configuration ](../Concepts/Intermediate/About-Logging.html)
      * [ Quality of Service settings ](../Concepts/Intermediate/About-Quality-of-Service-Settings.html)
      * [ Executors ](../Concepts/Intermediate/About-Executors.html)
      * [ Topic statistics ](../Concepts/Intermediate/About-Topic-Statistics.html)
      * [ Overview and usage of RQt ](../Concepts/Intermediate/About-RQt.html)
      * [ Composition ](../Concepts/Intermediate/About-Composition.html)
      * [ Cross-compilation ](../Concepts/Intermediate/About-Cross-Compilation.html)
      * [ ROS 2 Security ](../Concepts/Intermediate/About-Security.html)
      * [ Tf2 ](../Concepts/Intermediate/About-Tf2.html)
    * [ Advanced Concepts ](../Concepts/Advanced.html)
      * [ The build system ](../Concepts/Advanced/About-Build-System.html)
      * [ Internal ROS 2 interfaces ](../Concepts/Advanced/About-Internal-Interfaces.html)
      * [ ROS 2 middleware implementations ](../Concepts/Advanced/About-Middleware-Implementations.html)
  * [ Contact ](../Contact.html)
  * [ The ROS 2 Project ](../The-ROS2-Project.html)
    * [ Contributing ](Contributing.html)
      * [ ROS 2 developer guide ](Contributing/Developer-Guide.html)
      * [ Code style and language versions ](Contributing/Code-Style-Language-Versions.html)
      * [ Quality guide: ensuring code quality ](Contributing/Quality-Guide.html)


[ ](https://github.com/)


Employee


[ ![Jegathesan
Shanmugam](https://miro.medium.com/v2/resize:fill:88:88/2*h3PRzfT7jps1zKlfhvGp6Q.jpeg)
](/@nullbyte.in?source=post_page-----
209ed023d8e5--------------------------------)


Copy link


**[ dirk-thomas ](/dirk-thomas) ** commented  Jun 22, 2020


At least until [ PEP 517 ](https://www.python.org/dev/peps/pep-0517/) is
supported.

---

All reactions


**[ crystaldust ](/crystaldust) ** commented  Jun 17, 2020


$ ros2 launch composition composition_demo.launch.py


[ ![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=40&v=4)
](/crystaldust) [ crystaldust ](/crystaldust) mentioned this issue  Jul 14,
2020


Sorry, something went wrong.


* Composable nodes as shared libraries


One _potential drawback of using ROS2 components_ is that if there is a
failure in one of the components, it can potentially _bring down the entire
process_ . This is because components are implemented as shared libraries that
are loaded at runtime, and they rely on the container process to manage their
lifecycle. If a component fails, it can cause the container process to
terminate, which can in turn bring down the entire system.


    # Camera component
    touch ~/ros2_ws/src/img_pipeline_composition/include/img_pipeline_composition/camera_component.hpp
    touch ~/ros2_ws/src/img_pipeline_composition/src/camera_component.cpp

    # Display component
    touch ~/ros2_ws/src/img_pipeline_composition/include/img_pipeline_composition/display_component.hpp
    touch ~/ros2_ws/src/img_pipeline_composition/src/display_component.cpp

    # Launch file
    mkdir ~/ros2_ws/src/img_pipeline_composition/launch/
    touch ~/ros2_ws/src/img_pipeline_composition/launch/image_pipeline_launch.py

    // Copyright 2016 Open Source Robotics Foundation, Inc.
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     http://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.

    #ifndef IMAGE_PIPELINE_COMPOSITION__VISIBILITY_CONTROL_H_
    #define IMAGE_PIPELINE_COMPOSITION__VISIBILITY_CONTROL_H_

    #ifdef __cplusplus
    extern "C"
    {
    #endif

    // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
    //     https://gcc.gnu.org/wiki/Visibility


> I'm interested in this, is there any more detail about the mechanism?


![Employee](/html/@C6690A74F301515E6881523D52BDF6AA/rank_icons/sap-logo-
small-14px.png) [ PhilippeS
](https://community.sap.com/t5/user/viewprofilepage/user-id/16331)


[ Computer Vision  ](/tag/computer-vision?source=post_page-----209ed023d8e5
---------------computer_vision-----------------)


Contributor


This doesn't look that complex as above, acceptable for me as a developer who
uses py composition.

---

👍  1  dirk-thomas reacted with thumbs up emoji


**[ dirk-thomas ](/dirk-thomas) ** commented  Jul 6, 2020


Help


` ros2 run rclcpp_components component_container ` is a command that is used
to start the ROS2 component manager in a container process.


##  Use saved searches to filter your results more quickly


[ crystaldust ](/crystaldust) opened this issue  Jun 16, 2020  · 20 comments


Open


[ ROS 2 Documentation: Xin ](../index.html)


##  Advanced Topics  


All reactions


[ ![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=80&v=4)
](/crystaldust)


* [ GitHub Sponsors  Fund open source developers  ](/sponsors)


    * [ ROS 2 Galactic Geochelone (codename ‘galactic’; May, 2021) ](../Releases/Release-Galactic-Geochelone.html)
    * [ ROS 2 Galactic Geochelone Complete Changelog ](../Releases/Galactic-Geochelone-Complete-Changelog.html)
    * [ ROS 2 Humble Hawksbill (codename ‘humble’; May, 2022) ](../Releases/Release-Humble-Hawksbill.html)
    * [ ROS 2 Rolling Ridley (codename ‘rolling’; June 2020) ](../Releases/Release-Rolling-Ridley.html)
  * [ Features Status ](../Features.html)
  * [ Roadmap ](../Roadmap.html)
  * [ Feature Ideas ](../Feature-Ideas.html)
  * [ Project Governance ](../Governance.html)
    * [ ROS 2 Technical Steering Committee Charter ](../Governance/ROS2-TSC-Charter.html)
    * [ ROS 2 TSC applicant intake process ](../Governance/ROS2-TSC-Intake-process.html)
    * [ How to Start a Community Working Group ](../Governance/How-To-Start-A-Community-Working-Group.html)
  * [ Marketing Materials ](../Marketing.html)
  * [ Related Projects ](../Related-Projects.html)
    * [ Intel ROS 2 Projects ](../Related-Projects/Intel-ROS2-Projects.html)
    * [ NVIDIA ROS 2 Projects ](../Related-Projects/Nvidia-ROS2-Projects.html)
  * [ Glossary ](../Glossary.html)


**[ crystaldust ](/crystaldust) ** commented  Jun 18, 2020  •


    * [ Recording a bag from your own node (C++) ](Ros2bag/Recording-A-Bag-From-Your-Own-Node-Cpp.html)
    * [ Recording a bag from your own node (Python) ](Ros2bag/Recording-A-Bag-From-Your-Own-Node-Python.html)
    * [ ROS2 on IBM Cloud Kubernetes [community-contributed] ](Deploying-ROS-2-on-IBM-Cloud.html)
    * [ Eclipse Oxygen with ROS 2 and rviz2 [community-contributed] ](Eclipse-Oxygen-with-ROS-2-and-rviz2.html)
    * [ Building realtime Linux for ROS 2 [community-contributed] ](Building-Realtime-rt_preempt-kernel-for-ROS-2.html)
    * [ Building ROS 2 Package with eclipse 2021-06 ](Building-ROS2-Package-with-eclipse-2021-06.html)
    * [ Use quality-of-service settings to handle lossy networks ](Quality-of-Service.html)
    * [ Management of nodes with managed lifecycles ](Managed-Nodes.html)
    * [ Efficient intra-process communication ](Intra-Process-Communication.html)
    * [ Recording and playback of topic data with rosbag using the ROS 1 bridge ](Rosbag-with-ROS1-Bridge.html)
    * [ Real-time programming in ROS 2 ](Real-Time-Programming.html)
    * [ Trying the dummy robot demo ](dummy-robot-demo.html)
    * [ Logging and logger configuration demo ](Logging-and-logger-configuration.html)
  * [ How-to Guides ](../How-To-Guides.html)
    * [ Installation troubleshooting ](../How-To-Guides/Installation-Troubleshooting.html)
    * [ Developing a ROS 2 package ](../How-To-Guides/Developing-a-ROS-2-Package.html)
    * [ ament_cmake user documentation ](../How-To-Guides/Ament-CMake-Documentation.html)
    * [ ament_cmake_python user documentation ](../How-To-Guides/Ament-CMake-Python-Documentation.html)
    * [ 将启动文件从 ROS 1 迁移到 ROS 2 ](../How-To-Guides/Launch-files-migration-guide.html)
    * [ Using Python, XML, and YAML for ROS 2 Launch Files ](../How-To-Guides/Launch-file-different-formats.html)
    * [ Migrating YAML parameter files from ROS 1 to ROS 2 ](../How-To-Guides/Parameters-YAML-files-migration-guide.html)
    * [ Passing ROS arguments to nodes via the command-line ](../How-To-Guides/Node-arguments.html)
    * [ Synchronous vs. asynchronous service clients ](../How-To-Guides/Sync-Vs-Async.html)
    * [ DDS tuning information ](../How-To-Guides/DDS-tuning.html)
    * [ rosbag2: Overriding QoS Policies ](../How-To-Guides/Overriding-QoS-Policies-For-Recording-And-Playback.html)
    * [ Working with multiple ROS 2 middleware implementations ](../How-To-Guides/Working-with-multiple-RMW-implementations.html)
    * [ Cross-compilation ](../How-To-Guides/Cross-compilation.html)
    * [ Releasing a ROS 2 package with bloom ](../How-To-Guides/Releasing-a-ROS-2-package-with-bloom.html)
    * [ Using Python Packages with ROS 2 ](../How-To-Guides/Using-Python-Packages.html)
    * [ Porting RQt plugins to Windows ](../How-To-Guides/RQt-Port-Plugin-Windows.html)
    * [ Running ROS 2 nodes in Docker [community-contributed] ](../How-To-Guides/Run-2-nodes-in-single-or-separate-docker-containers.html)
    * [ ROS 2 Package Maintainer Guide ](../How-To-Guides/Package-maintainer-guide.html)
    * [ Building a custom Debian package ](../How-To-Guides/Building-a-Custom-Debian-Package.html)
    * [ Topics vs Services vs Actions ](../How-To-Guides/Topics-Services-Actions.html)
    * [ Using variants ](../How-To-Guides/Using-Variants.html)
    * [ Building RQt from source ](../How-To-Guides/RQt-Source-Install.html)
      * [ Building RQt from source on macOS ](../How-To-Guides/RQt-Source-Install-MacOS.html)
      * [ Building RQt from source on Windows 10 ](../How-To-Guides/RQt-Source-Install-Windows10.html)
  * [ Concepts ](../Concepts.html)
    * [ The ROS_DOMAIN_ID ](../Concepts/About-Domain-ID.html)


> For the Python client lib ` rclpy ` , classes can be compiled to / loaded
> from a .so file with Cython, or just python source code files with
> importlib. We need some discussion on this, the former encapsulate the code
> but import complexity, the latter looks more 'Pythonic' but the node
> classes' source code is accessible.


Other Versions  v: xin


* [ Product Updates  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/product%20updates)


$ ros2 component load /ns/MyContainer composition composition::Listener


By clicking “Sign up for GitHub”, you agree to our [ terms of service
](https://docs.github.com/terms) and [ privacy statement
](https://docs.github.com/privacy) . We’ll occasionally send you account
related emails.


* Run-time composition using dlopen


[ ![@clalancette](https://avatars.githubusercontent.com/u/163000?s=40&v=4)
](/clalancette) [ clalancette ](/clalancette) assigned [ sloretz  ](/sloretz)
Feb 3, 2022


Name


I tried to make a basic implementation with entry point, it's a brilliant
idea.


Query


####  Feature description


[ ![@dirk-
thomas](https://avatars.githubusercontent.com/u/1335366?s=80&u=ec35ea6bae7c6e04a5df7482044bbc7681968435&v=4)
](/dirk-thomas)


Copy link


If we can't use external modules inside the setup.py for now, is there some
recommended way to register tye python component? The colcon seems only
support some environment script hooks, which might not be the proper place to
do it. I also considered a CMakeList file, but the build type of a ros2
package can only be ONE of ` cmake ` , ` ament_cmake ` and ` ament_python ` .

---

All reactions


    <prefix>
        `-- share
            `-- ament_index
                `-- resource_index
                    `-- packages
                        `-- my_composition # empty file
                    `-- rclpy_components
                        `-- my_composition # with content to refer the python classes


> is there some recommended way to register tye python component?


    # Terminal 2
    # Load Camera Component
    ros2 component load /ComponentManager img_pipeline_composition img_pipeline_composition::CameraComponent


Top kudoed authors


Member


**[ crystaldust ](/crystaldust) ** commented  Jun 20, 2020


**Y** **ou must be using a current update of Composable Storefront because of
the following important note:**


[ ![](https://community.sap.com/html/assets/img_tile-default.png) ](/t5/crm-
and-cx-blogs-by-sap/tips-and-tricks-troubleshooting-crm-interaction-
center/ba-p/12968908 "View article")


    # List the components that are registered with the component manager
    ros2 component list

    # You should see /ComponentManager loaded.


As a reminder, according to the [ SAP Commerce Cloud Supplemental Terms and
Conditions ](https://www.sap.com/about/trust-center/agreements/cloud/cloud-
services.html?sort=latest_desc&search=commerce%20cloud) , you must run a
version of SAP Commerce Cloud that is current. Your organization is
responsible for installing new releases and upgrading the SAP Commerce Cloud
software.


Fine print

---|---|---

Discovery, transport and serialization over DDS
|
[ Article ](https://design.ros2.org/articles/ros_on_dds.html)
|

Support for [ multiple DDS implementations  ](../Concepts/Intermediate/About-
Different-Middleware-Vendors.html) , chosen at runtime
|
[ Concept  ](../Concepts/Intermediate/About-Different-Middleware-Vendors.html)
, [ How-to Guide  ](../How-To-Guides/Working-with-multiple-RMW-
implementations.html)
|
Currently Eclipse Cyclone DDS, eProsima Fast DDS, and RTI Connext DDS are
fully supported.

Common core client library that is wrapped by language-specific libraries
|
[ Details  ](../Concepts/Basic/About-Client-Libraries.html)
|

Publish/subscribe over topics
|
[ Sample code ](https://github.com/ros2/examples) , [ Article
](https://design.ros2.org/articles/topic_and_service_names.html)
|

Clients and services
|
[ Sample code ](https://github.com/ros2/examples)
|

Set/retrieve parameters
|
[ Sample code
](https://github.com/ros2/demos/tree/0.5.1/demo_nodes_cpp/src/parameters)
|


|  2

[ ![christian-
hissl](https://avatars.profile.sap.com/c/9/idc9995a3c5f839a2b1ec496df6d2ec1018d7ca60e3925a2bf98957b63f2ae1383_small.jpeg)
![Associate](/html/@C6690A74F301515E6881523D52BDF6AA/rank_icons/sap-logo-
small-14px.png) christian-hissl  ](/t5/user/viewprofilepage/user-id/155911)


###  Compile-time composition using ROS services  


But according to the setupscript docs [ installing additional files
](https://docs.python.org/3/distutils/setupscript.html#installing-additional-
files) , setup.py asks to specify ( **directory** , installed_files) in `
data_files ` parameters, this would make maintaining the files more complex.
Developers will have to store the two my_composition files in different local
paths, well, maybe we are asking too much for the developers to do.


Robots (AI generated Image)


The container could also offer a service to provide a list of supported
component types. That way the CLI can offer to only complete matching ones and
already error out before calling the container.

---

All reactions


About


####  Implementation considerations


Open


` ros2 component load ` command to load a component from `
img_pipeline_composition ` package with a type of `
img_pipeline_composition::CameraComponent ` into the ROS 2 component manager.


  * [ Code  ](/ros2/rclpy)
  * [ Issues  99  ](/ros2/rclpy/issues)
  * [ Pull requests  33  ](/ros2/rclpy/pulls)
  * [ Actions  ](/ros2/rclpy/actions)
  * [ Security  ](/ros2/rclpy/security)
  * [ Insights  ](/ros2/rclpy/pulse)


Sorry, something went wrong.


> This macro file is essential to completing the composition. When you create
> your own package replace IMAGE_PIPELINE_COMPOSITION with your package_name.

    //camera_component.hpp
    #ifndef IMAGE_PIPELINE_COMPOSITION__CAMERA_NODE_HPP_
    #define IMAGE_PIPELINE_COMPOSITION__CAMERA_NODE_HPP_

    // C++ Header files
    #include <chrono>
    #include <sstream>
    #include <string>
    #include <thread>
    #include <utility>
    #include <memory>

    // Import the ROS and OpenCV headers
    #include "img_pipeline_composition/visibility_control.h"
    #include "rclcpp/rclcpp.hpp"
    #include "sensor_msgs/msg/image.hpp"
    #include "opencv2/highgui/highgui.hpp"

    namespace img_pipeline_composition
    {
        // We create a CameraComponent class that inherits from the rclcpp::Node
        // Note: Components get built into shared libraries and as
        // such do not write their own main functions.
        class CameraComponent final : public rclcpp::Node
        {
            public:
                IMAGE_PIPELINE_COMPOSITION_PUBLIC
                explicit CameraComponent(const rclcpp::NodeOptions & options)
                : Node("camera", options)
                {
                    std::string topic_name = "camera/image";
                    // Open A camera Node - replace with video file if you don't have
                    // Camera connected
                    cap_.open(0);

                    // Create a Publisher with sensor_msgs message type and queue size is 10


利用 [ Sphinx ](https://www.sphinx-doc.org/) 构建，使用了 [ 主题
](https://github.com/readthedocs/sphinx_rtd_theme) 由 [ Read the Docs
](https://readthedocs.org) 开发.


    * [ Enterprise ](/enterprise)
    * [ Teams ](/team)
    * [ Startups ](/enterprise/startups)
    * [ Education  ](https://education.github.com)


Contributor  Author


    $ ros2 component load /ComponentManager composition composition::Server
    $ ros2 component load /ComponentManager composition composition::Client


* [ Node.js  Programming Tool  ](/t5/c-khhcw49343/Node.js/pd-p/723714486627645412834578565527550)


                    publisher_ = this->create_publisher<sensor_msgs::msg::Image>(topic_name, 10);
                    thread_ = std::thread(std::bind(&CameraComponent::callback, this));
                }

                ~CameraComponent()
                {
                    // Make sure to join the thread on shutdown.
                    if (thread_.joinable()) {
                    thread_.join();
                    }
                }

                void callback();
                std::string mat_type2encoding(int mat_type);

            private:
                cv::VideoCapture cap_;
                cv::Mat frame_;
                std::thread thread_;
                rclcpp::Publisher<sensor_msgs::msg::Image>::SharedPtr publisher_;
        };
    } // namespace img_pipeline_composition
    #endif  // IMAGE_PIPELINE_COMPOSITION__CAMERA_NODE_HPP_

    // camera_component.cpp
    #include "img_pipeline_composition/camera_component.hpp"

    namespace img_pipeline_composition
    {
        // Get cv::Mat encoding
        std::string
        CameraComponent::mat_type2encoding(int mat_type)
        {
            switch (mat_type) {
                case CV_8UC1:
                return "mono8";
                case CV_8UC3:
                return "bgr8";
                case CV_16SC1:


© 版权所有 2021, Open Robotics.


* [ Pricing ](/pricing)


      * [ Beta 2 ( ` r2b2  ` ) ](../Releases/Beta2-Overview.html)
      * [ Beta 1 ( ` Asphalt  ` ) ](../Releases/Beta1-Overview.html)
      * [ Alphas ](../Releases/Alpha-Overview.html)
    * [ Development process for a release ](../Releases/Release-Process.html)
  * [ Tutorials ](../Tutorials.html)
    * [ Beginner: CLI tools ](../Tutorials/Beginner-CLI-Tools.html)
      * [ Configuring environment ](../Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html)
      * [ Using ` turtlesim  ` , ` ros2  ` , and ` rqt  ` ](../Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html)
      * [ Understanding nodes ](../Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Nodes/Understanding-ROS2-Nodes.html)
      * [ Understanding topics ](../Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.html)
      * [ Understanding services ](../Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Services/Understanding-ROS2-Services.html)
      * [ Understanding parameters ](../Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Parameters/Understanding-ROS2-Parameters.html)
      * [ Understanding actions ](../Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Actions/Understanding-ROS2-Actions.html)
      * [ Using ` rqt_console  ` to view logs ](../Tutorials/Beginner-CLI-Tools/Using-Rqt-Console/Using-Rqt-Console.html)
      * [ Launching nodes ](../Tutorials/Beginner-CLI-Tools/Launching-Multiple-Nodes/Launching-Multiple-Nodes.html)
      * [ Recording and playing back data ](../Tutorials/Beginner-CLI-Tools/Recording-And-Playing-Back-Data/Recording-And-Playing-Back-Data.html)
    * [ Beginner: Client libraries ](../Tutorials/Beginner-Client-Libraries.html)
      * [ Using ` colcon  ` to build packages ](../Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html)
      * [ Creating a workspace ](../Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html)
      * [ Creating a package ](../Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html)
      * [ Writing a simple publisher and subscriber (C++) ](../Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html)
      * [ Writing a simple publisher and subscriber (Python) ](../Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.html)
      * [ Writing a simple service and client (C++) ](../Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Service-And-Client.html)
      * [ Writing a simple service and client (Python) ](../Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Service-And-Client.html)
      * [ Creating custom msg and srv files ](../Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.html)
      * [ Implementing custom interfaces ](../Tutorials/Beginner-Client-Libraries/Single-Package-Define-And-Use-Interface.html)
      * [ Using parameters in a class (C++) ](../Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-CPP.html)
      * [ Using parameters in a class (Python) ](../Tutorials/Beginner-Client-Libraries/Using-Parameters-In-A-Class-Python.html)
      * [ Using ` ros2doctor  ` to identify issues ](../Tutorials/Beginner-Client-Libraries/Getting-Started-With-Ros2doctor.html)
      * [ Creating and using plugins (C++) ](../Tutorials/Beginner-Client-Libraries/Pluginlib.html)
    * [ Intermediate ](../Tutorials/Intermediate.html)
      * [ Managing Dependencies with rosdep ](../Tutorials/Intermediate/Rosdep.html)
      * [ Creating an action ](../Tutorials/Intermediate/Creating-an-Action.html)
      * [ Writing an action server and client (C++) ](../Tutorials/Intermediate/Writing-an-Action-Server-Client/Cpp.html)
      * [ Writing an action server and client (Python) ](../Tutorials/Intermediate/Writing-an-Action-Server-Client/Py.html)
      * [ Writing a Composable Node (C++) ](../Tutorials/Intermediate/Writing-a-Composable-Node.html)
      * [ Composing multiple nodes in a single process ](../Tutorials/Intermediate/Composition.html)
      * [ Monitoring for parameter changes (C++) ](../Tutorials/Intermediate/Monitoring-For-Parameter-Changes-CPP.html)
      * [ Monitoring for parameter changes (Python) ](../Tutorials/Intermediate/Monitoring-For-Parameter-Changes-Python.html)
      * [ Launch ](../Tutorials/Intermediate/Launch/Launch-Main.html)


[ Composition API  #599  ](/ros2/rclpy/pull/599)


###  Run-time composition using ROS services with a publisher and subscriber



##  [ Staying current with Commerce Cloud and Composable Storefront ](/t5/crm-
and-cx-blogs-by-sap/staying-current-with-commerce-cloud-and-composable-
storefront/ba-p/13560202)


      * [ ROS Build Farms ](Contributing/Build-Farms.html)
      * [ Windows Tips and Tricks ](Contributing/Windows-Tips-and-Tricks.html)
      * [ Contributing to ROS 2 Documentation ](Contributing/Contributing-To-ROS-2-Documentation.html)
    * Features Status
    * [ Feature Ideas ](Feature-Ideas.html)
    * [ Roadmap ](Roadmap.html)
    * [ ROSCon Talks ](ROSCon-Content.html)
    * [ Project Governance ](Governance.html)
      * [ ROS 2 Technical Steering Committee Charter ](Governance/ROS2-TSC-Charter.html)
      * [ ROS 2 TSC applicant intake process ](Governance/ROS2-TSC-Intake-process.html)
      * [ About Working Groups ](Governance/Working-Groups.html)
      * [ How to Start a Community Working Group ](Governance/How-To-Start-A-Community-Working-Group.html)
    * [ Marketing ](Marketing.html)
    * [ Metrics ](Metrics.html)
  * [ Package Docs ](../Package-Docs.html)
  * [ Related Projects ](../Related-Projects.html)
    * [ Intel ROS 2 Projects ](../Related-Projects/Intel-ROS2-Projects.html)
    * [ NVIDIA ROS 2 Projects ](../Related-Projects/Nvidia-ROS2-Projects.html)
  * [ Glossary ](../Glossary.html)
  * [ Citations ](../Citations.html)
__ [ ROS 2 Documentation: Rolling ](../index.html)
  * [ ](../index.html)
  * [ The ROS 2 Project ](../The-ROS2-Project.html)
  * Features Status
  * [ Edit on GitHub ](https://github.com/ros2/ros2_documentation/blob/rolling/source/The-ROS2-Project/Features.rst)
* * *
**You're reading the documentation for a development version. For the latest
released version, please have a look at[ Iron ](../../iron/The-
ROS2-Project/Features.html) . **
#  Features Status  ï
The features listed below are available in the current ROS 2 release. Unless
otherwise specified, the features are available for all supported platforms
(Ubuntu 24.04 (Noble), Windows 10), DDS implementations (eProsima Fast DDS,
RTI Connext DDS, and Eclipse Cyclone DDS) and programming language client
libraries (C++ and Python). For planned future development, see the [ Roadmap
](Roadmap.html) .
Functionality
|
Link
|


* Move the ` rclcpp_components ` resource type to ` ros(2)_components ` to make it language irrelevant.


Member


> the python version just need to make some command override in the ` setup.py
> ` file


[ Ros2  ](/tag/ros2?source=post_page-----209ed023d8e5---------------
ros2-----------------)


* For the Python client lib ` rclpy ` , classes can be compiled to / loaded from a .so file with Cython, or just python source code files with importlib. We need some discussion on this, the former encapsulate the code but import complexity, the latter looks more 'Pythonic' but the node classes' source code is accessible.


##  Comments


Let’s start with composition at compile time.


So developers would do this:


Which will also call ament index APIs. So adding an extra Python Entry Point
loading requires a greater change for the whole cli architecture.


     [ Galactic (latest) ](../../galactic/Tutorials/Composition.html)
     [ Foxy ](../../foxy/Tutorials/Composition.html)
     [ Eloquent (EOL) ](../../eloquent/Tutorials/Composition.html)
     [ Dashing ](../../dashing/Tutorials/Composition.html)
     [ Crystal (EOL) ](../../crystal/Tutorials/Composition.html)


Toggle navigation


You can use the ament resource index if you want to (or you could just use the
entry points to look up available components). Using the index is the more
generic / language independent approach - entry points are Python-specific.


Talks about #robotics, #computervision, and #embeddedsystems


* [ The ReadME Project  GitHub community articles  ](/readme)


This demo presents an alternative to run-time composition by creating a
generic container process and explicitly passing the libraries to load without
using ROS interfaces. The process will open each library and create one
instance of each “rclcpp::Node” class in the library [ source code
](https://github.com/ros2/demos/blob/master/composition/src/dlopen_composition.cpp)
).


Node VS Nodelet


[ Turn on suggestions
](https://community.sap.com/t5/blogs/v2/blogarticlepage.enableautocomplete:enableautocomplete?t:ac=blog-
id/crm-blog-sap/article-id/13107&t:cp=action/contributions/searchactions)


* [ Digital Technologies  Additional Software Product  ](/t5/c-khhcw49343/Digital+Technologies/pd-p/33d804ef-26b2-4f01-b858-ddef6871cb3b)


[ AI  ](/tag/ai?source=post_page-----209ed023d8e5---------------
ai-----------------)


**component**
The rclcpp now uses a macro ` RCLCPP_COMPONENTS_REGISTER_NODE ` to regsiter
node as Component, it registers node with class_loader, something like
entrypoint. According to the design docs, Python's entry points should be able
to do this.

---

All reactions


For now, a container written in a specific language could only support
components written in the same language(I guess there are tricks to make some
lower-level language able to load code in other languages, but it might make
things too complex), so a python container would always say "Hi, I support
['rclpy_component']".

---

All reactions


  * **48574** Views
  * **31** comments
  * **68** kudos


Development


[ ](/?source=---two_column_layout_nav----------------------------------)


](https://blog.medium.com/?source=post_page-----
209ed023d8e5--------------------------------)


You can’t perform that action at this time.


[ ![](https://community.sap.com/html/assets/img_tile-default.png) ](/t5/crm-
and-cx-blogs-by-sap/sap-cloud-for-customer-integration-with-erp-and-crm-how-
to-guides-and-e/ba-p/13059640 "View article")


  * [ 安装 ](../Installation.html)
    * [ 在 Ubuntu Linux 上构建 ROS 2 ](../Installation/Ubuntu-Development-Setup.html)
    * [ Installing ROS 2 on Ubuntu Linux ](../Installation/Ubuntu-Install-Binary.html)
    * [ 通过 Debian 软件包安装 ROS 2 ](../Installation/Ubuntu-Install-Debians.html)
    * [ Building ROS 2 on macOS ](../Installation/macOS-Development-Setup.html)
    * [ 在 Windows 上构建 ROS 2 ](../Installation/Windows-Development-Setup.html)
    * [ 在 Windows 上安装ROS 2 ](../Installation/Windows-Install-Binary.html)
    * [ Building ROS 2 on RHEL ](../Installation/RHEL-Development-Setup.html)
    * [ Installing ROS 2 on RHEL ](../Installation/RHEL-Install-Binary.html)
    * [ Installing ROS 2 via RPM Packages ](../Installation/RHEL-Install-RPMs.html)
    * [ Building ROS 2 on Fedora Linux ](../Installation/Fedora-Development-Setup.html)
    * [ 安装最新的 ROS 2 开发版 ](../Installation/Latest-Development-Setup.html)
    * [ Maintaining a source checkout of ROS 2 Xin ](../Installation/Maintaining-a-Source-Checkout.html)
    * [ 用于测试的替代安装源 ](../Installation/Testing.html)
    * [ Installing DDS implementations ](../Installation/DDS-Implementations.html)
      * [ Installing Connext security plugins ](../Installation/DDS-Implementations/Install-Connext-Security-Plugins.html)
      * [ Installing University or Evaluation versions of RTI Connext DDS ](../Installation/DDS-Implementations/Install-Connext-University-Eval.html)
      * [ Working with Eclipse Cyclone DDS ](../Installation/DDS-Implementations/Working-with-Eclipse-CycloneDDS.html)
      * [ Working with eProsima Fast DDS ](../Installation/DDS-Implementations/Working-with-eProsima-Fast-DDS.html)
  * [ 文档指南 ](../Docs-Guide.html)
  * [ 教程 ](../Tutorials.html)
    * [ 配置 ROS 2 环境 ](Configuring-ROS2-Environment.html)
    * [ 介绍 turtlesim 和 rqt ](Turtlesim/Introducing-Turtlesim.html)
    * [ 理解 ROS2 节点 ](Understanding-ROS2-Nodes.html)
    * [ 理解 ROS 2 主题 ](Topics/Understanding-ROS2-Topics.html)
    * [ 理解 ROS2 服务 ](Services/Understanding-ROS2-Services.html)
    * [ 理解 ROS2 参数 ](Parameters/Understanding-ROS2-Parameters.html)
    * [ 理解 ROS 2 的行为 ](Understanding-ROS2-Actions.html)
    * [ 使用 rqt_console ](Rqt-Console/Using-Rqt-Console.html)
    * [ 创建 launch 文件 ](Launch-Files/Creating-Launch-Files.html)
    * [ 记录和回放数据 ](Ros2bag/Recording-And-Playing-Back-Data.html)
    * [ 创建工作区 ](Workspace/Creating-A-Workspace.html)
    * [ 创建你的第一个 ROS 2 包 ](Creating-Your-First-ROS2-Package.html)
    * [ 编写一个简单的发布者和订阅者（C++） ](Writing-A-Simple-Cpp-Publisher-And-Subscriber.html)
    * [ Writing a simple publisher and subscriber (Python) ](Writing-A-Simple-Py-Publisher-And-Subscriber.html)
    * [ Writing a simple service and client (C++) ](Writing-A-Simple-Cpp-Service-And-Client.html)
    * [ Writing a simple service and client (Python) ](Writing-A-Simple-Py-Service-And-Client.html)
    * [ Creating custom ROS 2 msg and srv files ](Custom-ROS2-Interfaces.html)
    * [ Expanding on ROS 2 interfaces ](Single-Package-Define-And-Use-Interface.html)
    * [ Using parameters in a class (C++) ](Using-Parameters-In-A-Class-CPP.html)


Resources


[ ![@sloretz](https://avatars.githubusercontent.com/u/4175662?s=40&v=4)
](/sloretz) [ sloretz  ](/sloretz)


    $ ros2 component list
    /ComponentManager


There are trade-offs to consider when deciding between compile-time and
runtime composition. Compile-time composition can offer better performance and
easier debugging, since the composite object is fully defined and can be
optimized at compile time. On the other hand, runtime composition allows for
more flexibility and adaptability, since the composite object can be created
and modified dynamically at runtime.


> In ros2cli component verb, we just need to add a different logic to search
> Python components, which is different from searching C++ components.


    * [ Actions  Automate any workflow  ](/features/actions)
    * [ Packages  Host and manage packages  ](/features/packages)
    * [ Security  Find and fix vulnerabilities  ](/features/security)
    * [ Codespaces  Instant dev environments  ](/features/codespaces)
    * [ Copilot  Write better code with AI  ](/features/copilot)
    * [ Code review  Manage code changes  ](/features/code-review)
    * [ Issues  Plan and track work  ](/features/issues)
    * [ Discussions  Collaborate outside of code  ](/features/discussions)


[ enhancement  ](/ros2/rclpy/labels/enhancement) New feature or request


If you want to export a composable node as a shared library from a package and
use that node in another package that does link-time composition, add code to
the CMake file which imports the actual targets in downstream packages.


The SAP Commerce Cloud Team


  * The container itself is a node
  * The container binds an executor(single/multi threaded)
  * The container provides 3 services: ` ~/_container/list_nodes ` , ` ~/_container/load_node ` , ` ~/_container/unload_node `
  * The list node service should return the name and id of the nodes which are registered as Component, ~~the rclpy can refer to the ros2cli component verb's implementation(won't work, since the verb's list command just call the service)~~
  * The load/unload node service call the executor's add_node/remove_node method


Linux  macOS  Windows


Contributor  Author


[ Sign in
](/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40nullbyte.in%2Fros2-from-
the-ground-up-part-4-building-robust-robotics-systems-with-
ros2-composition-209ed023d8e5&source=post_page---two_column_layout_nav
-----------------------global_nav-----------)


**[ crystaldust ](/crystaldust) ** commented  Jun 17, 2020  •


Copy link


Popular Blog Posts


    cd ~/ros2_ws/
    colcon build --packages-select img_pipeline_composition #Compile
    source install/setup.zsh


` visibility_control.h ` is a header file that is used to control the
visibility of symbols in shared libraries. It is typically used in components,
which are implemented as shared libraries that are loaded at runtime by the
component manager.


To sum up, ROS2 composition is an important tool for creating reliable
robotics systems. The use of ROS2 composition can be more difficult than
utilising nodes, which is a slight downside. This is due to the fact that
compositions require several nodes to operate as a single process, which can
require more careful design and planning to ensure that all the components are
properly integrated and function as intended.


There are several ways to mitigate this risk in ROS2. One approach is to _use
error handling_ and _recovery mechanisms_ within the components themselves to
try to prevent or recover from failures. For example, you can use try-catch
blocks to handle exceptions, or you can use watchdog timers to periodically
check the status of a component and restart it if necessary.


[ ![@dirk-
thomas](https://avatars.githubusercontent.com/u/1335366?s=80&u=ec35ea6bae7c6e04a5df7482044bbc7681968435&v=4)
](/dirk-thomas)


So a few things should be considered:


[ Jegathesan Shanmugam ](/@nullbyte.in?source=post_page-----
209ed023d8e5--------------------------------)


[ ![@dirk-
thomas](https://avatars.githubusercontent.com/u/1335366?s=40&u=ec35ea6bae7c6e04a5df7482044bbc7681968435&v=4)
](/dirk-thomas) [ dirk-thomas ](/dirk-thomas) added the [ enhancement
](/ros2/rclpy/labels/enhancement) New feature or request  label  Jun 16, 2020


    * [ Installation troubleshooting ](../How-To-Guides/Installation-Troubleshooting.html)
    * [ Developing a ROS 2 package ](../How-To-Guides/Developing-a-ROS-2-Package.html)
    * [ Documenting a ROS 2 package ](../How-To-Guides/Documenting-a-ROS-2-Package.html)
    * [ ament_cmake user documentation ](../How-To-Guides/Ament-CMake-Documentation.html)
    * [ ament_cmake_python user documentation ](../How-To-Guides/Ament-CMake-Python-Documentation.html)
    * [ Migrating from ROS 1 to ROS 2 ](../How-To-Guides/Migrating-from-ROS1.html)
      * [ Migrating Packages ](../How-To-Guides/Migrating-from-ROS1/Migrating-Packages.html)
      * [ Migrating Interfaces ](../How-To-Guides/Migrating-from-ROS1/Migrating-Interfaces.html)
      * [ Migrating C++ Packages ](../How-To-Guides/Migrating-from-ROS1/Migrating-CPP-Packages.html)
      * [ Migrating Python Packages ](../How-To-Guides/Migrating-from-ROS1/Migrating-Python-Packages.html)
      * [ Migrating Launch Files ](../How-To-Guides/Migrating-from-ROS1/Migrating-Launch-Files.html)
      * [ Migrating Parameters ](../How-To-Guides/Migrating-from-ROS1/Migrating-Parameters.html)
      * [ Migrating Scripts ](../How-To-Guides/Migrating-from-ROS1/Migrating-Scripts.html)
    * [ Using Python, XML, and YAML for ROS 2 Launch Files ](../How-To-Guides/Launch-file-different-formats.html)
    * [ Using ROS 2 launch to launch composable nodes ](../How-To-Guides/Launching-composable-nodes.html)
    * [ Passing ROS arguments to nodes via the command-line ](../How-To-Guides/Node-arguments.html)
    * [ Synchronous vs. asynchronous service clients ](../How-To-Guides/Sync-Vs-Async.html)
    * [ DDS tuning information ](../How-To-Guides/DDS-tuning.html)
    * [ rosbag2: Overriding QoS Policies ](../How-To-Guides/Overriding-QoS-Policies-For-Recording-And-Playback.html)
    * [ Working with multiple ROS 2 middleware implementations ](../How-To-Guides/Working-with-multiple-RMW-implementations.html)
    * [ Cross-compilation ](../How-To-Guides/Cross-compilation.html)
    * [ Releasing a Package ](../How-To-Guides/Releasing/Releasing-a-Package.html)
      * [ First Time Release ](../How-To-Guides/Releasing/First-Time-Release.html)
      * [ Subsequent Releases ](../How-To-Guides/Releasing/Subsequent-Releases.html)
      * [ Release Team / Repository ](../How-To-Guides/Releasing/Release-Team-Repository.html)
      * [ Release Track ](../How-To-Guides/Releasing/Release-Track.html)
    * [ Using Python Packages with ROS 2 ](../How-To-Guides/Using-Python-Packages.html)
    * [ Porting RQt plugins to Windows ](../How-To-Guides/RQt-Port-Plugin-Windows.html)
    * [ Running ROS 2 nodes in Docker [community-contributed] ](../How-To-Guides/Run-2-nodes-in-single-or-separate-docker-containers.html)
    * [ Visualizing ROS 2 data with Foxglove Studio ](../How-To-Guides/Visualizing-ROS-2-Data-With-Foxglove-Studio.html)
    * [ ROS 2 Package Maintainer Guide ](../How-To-Guides/Package-maintainer-guide.html)
    * [ Building a custom Debian package ](../How-To-Guides/Building-a-Custom-Debian-Package.html)
    * [ Building ROS 2 with tracing ](../How-To-Guides/Building-ROS-2-with-Tracing.html)
    * [ Topics vs Services vs Actions ](../How-To-Guides/Topics-Services-Actions.html)
    * [ Using variants ](../How-To-Guides/Using-Variants.html)
    * [ Using the ` ros2  param  ` command-line tool ](../How-To-Guides/Using-ros2-param.html)
    * [ Using ` ros1_bridge  ` with upstream ROS on Ubuntu 22.04 ](../How-To-Guides/Using-ros1_bridge-Jammy-upstream.html)
    * [ Configure Zero Copy Loaned Messages ](../How-To-Guides/Configure-ZeroCopy-loaned-messages.html)
    * [ ROS 2 on Raspberry Pi ](../How-To-Guides/Installing-on-Raspberry-Pi.html)
    * [ Using Callback Groups ](../How-To-Guides/Using-callback-groups.html)


In the first shell, verify that the repeated messages from talker and listener
have stopped.


ros2 launch img_pipeline_composition image_pipeline_launch.py


For better understanding, I’ll start loading the components without a launch
file.


###  Run-time composition using dlopen  


[ Sign up for free ](/join?source=comment-repo) **to join this conversation on
GitHub** . Already have an account? [ Sign in to comment
](/login?return_to=https%3A%2F%2Fgithub.com%2Fros2%2Frclpy%2Fissues%2F575)


Now the first shell should show a message that the component was loaded as
well as repeated message for publishing a message.


Text to speech


* Run-time composition using ROS services with a server and client


* Product


* Unloading components


#  rclpy composition API  #575


The Python documentation, setuptools and the mentioned PEP should provide the
necessary context.


Sorry, something went wrong.


[ Search syntax tips ](https://docs.github.com/search-github/github-code-
search/understanding-github-code-search-syntax)


**[ crystaldust ](/crystaldust) ** commented  Jun 24, 2020  •


Making the extension types and loaders entry points is a good idea! I'll
restructure the code and make a PR to comment on.

---

👍  1  dirk-thomas reacted with thumbs up emoji


* [ Manifest components reference ](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/1be46286b36a4aa48205be5a96240672/3d562b85b37a460a92d32ec991459133.html?locale=en-US&state=PRODUCTION&version=v2205)


dlopen-composed components will not be reflected in the ` ros2  component
list  ` command line tool output.


**[ dirk-thomas ](/dirk-thomas) ** commented  Jun 30, 2020


The corresponding entries appear in ` ros2  component  list  ` :


In this blog, we essentially cover the following key elements:


Copy link


|  1

[
![Edmar_Rodriguez](https://avatars.profile.sap.com/0/e/id0e1df70d041b4b3a8df825814687902b88595fe26337a0c9a2c362ef006d8ca0_small.jpeg)
![Product and Topic
Expert](/html/@C6690A74F301515E6881523D52BDF6AA/rank_icons/sap-logo-
small-14px.png) Edmar_Rodriguez  ](/t5/user/viewprofilepage/user-id/52467)


All reactions


> ros2 run composition dlopen_composition <path_to_composition_install>\bin\talker_component.dll <path_to_composition_install>\bin\listener_component.dll


In Development


We can definitely make the customized develop command with a wrapper which is
provided in ` rclpy.component ` module. The helper ` rclpy_register_component
` will call ` ament_index_python ` 's functions to store the entry_points in
the path `
{PROJECT_FOLDER}/install/my_robot_app/ament_index/resource_index/rclpy_components/composition
` , when the python container load node, the project's setup.bash should first
be sourced or the container won't find the components. When the container got
the content 'my_robot_app.components:Talker', it will load the module `
my_robot_app.components ` and read the class from it, create an instance, and
run it with executor.add_node.


|
[ Demo  ](../Tutorials/Demos/Content-Filtering-Subscription.html)
|
Currently only in C++.

Service Introspection
|
[ Demo  ](../Tutorials/Demos/Service-Introspection.html)
|

Besides core features of the platform, the biggest impact of ROS comes from
its available packages. The following are a few high-profile packages which
are available in the latest release:
  * [ gazebo_ros_pkgs ](https://index.ros.org/r/gazebo_ros_pkgs/)
  * [ image_transport ](https://index.ros.org/r/image_common)
  * [ navigation2 ](https://index.ros.org/r/navigation2/)
  * [ rosbag2 ](https://index.ros.org/r/rosbag2/)
  * [ RQt ](https://index.ros.org/r/rqt/)
  * [ RViz2 ](https://index.ros.org/r/rviz/)
[ Previous ](Contributing/Contributing-To-ROS-2-Documentation.html
"Contributing to ROS 2 Documentation") [ Next  ](Feature-Ideas.html "Feature
Ideas")
* * *
© Copyright 2024, Open Robotics.
Built with [ Sphinx ](https://www.sphinx-doc.org/) using a [ theme
](https://github.com/readthedocs/sphinx_rtd_theme) provided by [ Read the Docs
](https://readthedocs.org) .
Other Versions  v: rolling
Releases
     [ Iron (latest) ](../../iron/The-ROS2-Project/Features.html)
     [ Humble ](../../humble/The-ROS2-Project/Features.html)
     [ Galactic (EOL) ](../../galactic/The-ROS2-Project/Features.html)
     [ Foxy (EOL) ](../../foxy/The-ROS2-Project/Features.html)
     [ Eloquent (EOL) ](../../eloquent/index.html)
     [ Dashing (EOL) ](../../dashing/index.html)
     [ Crystal (EOL) ](../../crystal/index.html)
In Development
     [ Rolling ](Features.html)


* Composable Storefront / Spartacus depends on 3  rd  -party libraries. **If a high security issue is discovered with 3** ** rd  -party dependencies that are end-of-life (such as Node.js 14), support will be withdrawn from Commerce Cloud with short notice (1-2 weeks). ** A “high security issue” is an issue that has a vulnerability score (CVSSv3 score) of 7 or higher. For background information on vulnerability scoring, see [ https://nvd.nist.gov ](https://nvd.nist.gov) and [ https://blogs.sap.com/tag/cvss-v3 ](https://blogs.sap.com/tag/cvss-v3) .


Skip to content


Member


[ ![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=80&v=4)
](/crystaldust)


This has already been answered a couple of times above: by using Python entry
points.

---

All reactions


[ 6  Kudos  ](/t5/kudos/messagepage/board-id/crm-blog-sap/message-
id/13107/tab/all-users "Click here to see who gave kudos to this post.")


[ ![theme-lib.general.user-
avatar](https://avatars.profile.sap.com/d/d/iddda799c9e1b15753412a077e902e3df3f479c1bc0730593c447f231d3ff3a788_small.jpeg)
](/t5/user/viewprofilepage/user-id/48603 "View profile") ** by  [ Sigrid
](/t5/user/viewprofilepage/user-id/48603 "View profile") ** •  _Product and
Topic Expert_


Sorry, something went wrong.


$ ros2 run rclcpp_components component_container


Related Refs:


* 👍  1 reaction


$ ros2 run rclcpp_components component_container --ros-args -r __node:=MyContainer -r __ns:=/ns


###  [ SAP Hybris Cloud for Customer - All About Integration (No Longer
Updated) ](/t5/crm-and-cx-blogs-by-sap/sap-hybris-cloud-for-customer-all-
about-integration-no-longer-updated/ba-p/13210718)


Contributor  Author


Copy link


Terms


**[ dirk-thomas ](/dirk-thomas) ** commented  Jun 18, 2020


  * [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
  * [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
  * [ Security ](/security)
  * [ Status ](https://www.githubstatus.com/)
  * [ Docs ](https://docs.github.com/)
  * [ Contact ](https://support.github.com?tags=dotcom-footer)
  * Manage cookies
  * Do not share my personal information


{{ message }}


[ ![@dirk-thomas](https://avatars.githubusercontent.com/u/1335366?s=52&v=4)
](/dirk-thomas) [
![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=52&v=4)
](/crystaldust) [
![@sloretz](https://avatars.githubusercontent.com/u/4175662?s=52&v=4)
](/sloretz)


Use the unique ID to unload the node from the component container.


  * SAP Managed Tags:
  * [ Digital Technologies ](https://community.sap.com/t5/c-khhcw49343/Digital%2520Technologies/pd-p/33d804ef-26b2-4f01-b858-ddef6871cb3b) ,
  * [ Node.js ](https://community.sap.com/t5/c-khhcw49343/Node.js/pd-p/723714486627645412834578565527550) ,
  * [ SAP Commerce Cloud ](https://community.sap.com/t5/c-khhcw49343/SAP%2520Commerce%2520Cloud/pd-p/73555000100800001224)


[ ![@dirk-
thomas](https://avatars.githubusercontent.com/u/1335366?s=80&u=ec35ea6bae7c6e04a5df7482044bbc7681968435&v=4)
](/dirk-thomas)


$ ros2 run composition manual_composition


* [ angular ](/t5/tag/angular/tg-p/board-id/crm-blog-sap)


edited


Status


Showing results for


* Discover available components


[ ](/search?source=---two_column_layout_nav----------------------------------)


The ` name ` field of each ` ComposableNode ` object specifies the name that
should be used to identify the component when it is started. This name is used
to distinguish the component from other components and to specify its
dependencies and parameters.


  * [ Please tell more about SAP Commerce Composable Payment Framework technically ](/t5/crm-and-cx-questions/please-tell-more-about-sap-commerce-composable-payment-framework/qaq-p/13667684) in [ CRM and CX Questions ](/t5/crm-and-cx-questions/qa-p/crm-questions) a week ago
  * [ SAP Commerce Cloud Q1 ‘24 Release Highlights ](/t5/crm-and-cx-blogs-by-sap/sap-commerce-cloud-q1-24-release-highlights/ba-p/13665998) in [ CRM and CX Blogs by SAP ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap) a week ago
  * [ Unlock the Power of AI with Intelligent Selling Services for SAP Commerce Cloud ](/t5/crm-and-cx-blogs-by-sap/unlock-the-power-of-ai-with-intelligent-selling-services-for-sap-commerce/ba-p/13662569) in [ CRM and CX Blogs by SAP ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap) a week ago
  * [ SAP Customer Data Cloud Integration with Commerce Cloud and Composable Storefront ](/t5/crm-and-cx-blogs-by-sap/sap-customer-data-cloud-integration-with-commerce-cloud-and-composable/ba-p/13650618) in [ CRM and CX Blogs by SAP ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap) 3 weeks ago
  * [ SAP Commerce Cloud: Be Smart, Be Optimized, Be green ](/t5/crm-and-cx-blogs-by-sap/sap-commerce-cloud-be-smart-be-optimized-be-green/ba-p/13641284) in [ CRM and CX Blogs by SAP ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap) 03-18-2024


    #if defined _WIN32 || defined __CYGWIN__
      #ifdef __GNUC__
        #define IMAGE_PIPELINE_COMPOSITION_EXPORT __attribute__ ((dllexport))
        #define IMAGE_PIPELINE_COMPOSITION_IMPORT __attribute__ ((dllimport))
      #else
        #define IMAGE_PIPELINE_COMPOSITION_EXPORT __declspec(dllexport)
        #define IMAGE_PIPELINE_COMPOSITION_IMPORT __declspec(dllimport)
      #endif
      #ifdef IMAGE_PIPELINE_COMPOSITION_BUILDING_DLL
        #define IMAGE_PIPELINE_COMPOSITION_PUBLIC IMAGE_PIPELINE_COMPOSITION_EXPORT
      #else
        #define IMAGE_PIPELINE_COMPOSITION_PUBLIC IMAGE_PIPELINE_COMPOSITION_IMPORT
      #endif
      #define IMAGE_PIPELINE_COMPOSITION_PUBLIC_TYPE IMAGE_PIPELINE_COMPOSITION_PUBLIC
      #define IMAGE_PIPELINE_COMPOSITION_LOCAL
    #else
      #define IMAGE_PIPELINE_COMPOSITION_EXPORT __attribute__ ((visibility("default")))
      #define IMAGE_PIPELINE_COMPOSITION_IMPORT
      #if __GNUC__ >= 4
        #define IMAGE_PIPELINE_COMPOSITION_PUBLIC __attribute__ ((visibility("default")))
        #define IMAGE_PIPELINE_COMPOSITION_LOCAL  __attribute__ ((visibility("hidden")))
      #else
        #define IMAGE_PIPELINE_COMPOSITION_PUBLIC
        #define IMAGE_PIPELINE_COMPOSITION_LOCAL
      #endif
      #define IMAGE_PIPELINE_COMPOSITION_PUBLIC_TYPE
    #endif

    #ifdef __cplusplus
    }
    #endif

    #endif  // IMAGE_PIPELINE_COMPOSITION__VISIBILITY_CONTROL_H_


](/jobs-at-medium/work-at-medium-959d1a85284e?source=post_page-----
209ed023d8e5--------------------------------)


10 min read


Copy link


This demos shows that the same shared libraries can be reused to compile a
single executable running multiple components. The executable contains all
four components from above: talker and listener as well as server and client.


to get the path to where composition is installed. Then call


3 participants


**[ crystaldust ](/crystaldust) ** commented  Jun 29, 2020  •


**You're reading the documentation for a development version. For the latest
released version, please have a look at[ Galactic
](../../galactic/Tutorials/Composition.html) . **


Sorry, something went wrong.


Teams


* Solutions


  * [ Business Trends  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/business%20trends) 270
  * [ Business Trends  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/business%20trends%E2%80%8B) 10
  * [ chitchat  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/chitchat) 1
  * [ customerexperience  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/customerexperience) 1
  * [ Event Information  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/event%20information) 256
  * [ Event Information  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/event%20information%E2%80%8B) 17
  * [ Expert Insights  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/expert%20insights) 30
  * [ Expert Insights  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/expert%20insights%E2%80%8B) 48
  * [ Life at SAP  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/life%20at%20sap) 133
  * [ Life at SAP  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/life%20at%20sap%E2%80%8B) 1
  * [ Product Updates  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/product%20updates) 666
  * [ Product Updates  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/product%20updates%E2%80%8B) 24
  * [ SAP HANA Service  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/sap%20hana%20service) 1
  * [ SAPHANACloud  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/saphanacloud) 1
  * [ SAPHANAService  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/saphanaservice) 1
  * [ Technology Updates  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/technology%20updates) 453
  * [ Technology Updates  ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap/label-name/technology%20updates%E2%80%8B) 15


In the first shell, start the component container:


edited


Labels in this area


     [ Xin ](Composition.html)
     [ Rolling ](../../rolling/Tutorials/Composition.html)


  * **98406** Views
  * **71** comments
  * **68** kudos


[ ![@sloretz](https://avatars.githubusercontent.com/u/4175662?s=40&v=4)
](/sloretz)


Cancel  Create saved search


[ ![@crystaldust](https://avatars.githubusercontent.com/u/2040659?s=80&v=4)
](/crystaldust)


**[ crystaldust ](/crystaldust) ** commented  Jun 18, 2020  •


* Remapping container name and namespace


Now the shell should show repeated output for each sent and received message.


Now that we have seen the basic operation of components, we can discuss a few
more advanced topics.


###  Remapping container name and namespace  


Member


And when load/unload is called, the client lib should be able to distinguish
in which language the component is written, if the user try to load a cpp
component into a python container, an exception should be raised.

---

All reactions


Auto-suggest helps you quickly narrow down your search results by suggesting
possible matches as you type.


That would introduce a little complexity, especially compared with just using
the entry point. We have to choose between complex/generic and
simple/specific, how do you think on this point?

---

All reactions


The question is what is more efficient and scales better. I don't think
requiring to load entry points when trying to only collect available
components would be the right approach. With the number of packages and
component increasing I would expect the time to grow until this would be a
problem. So either the information can be gathered from the entry point alone
(without the need to load them) or from the ament resource index.

---

All reactions


Careers


Lets compile and Run,


* Composition using launch actions


    # Terminal 3
    # Load Display Component
    ros2 component load /ComponentManager img_pipeline_composition img_pipeline_composition::DisplayComponent

    ros2 component list

    #output
    /ComponentManager
      1  /camera
      2  /display

    # Now you can see both camera and display components are loaded

    # To unload the component
    ros2 component unload /ComponentManager 1 2


    $ ros2 component load /ComponentManager composition composition::Talker
    Loaded component 1 into '/ComponentManager' container node as '/talker'


  * [ design: process-with-multiple-nodes ](http://design.ros2.org/articles/roslaunch.html#process-with-multiple-nodes)
  * [ ros2cli component ](https://github.com/ros2/ros2cli/tree/master/ros2component)


    $ ros2 component list
    /ComponentManager
       1  /talker
       2  /listener


##  Footer


Releases


For any questions, don’t hesitate to contact your account team.


One key difference between ROS1 nodelets and ROS2 components is that ROS2
components use the _same API as ROS2 nodes_ , so you can use the same codebase
to implement _either type of computation_ . This can make it easier to switch
between the two approaches **_depending on the specific requirements of your
system_ ** , and it also avoids the need to use different APIs for different
types of computation.


In the second shell (see [ server
](https://github.com/ros2/demos/blob/master/composition/src/server_component.cpp)
and [ client
](https://github.com/ros2/demos/blob/master/composition/src/client_component.cpp)
source code):


Privacy


###  [ SAP Cloud for Customer Integration with ERP and CRM: How-to Guides and
E-Learning ](/t5/crm-and-cx-blogs-by-sap/sap-cloud-for-customer-integration-
with-erp-and-crm-how-to-guides-and-e/ba-p/13059640)


CRM and CX Blogs by SAP


##  Background  


* Different language client libs take advantage of the language speicification to "load class dynamically" from the ` ros(2)_components ` resource, which might be mapped to a .so file, .dll file(for Windows), or source code(for scripting languages like NodeJS, Python).


](/@nullbyte.in?source=post_page-----
209ed023d8e5--------------------------------)


Copy link


Thanks. Maybe I didn't make it clear. When saying 'register the python
component', besides passing the entry_points parameter in setup.py, the
component class's path also needs to be stored in the ament resource index
path so ` ros2 component types ` command will find it. So now I can't find a
good way to create the file under ament resource index path.


**[ crystaldust ](/crystaldust) ** commented  Jun 24, 2020  •


**[ crystaldust ](/crystaldust) ** commented  Jul 3, 2020


* [ composable storefront ](/t5/tag/composable%20storefront/tg-p/board-id/crm-blog-sap)


###  Run-time composition using ROS services with a server and client  


That's a good approach, the only difference is to generate the file by code or
user. By using data_files, develper will maintain the content manually, and a
little extra work will be considered: the content is `
composition::Talker;my_components.Talker ` while the entry point value is `
composition::Talker=my_components.Talker ` .


  * [ SAP Community ](/)
  *   * [ Products and Technology ](/t5/products-and-technology/ct-p/products)
  *   * [ CRM and Customer Experience ](/t5/crm-and-customer-experience/ct-p/crm)
  *   * [ CRM and CX Blogs by SAP ](/t5/crm-and-cx-blogs-by-sap/bg-p/crm-blog-sap)
  *   * Staying current with Commerce Cloud and Composable...


Sorry, something went wrong.


Already on GitHub? [ Sign in
](/login?return_to=%2Fros2%2Frclpy%2Fissues%2Fnew%2Fchoose) to your account


> I would propose to just use a Python API / entry point for Python
> components. The component can then decide internally if it wants to use a
> Cython library or not.


* Advanced Topics


[ Sign in
](/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40nullbyte.in%2Fros2-from-
the-ground-up-part-4-building-robust-robotics-systems-with-
ros2-composition-209ed023d8e5&source=post_page---two_column_layout_nav
-----------------------global_nav-----------)


###  Unloading components  


**This event will be enforced starting in 2024 or because of the event
described above (whichever comes first)** , versions of Composable Storefront
that are not current will result in build errors, and you will not be able to
deploy new code.


One potential advantage of using nodelets is that they can be more efficient
than nodes in cases where you have limited CPU cores and complex Robotics
system with many nodes. This is because nodelets are implemented as shared
libraries that are loaded at runtime by a container process, rather than run
as separate processes.


    * [ Learning Pathways  ](https://resources.github.com/learn/pathways/)
    * [ White papers, Ebooks, Webinars  ](https://resources.github.com/)
    * [ Customer Stories ](/customer-stories)
    * [ Partners  ](https://partner.github.com/)


Composition in a software system is the way that smaller parts or units are
put together to make a bigger whole. In the context of ROS 2, composition
loads the component at compile-time and run-time.


You must be a registered user to add a comment. If you've already registered,
sign in. Otherwise, register and sign in.


[ Sign in
](/login?return_to=https%3A%2F%2Fgithub.com%2Fros2%2Frclpy%2Fissues%2F575)


Search instead for


  * [ Notifications ](/login?return_to=%2Fros2%2Frclpy)
  * [ Fork  213  ](/login?return_to=%2Fros2%2Frclpy)
  * [ Star  245  ](/login?return_to=%2Fros2%2Frclpy)


Share


  nh.param("ns", topics_ns, std::string());
  nh.param("topics", topic_names, topic_names);


  if (!tf_->canTransform(global_frame_, in.header.frame_id, in.header.stamp, ros::Duration(transform_tolerance_)))
  {
    ROS_ERROR_THROTTLE(1.0, "Range sensor layer can't transform from %s to %s at %f",
                       global_frame_.c_str(), in.header.frame_id.c_str(),
                       in.header.stamp.toSec());
    return;
  }


External Links


  nh.param("use_decay", use_decay_, false);
  nh.param("pixel_decay", pixel_decay_, 10.0);
  nh.param("transform_tolerance_", transform_tolerance_, 0.3);


Users may find that they wish to access the ` x  ` , ` y  ` , and ` z  `
coordinates of a single return in a similar way. As the conversiton to
cartesian coordinates returns an ` Eigen::Array  ` ` n  x  3  ` , with ` n  =
w  *  h  ` , reshaping the resulting array is necessary.


###  LidarScan constructors  ï


  private:
    I2C_Interface* i2c = nullptr;
    /* DPS constant to convert raw register value to the degree per seconds (angular velocity).
    * The index of the values are adjusted to have corresponding values with the gyro_full_scale_range_t
    * enum. So, we can just get the DPS value by "dpsConstantArr[GYRO_SCALE_250]"" for GYRO_SCALE_250. */
    const float dpsConstantArr[4] = {250.0f / 32767.0f, 500.0f / 32767.0f, 1000.0f / 32767.0f, 2000.0f / 32767.0f};


void RangeSensorLayer::bufferIncomingRangeMsg(const sensor_msgs::RangeConstPtr& range_message)
{
  boost::mutex::scoped_lock lock(range_message_mutex_);
  range_msgs_buffer_.push_back(*range_message);
}


    /**
    * @brief This function sets the sensor digital low pass filter values. Tighter bandwitdh configs will
    *        generate more delay on the sensor outputs (check sensor datasheet). Keep in mind that default
    *        Gyroscope sample rate is 8 kHz but if we set DLPF config different than 0 it will be 1 kHz by default
    *        unless if we make an extra configuration to Sample Rate Divider.
    * @param dlpfConfig Digital low pass filter configuration value
    * @retval i2c_status_t
    */
    i2c_status_t SetSensor_DLPF_Config(DLPF_t dlpfConfig);


  if (!enabled_)
  {
    current_ = true;
    return;
  }


    ROS_DEBUG("%f %f | %f %f = %f", dx, dy, theta, phi, sensor);
    ROS_DEBUG("%f | %f %f | %f", prior, prob_occ, prob_not, new_prob);
    unsigned char c = to_cost(new_prob);


void RangeSensorLayer::deactivate()
{
  range_msgs_buffer_.clear();
}


    /**
    * @brief  This method used for getting the latest accelerometer Y axis RAW value from
    * the sensor. Make sure that sensor is not in sleeping mode and accelerometer full
    * scale range is set to desired range, before reading the values.
    * @param  error Error state of process
    * @retval int16_t Y axis RAW acceleration value
    */
    int16_t GetAccel_Y_Raw(i2c_status_t* error);


void RangeSensorLayer::updateBounds(double robot_x, double robot_y, double robot_yaw,
                                    double* min_x, double* min_y, double* max_x, double* max_y)
{
  if (layered_costmap_->isRolling())
    updateOrigin(robot_x - getSizeInMetersX() / 2, robot_y - getSizeInMetersY() / 2);


    /* FIFO registers */
    SensorConst FIFO_EN = 0x23;
    SensorConst FIFO_COUNT_L = 0x73;
    SensorConst FIFO_COUNT_H = 0x72;
    SensorConst FIFO_R_W = 0x74;


config_example $SENSOR_HOSTNAME


} // namespace MPU6050_Driver


range_sensor_layer
Author(s): David!!
autogenerated on Mon Feb 28 2022 22:55:28


    img_t<double> get_x_in_image_form(const LidarScan& scan, bool destaggered,
                                      const sensor::sensor_info& info) {
        // For convenience, save w and h to variables
        const size_t w = info.format.columns_per_frame;
        const size_t h = info.format.pixels_per_column;

        // Get the XYZ in ouster::Points (n x 3 Eigen array) form
        XYZLut lut = make_xyz_lut(info);
        auto cloud = cartesian(scan.field(sensor::ChanField::RANGE), lut);

        // Access x and reshape as needed
        // Note that the values in cloud.col(0) are ordered
        auto x = Eigen::Map<const img_t<double>>(cloud.col(0).data(), h, w);
        auto x_destaggered = destagger<double>(x, info.format.pixel_shift_by_row);

        // Apply destagger if desired
        if (!destaggered) return x;
        return x_destaggered;
    }


   double tx = out.point.x, ty = out.point.y;

   // calculate target props
   double dx = tx - ox, dy = ty - oy, theta = atan2(dy, dx), d = sqrt(dx * dx + dy * dy);

   // Integer Bounds of Update
   int bx0, by0, bx1, by1;

   // Triangle that will be really updated; the other cells within bounds are ignored
   // This triangle is formed by the origin and left and right sides of sonar cone
   int Ox, Oy, Ax, Ay, Bx, By;

   // Bounds includes the origin
   worldToMapNoBounds(ox, oy, Ox, Oy);
   bx1 = bx0 = Ox;
   by1 = by0 = Oy;
   touch(ox, oy, &min_x_, &min_y_, &max_x_, &max_y_);

   // Update Map with Target Point
   unsigned int aa, ab;
   if (worldToMap(tx, ty, aa, ab))
   {
     setCost(aa, ab, 233);
     touch(tx, ty, &min_x_, &min_y_, &max_x_, &max_y_);
   }

   double mx, my;

   // Update left side of sonar cone
   mx = ox + cos(theta - max_angle_) * d * 1.2;
   my = oy + sin(theta - max_angle_) * d * 1.2;
   worldToMapNoBounds(mx, my, Ax, Ay);
   bx0 = std::min(bx0, Ax);
   bx1 = std::max(bx1, Ax);
   by0 = std::min(by0, Ay);
   by1 = std::max(by1, Ay);
   touch(mx, my, &min_x_, &min_y_, &max_x_, &max_y_);

   // Update right side of sonar cone
   mx = ox + cos(theta + max_angle_) * d * 1.2;


  for (unsigned int x = bx0; x <= (unsigned int)bx1; x++)
  {
    for (unsigned int y = by0; y <= (unsigned int)by1; y++)
    {
      bool update_xy_cell = true;


#  C++ Examples  ï


void RangeSensorLayer::activate()
{
  range_msgs_buffer_.clear();
}


using costmap_2d::NO_INFORMATION;


    /**
    * @brief  This method used for setting the accelerometer Y axis offset value. Offset is
    * using in the sensor calibration routine.
    * @param offset
    * @retval i2c_status_t
    */
    i2c_status_t SetAccel_Y_Offset(int16_t offset);


    /**
    * @brief This function resets the sensor FIFO.
    * @param none
    * @retval i2c_status_t
    */
    i2c_status_t Reset_Sensor_FIFO(void);


  InputSensorType input_sensor_type = ALL;
  std::string sensor_type_name;
  nh.param("input_sensor_type", sensor_type_name, std::string("ALL"));


Main Page
+Namespaces
+Classes
+Files
src
range_sensor_layer.cpp
Go to the documentation of this file.
 // Copyright 2018 David V. Lu!!
 #include <range_sensor_layer/range_sensor_layer.h>
 #include <boost/algorithm/string.hpp>
 #include <geometry_msgs/PointStamped.h>
 #include <pluginlib/class_list_macros.h>
 #include <angles/angles.h>
 #include <algorithm>
 #include <list>
 #include <limits>
 #include <map>
 #include <string>
 #include <utility>

 PLUGINLIB_EXPORT_CLASS(range_sensor_layer::RangeSensorLayer, costmap_2d::Layer)

 using costmap_2d::NO_INFORMATION;

 namespace range_sensor_layer
 {

 RangeSensorLayer::RangeSensorLayer() {}

 void RangeSensorLayer::onInitialize()
 {
   ros::NodeHandle nh("~/" + name_);
   current_ = true;
   buffered_readings_ = 0;
   last_reading_time_ = ros::Time::now();
   default_value_ = to_cost(0.5);

   matchSize();
   resetRange();


    /**
    * @brief This function sets the sensor FIFO enable bit in USER_CTRL register.
    * @param state State of the FIFO to be set. True if it will be enabled.
    * @retval i2c_status_t
    */
    i2c_status_t SetSensor_FIFO_Enable(bool state);


    /**
    * @brief  This method used for setting the accelerometer Z axis offset value. Offset is
    * using in the sensor calibration routine.
    * @param offset
    * @retval i2c_status_t
    */
    i2c_status_t SetAccel_Z_Offset(int16_t offset);


    /**
    * @brief  This method used for getting the latest gyroscope Z axis RAW value from
    * the sensor. Make sure that sensor is not in sleeping mode and gyroscope full
    * scale range is set to desired range before reading the values.
    * @param  error Error state of process
    * @retval int16_t Z axis RAW gyroscope value
    */
    int16_t GetGyro_Z_Raw(i2c_status_t* error);


The function ` get_config  ` takes a ` sensor_config  ` so we must declare it
first. It returns true if it succesfully retrieves the config, and false if an
error occurs in connecting to the sensor and setting the config. The function
` set_config  ` works similarly, returning true if it successfully sets the
config, and false otherwise.


Users may find that they wish to apply an extra transform while projecting to
cartesian coordinates. Such a transform, likely an extrinsics matrix of some
sort, can be baked into the [ ` ouster::XYZLut  `
](ouster_client/lidar_scan.html#_CPPv4N6ouster6XYZLutE "ouster::XYZLut")
created with [ ` ouster::make_xyz_lut()  `
](ouster_client/lidar_scan.html#_CPPv4N6ouster12make_xyz_lutE6size_t6size_tdRK5mat4dRK5mat4dRKNSt6vectorIdEERKNSt6vectorIdEE
"ouster::make_xyz_lut") .


    /**
    * @brief This function gets the number of bytes written in the sensor FIFO buffers.
    * @param error Result of the operation
    * @retval uint16_t Number of samples in the FIFO buffer in bytes
    */
    uint16_t GetSensor_FIFOCount(i2c_status_t* error);


  if (phi >= 0.0 && phi < r - 2 * delta * r)
    return (1 - lbda) * (0.5);
  else if (phi < r - delta * r)
    return lbda * 0.5 * pow((phi - (r - 2 * delta * r)) / (delta * r), 2) + (1 - lbda) * .5;
  else if (phi < r + delta * r)
  {
    double J = (r - phi) / (delta * r);
    return lbda * ((1 - (0.5) * pow(J, 2)) - 0.5) + 0.5;
  }
  else
    return 0.5;
}


in.point.x = range_message.range;


But suppose you donât care about some of the data, such as the ambient and
signal fields. You can also specify to your LidarScan to only batch the
relevant fields like so:


To facilitate working with the Ouster C++ SDK, we provide these examples of
common operations. The examples explained below are compiled into executables
which print to screen to demonstratre behavior. Build with ` BUILD_EXAMPLES  `
and print to screen to demonstrate behavior.


###  Adjusting XYZLut With External Matrix  ï


ROS1 Guide


#endif /* include guard */


The source code of ` lidar_scan_example  ` is available [ here
](https://github.com/ouster-
lidar/ouster_example/blob/master/examples/lidar_scan_example.cpp) .


   range_message_mutex_.unlock();

   for (std::list<sensor_msgs::Range>::iterator range_msgs_it = range_msgs_buffer_copy.begin();
        range_msgs_it != range_msgs_buffer_copy.end(); range_msgs_it++)
   {
     processRangeMessageFunc_(*range_msgs_it);
   }
 }

 void RangeSensorLayer::processRangeMsg(sensor_msgs::Range& range_message)
 {
   if (range_message.min_range == range_message.max_range)
     processFixedRangeMsg(range_message);
   else
     processVariableRangeMsg(range_message);
 }

 void RangeSensorLayer::processFixedRangeMsg(sensor_msgs::Range& range_message)
 {
   if (!std::isinf(range_message.range))
   {
     ROS_ERROR_THROTTLE(1.0,
                        "Fixed distance ranger (min_range == max_range) in frame %s sent invalid value. "
                        "Only -Inf (== object detected) and Inf (== no object detected) are valid.",
                        range_message.header.frame_id.c_str());
     return;
   }

   bool clear_sensor_cone = false;

   if (range_message.range > 0)  // +inf
   {
     if (!clear_on_max_reading_)
       return;  // no clearing at all

     clear_sensor_cone = true;
   }

   range_message.range = range_message.min_range;


  for (int j = min_j; j < max_j; j++)
  {
    unsigned int it = j * span + min_i;
    for (int i = min_i; i < max_i; i++)
    {
      unsigned char prob = costmap_[it];
      unsigned char current;
      if (prob == costmap_2d::NO_INFORMATION)
      {
        it++;
        continue;
      }
      else if (prob > mark)
        current = costmap_2d::LETHAL_OBSTACLE;
      else if (prob < clear)
        current = costmap_2d::FREE_SPACE;
      else
      {
        it++;
        continue;
      }


Of foremost interest when using a ` LidarScan  ` is constructing a ` LidarScan
` which suits your needs.


/**
  ******************************************************************************
  * @file    mpu6050.h
  * @author  Ali Batuhan KINDAN
  * @date    20.12.2020
  * @brief   This file constains MPU6050 driver declarations.
  *
  * MIT License
  *
  * Copyright (c) 2022 Ali Batuhan KINDAN
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  * copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be included in all
  * copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
#ifndef MPU6050_H
#define MPU6050_H


[ Previous ](building.html "Building the C++ Client from Source") [ Next
](../reference/lidar-scan.html "Lidar Scan API")


© Copyright 2022, Ouster, Inc..


  namespace Regbits_INT_ENABLE {
    SensorConst BIT_DATA_RDY_EN = BIT_0;
    SensorConst BIT_I2C_MST_INT_EN = BIT_3;
    SensorConst BIT_FIFO_OFLOW_EN = BIT_4;
  }


      ROS_ERROR("This planner has not been initialized, please call initialize() before using this planner");
      return false;
    }
    geometry_msgs::PoseStamped robot_vel;
    odom_helper_.getRobotVel(robot_vel);
    /* For timing uncomment
    struct timeval start, end;
    double start_t, end_t, t_diff;
    gettimeofday(&start, NULL);
    */
    //compute what trajectory to drive along
    geometry_msgs::PoseStamped drive_cmds;
    drive_cmds.header.frame_id = costmap_ros_->getBaseFrameID();

    // call with updated footprint
    base_local_planner::Trajectory path = dp_->findBestPath(global_pose, robot_vel, drive_cmds);
    //ROS_ERROR("Best: %.2f, %.2f, %.2f, %.2f", path.xv_, path.yv_, path.thetav_, path.cost_);
    /* For timing uncomment
    gettimeofday(&end, NULL);
    start_t = start.tv_sec + double(start.tv_usec) / 1e6;
    end_t = end.tv_sec + double(end.tv_usec) / 1e6;
    t_diff = end_t - start_t;
    ROS_INFO("Cycle time: %.9f", t_diff);
    */
    //pass along drive commands
    cmd_vel.linear.x = drive_cmds.pose.position.x;
    cmd_vel.linear.y = drive_cmds.pose.position.y;
    cmd_vel.angular.z = tf2::getYaw(drive_cmds.pose.orientation);
    //if we cannot move... tell someone
    std::vector<geometry_msgs::PoseStamped> local_plan;
    if(path.cost_ < 0) {
      ROS_DEBUG_NAMED("dwa_local_planner",
          "The dwa local planner failed to find a valid plan, cost functions discarded all candidates. This can mean there is an obstacle too close to the robot.");
      local_plan.clear();
      publishLocalPlan(local_plan);
      return false;
    }
    ROS_DEBUG_NAMED("dwa_local_planner", "A valid velocity command of (%.2f, %.2f, %.2f) was found for this cycle.",
                    cmd_vel.linear.x, cmd_vel.linear.y, cmd_vel.angular.z);
    // Fill out the local plan


    /* Accelerometer read registers */
    SensorConst ACCEL_X_OUT_L = 0x3C;
    SensorConst ACCEL_X_OUT_H = 0x3B;
    SensorConst ACCEL_Y_OUT_H = 0x3D;
    SensorConst ACCEL_Y_OUT_L = 0x3E;
    SensorConst ACCEL_Z_OUT_H = 0x3F;
    SensorConst ACCEL_Z_OUT_L = 0x40;
    /* Temperature read SensorConstisters */
    SensorConst TEMP_OUT_H = 0x41;
    SensorConst TEMP_OUT_L = 0x42;
    /* Gyroscope read SensorConstisters */
    SensorConst GYRO_X_OUT_H = 0x43;
    SensorConst GYRO_X_OUT_L = 0x44;
    SensorConst GYRO_Y_OUT_H = 0x45;
    SensorConst GYRO_Y_OUT_L = 0x46;
    SensorConst GYRO_Z_OUT_H = 0x47;
    SensorConst GYRO_Z_OUT_L = 0x48;
    /* Gyroscope offset SensorConstisters */
    SensorConst XG_OFFS_USR_H = 0x13;
    SensorConst XG_OFFS_USR_L = 0x14;
    SensorConst YG_OFFS_USR_H = 0x15;
    SensorConst YG_OFFS_USR_L = 0x16;
    SensorConst ZG_OFFS_USR_H = 0x17;
    SensorConst ZG_OFFS_USR_L = 0x18;
    /* Accellerometer offset SensorConstisters */
    SensorConst XA_OFFS_USR_H = 0x06;
    SensorConst XA_OFFS_USR_L = 0x07;
    SensorConst YA_OFFS_USR_H = 0x08;
    SensorConst YA_OFFS_USR_L = 0x09;
    SensorConst ZA_OFFS_USR_H = 0x0A;
    SensorConst ZA_OFFS_USR_L = 0x0B;


    /**
    * @brief  This method used for calibrating the accelerometer registers to given target values.
    * @param targetX target value for accelerometer X axis register in MG so 1.0f means 1G
    * @param targetY target value for accelerometer Y axis register in MG
    * @param targetZ target value for accelerometer Z axis register in MG
    * @retval i2c_status_t
    */
    i2c_status_t Calibrate_Accel_Registers(float targetX_MG = 0.0f, float targetY_MG = 0.0f, float targetZ_MG = 1.0f);


    /**
    * @brief  This method used for getting the latest accelerometer X axis RAW value from
    * the sensor. Make sure that sensor is not in sleeping mode and accelerometer full
    * scale range is set to desired range, before reading the values.
    * @param  error Error state of process
    * @retval int16_t X axis RAW acceleration value
    */
    int16_t GetAccel_X_Raw(i2c_status_t* error);


* [ Build and Use ](https://github.com/ouster-lidar/ouster-ros/wiki/index)


  // Bounds includes the origin
  worldToMapNoBounds(ox, oy, Ox, Oy);
  bx1 = bx0 = Ox;
  by1 = by0 = Oy;
  touch(ox, oy, &min_x_, &min_y_, &max_x_, &max_y_);


  if (range_message.range > 0)  // +inf
  {
    if (!clear_on_max_reading_)
      return;  // no clearing at all


To see this in action, you can run the example executable ` lidar_scan_example
` :


    /**
    * @brief This function sets the sensor interrupt pin config register.
    * @param intPinConfig interrput pin config value to set
    * @retval i2c_status_t
    */
    i2c_status_t SetSensor_InterruptPinConfig(uint8_t intPinConfig);


    /**
    * @brief This function gets the current sensor sample rate. In order to do this, method
    *        reads Sample Rate Divider (0x19) and DLPF Config (0x1A) registers.
    * @param error Result of the operation
    * @retval float Current sample rate in Hz
    */
    float GetSensor_CurrentSampleRate_Hz (i2c_status_t* error);


     return lbda * 0.5 * pow((phi - (r - 2 * delta * r)) / (delta * r), 2) + (1 - lbda) * .5;
   else if (phi < r + delta * r)
   {
     double J = (r - phi) / (delta * r);
     return lbda * ((1 - (0.5) * pow(J, 2)) - 0.5) + 0.5;
   }
   else
     return 0.5;
 }

 void RangeSensorLayer::reconfigureCB(range_sensor_layer::RangeSensorLayerConfig &config, uint32_t level)
 {
   phi_v_ = config.phi;
   inflate_cone_ = config.inflate_cone;
   no_readings_timeout_ = config.no_readings_timeout;
   clear_threshold_ = config.clear_threshold;
   mark_threshold_ = config.mark_threshold;
   clear_on_max_reading_ = config.clear_on_max_reading;

   if (enabled_ != config.enabled)
   {
     enabled_ = config.enabled;
     current_ = false;
   }
 }

 void RangeSensorLayer::bufferIncomingRangeMsg(const sensor_msgs::RangeConstPtr& range_message)
 {
   boost::mutex::scoped_lock lock(range_message_mutex_);
   range_msgs_buffer_.push_back(*range_message);
 }

 void RangeSensorLayer::updateCostmap()
 {
   std::list<sensor_msgs::Range> range_msgs_buffer_copy;

   range_message_mutex_.lock();
   range_msgs_buffer_copy = std::list<sensor_msgs::Range>(range_msgs_buffer_);
   range_msgs_buffer_.clear();


  // Validate topic names list: it must be a (normally non-empty) list of strings
  if ((topic_names.valid() == false) || (topic_names.getType() != XmlRpc::XmlRpcValue::TypeArray))
  {
    ROS_ERROR("Invalid topic names list: it must be a non-empty list of strings");
    return;
  }