RobotecAI / ros2cs

A C# (.Net) implementation of ros2 client library (rcl), enabling communication between ros2 ecosystem and C#/.Net applications such as Unity3D
Apache License 2.0
89 stars 22 forks source link

Add support for services #1

Closed adamdbrw closed 1 year ago

tank104 commented 2 years ago

I would like this (specifically for using MAVROS for mission planning).

Happy to help contribute (strong c# programmer), but I wouldn't know quite where to start..

tank104 commented 2 years ago

(Just as FYI I have managed to work around this by sending Bash Commands from c# for "ros2 service call xxxx")

adamdbrw commented 2 years ago

It seems that you are in luck, since we have a pull request https://github.com/RobotecAI/ros2cs/pull/30 just recently submitted by @miyakoshi-dev. It will undergo a review process but of course you can give it a try at any time.

tank104 commented 2 years ago

Oh wow what timing! Thats great - I will try and test out this week.

tank104 commented 2 years ago

Just trying to work on this now. @miyakoshi-dev do we import service messages somehow as part of the build for this?

miyakoshi-dev commented 2 years ago

@tank104 I have added and tested a new service message in my local environment, but in this PR I have not included that service message. Since you modified ros2_galactic.repos, running should install the example_interfaces. You can check the service functionality in this PR by running client/service added to ros2cs_examples using example_interfaces.

tank104 commented 2 years ago

@miyakoshi-dev I am going to test with mavros service - will let you know how I go.

Some core files have reference to example_interfaces (I have commented in PR). Is this by design?
I am having build issues with it

tank104 commented 2 years ago

With the change to core, I still get the following error building: /home/andrew/ros2cs/src/ros2cs/ros2cs_examples/ROS2Client.cs(21,7): error CS0246: The type or namespace name 'example_interfaces' could not be found (are you missing a using directive or an assembly reference?) [/home/andrew/ros2cs/build/ros2cs_examples/ros2cs_client/ros2cs_client_dotnetcore.csproj]

I can see example_interfaces in src, and it looks to have built successfully in logs too..

(Also not sure what you mean _Since you modified ros2galactic.repos, I didn't modify that file, and all repo are up to latest)

tank104 commented 2 years ago

Apologies for potentially taking this thread slightly offtopic - but after trial and error I found that I needed to change the CMakeList.txt and hardcode example_interfaces_ASSEMBLIES_DLL as per below.

I can't figure out where example_interfaces_ASSEMBLIES_DLL should be set, and why it isn't. Any pointers on this?


set(_assemblies_dep_dlls
     ${ros2cs_common_ASSEMBLIES_DLL}
     ${ros2cs_core_ASSEMBLIES_DLL}
     ${std_msgs_ASSEMBLIES_DLL}
     ${sensor_msgs_ASSEMBLIES_DLL}
     ${builtin_interfaces_ASSEMBLIES_DLL}
#    ${example_interfaces_ASSEMBLIES_DLL}
    "/home/andrew/ros2cs/install/lib/dotnet/example_interfaces_assembly.dll"
)
miyakoshi-dev commented 2 years ago

I used example_interfaces to implement my service. I have confirmed that the build can be done normally with the following procedure. (Limited to galactic) If it seems that it is built in a different procedure, could you try it with the procedure shown?

git clone https://github.com/miyakoshi-dev/ros2cs.git cd ros2cs git checkout service source ../galactic/install/local_setup.bash ★galactic path ./get_repos.sh ./build.sh

tank104 commented 2 years ago

@miyakoshi-dev yup that is what I have done. I don't think its your code though, I think its something in my setup, but I cannot figure out what.

It seems to be example_interfaces_ASSEMBLIES_DLL isn't evaluating, but I don't know where/how its supposed to be setup

pijaro commented 1 year ago

Implemented in #36