-
Notifications
You must be signed in to change notification settings - Fork 9
Update qos profile -- take 2 #25
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
Update qos profile -- take 2 #25
Conversation
6a7ef48 to
8201da2
Compare
|
Converting to draft until #30 is merged. |
8201da2 to
2648f10
Compare
* Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
2648f10 to
0a9fb5f
Compare
| default: | ||
| std::ostringstream oss{"unknown history policy value: ", std::ios_base::ate}; | ||
| oss << qos.history; | ||
| rcljava_throw_exception(env, "java/lang/IllegalStateException", oss.str()); |
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.
It looks like we're only outputting the invalid value for the history policy and not in cases of invalid values for other QoS settings. I would update this (or the other default cases) to be consistent.
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.
Yeah, this is a leftover. I used that while debugging.
| * QoSProfile.sensorData(); // get predefined sensor data qos profile | ||
| */ | ||
| public class QoSProfile { | ||
| // TODO(ivanpauno): Update all qos policies in a way that the objects are created from RCL, |
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 think this is done in this PR, right?
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.
There were two TODOs:
- Avoiding to hard code the default profiles, that is being fixed here.
- Avoiding to hard code the policies enumeration numbers, that's not being fixed here.
This comment was referring to the second, if it's not clear I can try to rephrase it.
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.
Do you think it's worth doing the second point at all? I don't see an issue using separate enum values within rcljava, though I found a similar TODO in rclpy.
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.
Do you think it's worth doing the second point at all? I don't see an issue using separate enum values within rcljava, though I found a similar TODO in rclpy.
The issue is that you have to keep the numbers synced.
If the numbers get out of sync it might be a pretty hard bug to find, causing unexpected behavior to the user.
| QoSProfile qos = new QoSProfile(); | ||
| qos.nativeFromRCL(qos.nativeGetHandleFromName("default")); |
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.
Is it possible to make nativeFromRCL a static method? It might clean up the implementation a bit, but I'm not sure.
Then this can be rewritten as
return nativeFromRCL(nativeGetHandleFromName("default"));Further, if there's no other intended use for nativeGetHandleFromName, we could just provide a single native method instead, e.g.
return nativeFromRCL("default");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'm using the nativeFromRCL that takes a handle in #26:
ros2_java/rcljava/src/main/cpp/org_ros2_rcljava_graph_EndpointInfo.cpp
Lines 102 to 104 in 7bd6cc4
| jmethodID qos_from_rcl_mid = env->GetMethodID(qos_clazz, "nativeFromRCL", "(J)V"); | |
| env->CallObjectMethod(jqos, qos_from_rcl_mid, &p->qos_profile); | |
| env->SetObjectField(self, qos_fid, jqos); |
The difference is that in this way nativeFromRCL can be called in an already constructed QoS object.
Maybe that's not quite useful, but I originally thought that I was going to use that.
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com> Co-authored-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com> Co-authored-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
|
Going in, thanks for reviewing @jacobperron ! |
* Improve QoSProfile constructors * Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Improve QoSProfile constructors * Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Improve QoSProfile constructors * Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Improve QoSProfile constructors * Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Improve QoSProfile constructors * Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
* Improve QoSProfile constructors * Add documentation to QoSProfile class * Add fromRCL method to QoSProfile * Use fromRCL to create the built-in qos profiles. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Follow up of #20.
Some of this changes are required by #26, some are unrelated improvements.