Git Product home page Git Product logo

Comments (7)

suab321321 avatar suab321321 commented on July 23, 2024 1

#478 here @jacobperron sir

from rclpy.

suab321321 avatar suab321321 commented on July 23, 2024

@mikaelarguedas I would like to like to contribute

from rclpy.

mikaelarguedas avatar mikaelarguedas commented on July 23, 2024

@suab321321 I haven't been involved in this project for a long time so can't provide feedback about the status / relevance of this ticket with respect to the current code base.
Maybe current maintainers will be able to provide more up-to-date information.

from rclpy.

jacobperron avatar jacobperron commented on July 23, 2024

It looks like we have a few custom exceptions defined already:

static PyObject * RCLInvalidROSArgsError;
static PyObject * UnknownROSArgsError;
static PyObject * NodeNameNonExistentError;

But a quick search yields several places in _rclpy.c that raise RuntimeError where we might consider using custom exceptions. Whenever a call to the rcl layer errors, at the very least we could return a generic RCLError exception (I think this is what rclcpp does).

@suab321321 If you'd like to contribute to this ticket, I think a good first step would be to replace instances of RuntimeError with a new RCLError whenever there's a failed call to the rcl layer.
I suggest reviewing documentation on writing C-extensions for Python, in particular this section on errors and exceptions. You can add logic to initialize the new exception next to the other exceptions:

rclpy/rclpy/src/rclpy/_rclpy.c

Lines 5088 to 5099 in d375c84

RCLInvalidROSArgsError = PyErr_NewExceptionWithDoc(
"_rclpy.RCLInvalidROSArgsError",
"Thrown when invalid ROS arguments are found by rcl.",
PyExc_RuntimeError, NULL);
if (NULL == RCLInvalidROSArgsError) {
Py_DECREF(m);
return NULL;
}
if (PyModule_AddObject(m, "RCLInvalidROSArgsError", RCLInvalidROSArgsError) != 0) {
Py_DECREF(m);
return NULL;
}

from rclpy.

suab321321 avatar suab321321 commented on July 23, 2024

@jacobperron okay sir I will proceed with this

from rclpy.

suab321321 avatar suab321321 commented on July 23, 2024

@jacobperron sir I have to make RCLError first right?

from rclpy.

jacobperron avatar jacobperron commented on July 23, 2024

I have to make RCLError first right?

Correct. You can declare and initialize it in the two places of the code I referenced (#31 (comment)).

from rclpy.

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.