-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add support for ROS actions #108
Add support for ROS actions #108
Conversation
With "action wrapper types" this means the ROS messages and services that add the `GoalId`, `TimeStamp` or other fields on top of the user defined types for the action. The introduced methods in `IRosActionDefinition` are needed to work around the missing existential type support in C# (dotnet/csharplang#5556).
This uses the base type `IMessage` to get around the cyclic references.
The field access after Interlocked.CompareExchange might not reflect the updated value. Or does it? Anyways this makes it more clear.
44a6ec0
to
3187f5a
Compare
Hi @hoffmann-stefan! Great to see that someone is finally adding actions! I tried to build this in humble with Ubuntu 22.04 and got this: Starting >>> rcldotnet
Starting >>> rosidl_generator_dotnet
Finished <<< rosidl_generator_dotnet [0.60s]
--- stderr: rcldotnet
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args`
(DOTNET_CORE) does not match the name of the calling package (DotNetCore).
This can lead to problems in calling code that expects `find_package`
result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/opt/dependencies_ws/install/share/dotnet_cmake_module/cmake/Modules/dotnet/FindDotNetCore.cmake:37 (find_package_handle_standard_args)
/opt/dependencies_ws/install/share/dotnet_cmake_module/cmake/Modules/FindCSBuild.cmake:20 (find_package)
/opt/dependencies_ws/install/share/dotnet_cmake_module/cmake/Modules/FindDotNETExtra.cmake:15 (find_package)
CMakeLists.txt:20 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
gmake[2]: *** [CMakeFiles/test_messages.dir/build.make:110: CMakeFiles/test_messages] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:193: CMakeFiles/test_messages.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< rcldotnet [5.47s, exited with code 2] Any idea what the issue could be? (edit) Finished <<< rcldotnet [1.75s]
Starting >>> rcldotnet_examples
--- stderr: rcldotnet_examples
gmake[2]: *** [CMakeFiles/rcldotnet_example_action_server.dir/build.make:76: CMakeFiles/rcldotnet_example_action_server] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:279: CMakeFiles/rcldotnet_example_action_server.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/rcldotnet_example_action_client.dir/build.make:76: CMakeFiles/rcldotnet_example_action_client] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:305: CMakeFiles/rcldotnet_example_action_client.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< rcldotnet_examples [4.51s, exited with code 2]
(edit) Haha, ok. I was missing that you need to rebuild the messages also. Starting >>> lifecycle_msgs
--- stderr: builtin_interfaces
/bin/sh: 1: /home/ros/install/share/rosidl_generator_dotnet/cmake/../../../lib/rosidl_generator_dotnet/rosidl_generator_dotnet: Permission denied
gmake[2]: *** [CMakeFiles/builtin_interfaces__dotnet.dir/build.make:93: rosidl_generator_dotnet/builtin_interfaces/msg/duration.cs] Error 126
gmake[1]: *** [CMakeFiles/Makefile2:426: CMakeFiles/builtin_interfaces__dotnet.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< builtin_interfaces [0.19s, exited with code 2] (edit) ros@sam-blade:~/src/src/ros2_dotnet/rosidl_generator_dotnet/bin$ ll
total 12
drwxr-xr-x 2 ros ros 4096 Jun 15 16:32 ./
drwxr-xr-x 6 ros ros 4096 Jun 15 15:50 ../
-rw-r--r-- 1 ros ros 1390 Jun 15 15:50 rosidl_generator_dotnet
ros@sam-blade:~/src/src/ros2_dotnet/rosidl_generator_dotnet/bin$ sudo chmod u+x rosidl_generator_dotnet
ros@sam-blade:~/src/src/ros2_dotnet/rosidl_generator_dotnet/bin$ ./rosidl_generator_dotnet
usage: rosidl_generator_dotnet [-h] --generator-arguments-file GENERATOR_ARGUMENTS_FILE --typesupport-impls TYPESUPPORT_IMPLS
rosidl_generator_dotnet: error: the following arguments are required: --generator-arguments-file, --typesupport-impls Still getting some errors when building
|
Hi @samiamlabs Thanks for checking this out and testing :) Could you try to build this with Also, could you try to delete the build and install folder as well to make a absolutely clean build? Most of those erros tend to go away if you do a complete rebuild. There seem to be some situations where things don't get rebuilt by cmake correclty, haven't figured this out yet though.
I wouldn't try to run this script manually, it is intended to be called from the "IDL pipline" in ament. |
I did not run it manually, it was run by colcon and somehow got a permissions error. I restarted the docker container I was using, and now it seems to work... strange. I can run the rcldotnet_examples action server and client at least. Great work! I'm hoping to be able to use this with Behavior Designer in Unity 3D and finally get a proper behavior tree implementation to use for our robots. A bit of topic, but I made this script for creating a standalone Unity plugin from ros2_dotnet from my fork of the project a while back: https://github.com/samiamlabs/ros2_dotnet/blob/cyclone/rcldotnet_utils/rcldotnet_utils/create_unity_plugin.py |
Thanks!
Haven't done anything with Unity so far, I come from another background. As you said, having some sort of script for this would be nice. I would welcome this contribution :) Could you open a PR for this? Thanks in advance :) |
extracted from #94
implements: #49
This PR adds support for action services and clients.
Example
ActionClient
Note: For this example to work there needs to be an
Thread
/Task
that runsRCLDotnet.Spin()
.ActionServer
Added public API
Interfaces for message generation