Skip to content

Conversation

@ivanpauno
Copy link
Collaborator

@ivanpauno ivanpauno commented Sep 1, 2020

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.

@ivanpauno ivanpauno added the enhancement New feature or request label Sep 1, 2020
@ivanpauno ivanpauno self-assigned this Sep 1, 2020
@ivanpauno ivanpauno force-pushed the ivanpauno/update-qos-profile-take-2 branch from 6a7ef48 to 8201da2 Compare September 3, 2020 18:20
@ivanpauno ivanpauno changed the base branch from foxy-devel to ivanpauno/add-convenient-error-handling-macros September 3, 2020 18:20
@ivanpauno
Copy link
Collaborator Author

Converting to draft until #30 is merged.

@ivanpauno ivanpauno marked this pull request as draft September 8, 2020 14:21
@ivanpauno ivanpauno force-pushed the ivanpauno/update-qos-profile-take-2 branch from 8201da2 to 2648f10 Compare September 8, 2020 21:13
Base automatically changed from ivanpauno/add-convenient-error-handling-macros to galactic-devel September 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 ivanpauno force-pushed the ivanpauno/update-qos-profile-take-2 branch from 2648f10 to 0a9fb5f Compare September 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());

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
Collaborator Author

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,
Copy link

@jacobperron jacobperron Sep 8, 2020

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
Collaborator Author

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.

Copy link

@jacobperron jacobperron Sep 9, 2020

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.

Copy link
Collaborator Author

@ivanpauno ivanpauno Sep 9, 2020

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 on lines +239 to +240
QoSProfile qos = new QoSProfile();
qos.nativeFromRCL(qos.nativeGetHandleFromName("default"));

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");

Copy link
Collaborator Author

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.

ivanpauno and 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
Collaborator Author

Going in, thanks for reviewing @jacobperron !

@ivanpauno ivanpauno merged commit a6b5a0b into galactic-devel Sep 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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants