-
Notifications
You must be signed in to change notification settings - Fork 9
Add Node Options #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Node Options #3
Conversation
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
ivanpauno
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed the tests yet.
The overall approach looks good to me, but I would prefer to have a NodeOptions class defined in Java.
That will make the API look nicer.
This should make the code much easier to read. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
This makes it a lot nicer to use. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
ivanpauno
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1. Check return value of malloc. 2. Get rid of unnecessary cast. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
|
All right, I ended up doing the minor fixes pointed out by @ivanpauno . I'm going to go ahead and merge this, then rebase #5 on top. Thanks for the reviews! |
* Get the node name and namespace from the native interface. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Add in node options to nativeCreateNodeHandle. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Add in NodeOptions test. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Move argument parsing to its own helper function. This should make the code much easier to read. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Add a NodeOptions class. This makes it a lot nicer to use. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Make sure to DeleteLocalRef after use. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * Fixes from review. 1. Check return value of malloc. 2. Get rid of unnecessary cast. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> * android compatibility Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com> Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
This pull request adds the ability to specify options to the node, much like is done for rclcpp and rclpy. It consists of 3 commits:
getNameandgetNamespaceso that they both get data from the underlying rcl implementation. While this isn't strictly related to this PR, this is more correct and it makes it possible to write tests to ensure that the argument parsing is working as intended.createNode, and ultimately thenativeCreateNodeHandleJNI functions.I will note that this PR changes the
RCLJava::createNodefull signature in non-backwards-compatible ways. I did it that way to more closely mimic the rclcpp API, but I could also be convinced to just append to thecreateNodeparameters, rather than rearranging them.On a separate note, a lot of methods and functions at the JNI layer are being invoked without error checking. This generally leads to a crash of the JVM if an error condition is hit. We should probably have a separate effort to audit those and add error checking as appropriate.
@jacobperron FYI.