Giter Site home page Giter Site logo

Comments (3)

wjwwood avatar wjwwood commented on July 30, 2024

No, from a conceptual stand point, you must call init before creating a Node.

You should have your users (the users of your library) call init before using your library or, if you're not sure if they're going to use ROS or not, then you could check if init has been done and do it yourself if not (relies on the feature request I linked to above). There is already an issue on rclpy for checking if init has been called: ros2/rclpy#190

Another future option would be to have the ability to init multiple times in the same process (non-global init), which is a refactor we've been wanting to do for a while now. But that's not an option right now.

from design.

wjwwood avatar wjwwood commented on July 30, 2024

Please close this issue if that answers your question and/or consider closing this in favor of feature requests on one of the client libraries (rclpy or rclcpp).

from design.

reed-lau avatar reed-lau commented on July 30, 2024

for multiple rclpy.init() call and init fail will both throw RuntimeError. the right way to avoid multiple init is like that ?

try:
    rclpy.init()
execpt Execption:
    if rclpy.ok():
       print("multiple init")
    else:
       printf("init fail")

from design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.