FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Skeleton parameters sync API by esteve · Pull Request #28 · ros2/rclcpp · GitHub

/ rclcpp Public

Skeleton parameters sync API - #28

Merged
esteve merged 7 commits into
masterfrom
parameters-api-review-sync
May 5, 2015
Merged

Skeleton parameters sync API#28
esteve merged 7 commits into
masterfrom
parameters-api-review-sync

Conversation

esteve commented Apr 30, 2015

Copy link
Copy Markdown
Member

esteve added the in progress Actively being worked on (Kanban column) label Apr 30, 2015
Comment thread rclcpp/include/rclcpp/parameter.hpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should the bytes be signed or unsigned? I've done unsigned in the past, but I'm not sure that it matters.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This matches the code generated in ParameterValue_Struct.h from ParameterValue.msg, but I'd prefer uint8_t myself.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It should indeed be uint8 to follow our message parser which defines all the types: https://github.com/ros2/rosidl/blob/master/rosidl_parser/rosidl_parser/__init__.py#L484-L485

Probably the ParameterValue message needs to be updated to change bytes_value to int8[].

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I replaced int8[] with byte[] in ParameterValue as it's semantically more accurate:ros2/rcl_interfaces@ee983f3

tfoote commented May 1, 2015

Copy link
Copy Markdown
Contributor

Overall this looks good. I'm a little worried about implicitly creating the executor inside. This is something we should review going forward. But we can use this for now.

+1

Comment thread rclcpp/include/rclcpp/parameter.hpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why is friend needed here? It seems to only use the public constructor.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Executor may need private/protected members in this class? Not sure though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Removed. This was a remnant of a quick test.

esteve force-pushed the parameters-api-review-sync branch from 9244586 to 9943576 Compare May 4, 2015 17:26

esteve commented May 4, 2015

Copy link
Copy Markdown
Member Author

I've renamed ParameterListResult and ParameterSetResult to ListParametersResult and SetParametersResult respectively in ros2/rcl_interfaces#3

Copy link
Copy Markdown
Member

Currently the API uses multiple template specializations of get_value with different return types. So the user must always specify the template type. Do we want to provide methods which contain the type in the name (additionally or instead)? We might also consider the C-equivalent of this API - will parameters in C and C++ be completely different implementations?

Also I think we could still return const std::string & in the case of strings (#26 (comment)). I don't think that the template T prevents us from specializing it for const std::string &?

esteve commented May 4, 2015

Copy link
Copy Markdown
Member Author

@dirk-thomas I've changed it so that the user only needs to pass the ParameterType value to get_value<> instead of using types.

I think this could be improved if we didn't require the storage to be a ParameterValue, which is completely an implementation detail. Then we could declare all the constructors as constexpr as well as get_type and it'll be less cumbersome:

auto value = p.get_value<p.get_type()>()

or we might even get rid of p.get_type and just use p.get_value

wjwwood commented May 4, 2015

Copy link
Copy Markdown
Member

There's precedence in other API's for have something like .asString, .asInt, and .asDouble rather than .as<std::string>, .as<int64_t>, and .as<double>, especially when there are a finite set of options. I don't really mind one way or the other.

As for it being aligned with the style of the C api, I think it's fine if they are not one to one. If it makes more sense to use a template in the C++ and an expanded name in C that's fine. It can be made similar and familiar without being exactly the same.

esteve commented May 4, 2015

Copy link
Copy Markdown
Member Author

+1 to as_string, as_int, etc. instead of templatized get_value

esteve commented May 5, 2015

Copy link
Copy Markdown
Member Author

I've added the as_* versions of the get_value method, so when we reach a consensus I'll just remove the one that less popular. My vote goes for the as_* methods.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

With get_value<> not returning a const reference but a temporary object this won't work I guess?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should we do the same for std::vector<uint8_t>?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Done.

esteve added a commit that referenced this pull request May 5, 2015
esteve merged commit 3b475de into master May 5, 2015
esteve removed the in progress Actively being worked on (Kanban column) label May 5, 2015
esteve deleted the parameters-api-review-sync branch May 5, 2015 16:59
esteve restored the parameters-api-review-sync branch May 5, 2015 17:22
alsora pushed a commit to alsora/rclcpp that referenced this pull request Oct 21, 2020
DensoADAS pushed a commit to DensoADAS/rclcpp that referenced this pull request Aug 5, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL