RobotecAI/ros2-for-unity

Error on unity side when executing custom message in ros2-for-unity

izakisyoutarou opened this issue · 3 comments

Hi, I tried to run a custom message in ros2-for-unity, but an error occurred on the untiy side.
It says in how to create a custom message that I can do it by dragging and dropping files, but do I need to rewrite the files such as ROS2TalkerExample.cs?
I would like to know how to publish a custom message.

Error on the untiy side
Assets/Ros2ForUnity/Scripts/ROS2TalkerExample.cs(28,48): error CS0426: The type name 'String' does not exist in the type 'TwoInts'

The custom message file you added
injection_interface_msg
my_messages

injection_interface_msg.zip
my_messages.zip
asset.zip

Best regards.

pijaro commented

Hello,

No, you do not have to rewrite any files to build and use your custom messages.

The error you describing doesn't look like connected with custom messages. Did this error happen after you modified the ROS2TalkerExample.cs script or before any modifications?

TwoInts type is connected with services (ROS2ServiceExample.cs), therefore it should not be a part of a talker example (topic publish example).

Thank you. I was able to solve the problem, but when I tried to run the program on the untiy side, I got an error on the unity side. I would like to know how to deal with this problem. Thank you very much.
RuntimeError: type support not from this implementation, at /tmp/binarydeb/ros-foxy-rmw-fastrtps-cpp-1.3.1/src/publisher.cpp:86, at /tmp/ binarydeb/ros-foxy-rcl-1.1.14/src/rcl/publisher.c:180
ROS2.Utils.CheckReturnEnum (System.Int32 ret) (at <680ec49a722e41208641c44cc0cd291a>:0)
ROS2.Publisher`1[T]. .ctor (System.String pubTopic, ROS2.Node node, ROS2.QualityOfServiceProfile qos) (at <680ec49a722e41208641c44cc0cd291a>:0)
ROS2.Node.CreatePublisher[T] (System.String topic, ROS2.QualityOfServiceProfile qos) (at <680ec49a722e41208641c44cc0cd291a>:0)
ROS2.ROS2Node.CreatePublisher[T] (System.String topicName, ROS2.QualityOfServiceProfile qos) (at Assets/Ros2ForUnity/Scripts/ROS2Node.cs :75)
ROS2.ROS2TalkerExample.Update () (at Assets/Ros2ForUnity/Scripts/ROS2TalkerExample.cs:43)

pijaro commented

Maybe the fastdds RMW was missing during the compilation?

Try installing it sudo apt install ros-foxy-rmw-fastrtps-cpp and clean recompile the Ros2ForUnity.

I don't guarantee it will work, since we don't support foxy anymore.