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
91 stars 22 forks source link

Custom message package osn't adding std_msg reference into csproj #31

Closed tank104 closed 2 years ago

tank104 commented 2 years ago

Hi, I am having real troubles getting std_msgs_assembly.dll referenced in the csproj that is built for my custom_message package.

My setup is this: CMakeLists.txt: ... find_package(ament_cmake REQUIRED) find_package(std_msgs REQUIRED) find_package(rosidl_default_generators REQUIRED) ... rosidl_generate_interfaces(${PROJECT_NAME} ${ANDREW_TEST_MSGS} DEPENDENCIES std_msgs ADD_LINTER_TESTS) ...

package.xml is this: `...

ros_environment std_msgs

...`

But in the output after running colcon in test_assembly_dotnetcore.csproj I get this: `...

...`

I would expect to see std_msgs dll reference there. As right now I get build errors when the csproj is built because std_msg could not be found.

Hopefully I am really not understanding how to set up new custom_messages, and its a quick fix, but I have spent hours trying to understand and get it working.

Deric-W commented 2 years ago

I have the same problem (with geometry_msgs) while building a part of the package created here. My ROS2 version is humble and the output is riddled with the following warning:

SC : warning CS1668: Invalid search path 'lib\um\x64' specified in 'LIB environment variable' -- 'directory does not exist' [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly\ros2_custom_msgs_assembly_dotnetcore.csproj] [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly.vcxproj]

followed by:

C:\dev\ros2-for-unity\build\ros2_custom_msgs\rosidl_generator_cs\ros2_custom_msgs\msg\sphere.cs(31,10): error CS0246: The type or namespace name 'geometry_msgs' could not be found (are you missing a using directive or an assembly reference?) [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly\ros2_custom_msgs_assembly_dotnetcore.csproj] [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly.vcxproj]

I tried copying parts of the CMakeLists.txt of geometry_msgs, but it did not help.

Deric-W commented 2 years ago

I managed to make the build succeed, it seems to be related to ros2-for-unity. I created an Issue there.

pijaro commented 2 years ago

I've also tried to reproduce it on my machine but without success. I tested the tutorial packages as described here, and I'm ending up with a correctly filled csproj file.

build/tutorial_interfaces/tutorial_interfaces_assembly/tutorial_interfaces_assembly_dotnetcore.csproj:

...
  <ItemGroup>
    <Reference Include="/home/pj/ros2cs/install/lib/dotnet/ros2cs_common.dll" /> <Reference Include="/home/pj/ros2cs/install/lib/dotnet/geometry_msgs_assembly.dll" /> <Reference Include="/home/pj/ros2cs/install/lib/dotnet/std_msgs_assembly.dll" /> <Reference Include="/home/pj/ros2cs/install/lib/dotnet/builtin_interfaces_assembly.dll" />
  </ItemGroup>
...

Therefore, could you post a full build log and tell me which versions of ros2cs, Ubuntu, and ROS2 you are using?

tank104 commented 2 years ago

Unfortunately I moved on from ROS2 and just went direct with MAVSDK because it had what I needed.

Sorry!

pijaro commented 2 years ago

Ok, closing then.