Skip to content

Update qos profile -- take 2 - #25

Merged
ivanpauno merged 11 commits into
galactic-develfrom
ivanpauno/update-qos-profile-take-2
Sep 9, 2020
Merged

Update qos profile -- take 2#25
ivanpauno merged 11 commits into
galactic-develfrom
ivanpauno/update-qos-profile-take-2

Conversation

@ivanpauno

@ivanpaunoivanpauno commented Sep 1, 2020

Copy link
Copy Markdown
Collaborator

Follow up of #20.

  • Improve QoSProfile constructors (matching better with rclcpp and rclpy).
  • Add docs to QoSProfile class.
  • Add UNKNOWN enum value to policies.
  • Add fromRCL method to QoSProfile.
  • Use fromRCL to create the built-in qos profiles.

Some of this changes are required by #26, some are unrelated improvements.

@ivanpaunoivanpauno added the enhancement New feature or request label Sep 1, 2020
@ivanpaunoivanpauno self-assigned this Sep 1, 2020
@ivanpauno
ivanpaunoforce-pushed the ivanpauno/update-qos-profile-take-2 branch from 6a7ef48 to 8201da2CompareSeptember 3, 2020 18:20
@ivanpauno
ivanpauno changed the base branch from foxy-devel to ivanpauno/add-convenient-error-handling-macrosSeptember 3, 2020 18:20
@ivanpauno

Copy link
Copy Markdown
CollaboratorAuthor

Converting to draft until #30 is merged.

@ivanpauno
ivanpauno marked this pull request as draft September 8, 2020 14:21
@ivanpauno
ivanpaunoforce-pushed the ivanpauno/update-qos-profile-take-2 branch from 8201da2 to 2648f10CompareSeptember 8, 2020 21:13
Base automatically changed from ivanpauno/add-convenient-error-handling-macros to galactic-develSeptember 8, 2020 21:22
* 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>
@ivanpauno
ivanpaunoforce-pushed the ivanpauno/update-qos-profile-take-2 branch from 2648f10 to 0a9fb5fCompareSeptember 8, 2020 21:26
@ivanpauno
ivanpauno marked this pull request as ready for review September 8, 2020 21:28
default:
std::ostringstream oss{"unknown history policy value: ", std::ios_base::ate};
oss << qos.history;
rcljava_throw_exception(env, "java/lang/IllegalStateException", oss.str());

Copy link
Copy Markdown

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.

Copy link
Copy Markdown
CollaboratorAuthor

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.

Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
* 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,

@jacobperronjacobperronSep 8, 2020

Copy link
Copy Markdown

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?

Copy link
Copy Markdown
CollaboratorAuthor

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.

@jacobperronjacobperronSep 9, 2020

Copy link
Copy Markdown

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.

@ivanpaunoivanpaunoSep 9, 2020

Copy link
Copy Markdown
CollaboratorAuthor

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.

Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
Comment threadrcljava/src/main/java/org/ros2/rcljava/qos/QoSProfile.java Outdated
Comment on lines +239 to +240
QoSProfile qos = new QoSProfile();
qos.nativeFromRCL(qos.nativeGetHandleFromName("default"));

Copy link
Copy Markdown

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

returnnativeFromRCL(nativeGetHandleFromName("default"));

Further, if there's no other intended use for nativeGetHandleFromName, we could just provide a single native method instead, e.g.

returnnativeFromRCL("default");

Copy link
Copy Markdown
CollaboratorAuthor

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:

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.

ivanpaunoand others added 9 commits September 9, 2020 11:18
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>
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>
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>
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>
@ivanpauno

Copy link
Copy Markdown
CollaboratorAuthor

Going in, thanks for reviewing @jacobperron !

@ivanpauno
ivanpauno merged commit a6b5a0b into galactic-develSep 9, 2020
@ivanpauno
ivanpauno deleted the ivanpauno/update-qos-profile-take-2 branch September 9, 2020 17:51
ivanpauno added a commit that referenced this pull request May 17, 2021
* 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>
jacobperron pushed a commit to ros2-java/ros2_java that referenced this pull request May 13, 2022
* 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>
jacobperron pushed a commit to ros2-java/ros2_java that referenced this pull request May 13, 2022
* 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>
jacobperron pushed a commit to ros2-java/ros2_java that referenced this pull request May 17, 2022
* 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>
ivanpauno added a commit to ros2-java/ros2_java that referenced this pull request Jun 27, 2022
* 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>
ivanpauno added a commit to ros2-java/ros2_java that referenced this pull request Aug 10, 2022
* 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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ivanpauno@jacobperron