Skip to content
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

service complete version commit #30

Closed
wants to merge 6 commits into from

Conversation

miyakoshi-dev
Copy link
Contributor

@adamdbrw
I have implemented the service.
When you have time, could you please check it for me?

@miyakoshi-dev
Copy link
Contributor Author

Now that we have completed the implementation of the service, we have closed this draft PR and created a new PR.

@miyakoshi-dev
Copy link
Contributor Author

I closed this by mistake, so I will reopen it.

@adamdbrw
Copy link
Member

adamdbrw commented Sep 9, 2022

Thank you for the contribution, it would prove very valuable indeed!
We will review it with @pijaro.

@adamdbrw
Copy link
Member

@pijaro if you could, please review today

@adamdbrw adamdbrw mentioned this pull request Sep 13, 2022
@pijaro
Copy link
Collaborator

pijaro commented Sep 13, 2022

@miyakoshi-dev Thanks for the nice PR! I'm currently looking into the code. I will finish my review tomorrow 👍

/// <summary> Service a message </summary>
/// <see cref="IService.SendAndRecv"/>
public IntPtr SendAndRecv(T msg)
///public long SendAndRecv(T msg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we can remove unnecessary devel comments 👍

/// <description> Services are created through INode.CreateClient </description>
public class Client<T>: IClient<T> where T : Message, new ()
{
public string Topic { get { return topic; } }
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use some code formatting here 😃 Please group private/public and explicitly denote the accessibility of the members.


/// send request
Utils.CheckReturnEnum(NativeRcl.rcl_send_request(ref serviceHandle, msgInternals.Handle, ref sequence_number));
System.Threading.Thread.Sleep(1000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is a synchronous send and receive, then the 1sec wait is not enough for most use cases. Maybe some wait loop here?

Additionally, I think that async send and receive would make more sense - but this may be added later 👍

@@ -231,6 +247,11 @@ public static void SpinOnce(List<INode> nodes, double timeoutSec = 0.1)
{
subscription.TakeMessage();
}
///WaitSet.Wait(global_context, allServices, timeoutSec);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Devel comment to remove

/// <description> Can only be called in an initialized Ros2cs state. </description>
/// <param name="topic"> Topic for the service. Naming restrictions of ros2 apply and violation results in an exception </param>
/// <param name="qos"> Quality of Service settings. Not passing this parameter will result in default settings </param>
/// <returns> Service for the topic, which can be used to service messages </returns>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Returns client (copy paste error 😃 )

/// <returns> Service for the topic, which can be used to service messages </returns>
Client<T> CreateClient<T>(string topic, QualityOfServiceProfile qos = null) where T : Message, new();

/// <summary> Remove a service </summary>
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Remove a client"

@@ -179,6 +297,9 @@ internal static PublishType
"rcl_publish"),
typeof(PublishType));


Copy link
Collaborator

Choose a reason for hiding this comment

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

Unnecessary lines

message(STATUS "Generating C# code for ROS interfaces ${_generated_msg_cs_files}")

set(ros2_distro "$ENV{ROS_DISTRO}")
if(ros2_distro STREQUAL "foxy" OR ros2_distro STREQUAL "galactic")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if that is still the case, but it was important for Humble setups

Did you try this PR with all supported ROS2 versions? (foxy, galactic, humble)

My quick test on humble failed to build. Most probably, this is one of the causes.

@@ -223,15 +235,116 @@ foreach(_generated_msg_c_ts_file ${_generated_msg_c_ts_files})
${PROJECT_NAME}__rosidl_generator_c
)

set(ros2_distro "$ENV{ROS_DISTRO}")
rosidl_target_interfaces(${_target_name}
Copy link
Collaborator

Choose a reason for hiding this comment

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

rosidl_target_interfaces is deprecated since Humble: https://docs.ros.org/en/humble/Releases/Release-Humble-Hawksbill.html#deprecation-of-rosidl-target-interfaces

It is a good idea to keep humble and up in check.


if(ros2_distro STREQUAL "humble" OR ros2_distro STREQUAL "rolling")
rosidl_get_typesupport_target(c_typesupport_target "${PROJECT_NAME}" "rosidl_typesupport_c")
Copy link
Collaborator

Choose a reason for hiding this comment

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

@pijaro
Copy link
Collaborator

pijaro commented Sep 14, 2022

I've added some feedback 👍 Thanks again for such an important PR 👍

I also did a quick test on galactic and humble (u20) - it worked for galactic but failed for humble. It would be nice to keep the compatibility between ROS2 releases as well.

@miyakoshi-dev
Copy link
Contributor Author

Thank you for your review.
I will reflect your comments when I have time.
Currently, it only supports galactic, so humble has not been verified.

@miyakoshi-dev
Copy link
Contributor Author

Addressed non-Humble related review comments.

   ・Improve typing of service response
   ・remove unused references to example_interfaces
(2) Finished checking with humble/galactic under ubuntu/windows environment
@miyakoshi-dev
Copy link
Contributor Author

@pijaro @adamdbrw
hello
It's been a while, but now it supports humble.
In addition to humble support, it supports the PR I received on my github.
I have confirmed that the service works on humble/galactic on ubuntu/windows.

@pijaro
Copy link
Collaborator

pijaro commented Jan 23, 2023

I will close this PR since the work is being continued on #36 by @Deric-W 👍
@miyakoshi-dev let's continue our work there 🏅

@pijaro pijaro closed this Jan 23, 2023
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.

None yet

3 participants