0
$\begingroup$

I am developing a project with https://github.com/ms-iot/ros_msft_mrtk and would like to send simple messages via Ros2 to Unity or then to the Hololens2. Unfortunately, I don't understand Ros2's communication. I use the SubscriptionExample https://github.com/ms-iot/ros_msft_mrtk/blob/master/SampleProject/Assets/Scripts/Examples/SubscriptionExample.cs, added it to a GameObject and now want to display sented messages in a text field in Unity. That was my attempt:enter image description here

I get the error: Cannot implicitly convert type 'std_msgs.msg.String' to 'string'. How can I store a received std_msgs.msg.String in a string to output it in Unity and later on the HoloLens?

$\endgroup$
1
  • 1
    $\begingroup$ Welcome to Robotics luzylulilu. Please don't post screenshots of code. If possible, copy and paste the text. Images aren't searchable. $\endgroup$
    – Ben
    Nov 23 at 14:30

1 Answer 1

0
$\begingroup$

From the tutorial that you linked. The string value that you want is in the data field of the message msg.Data not the message named std_msgs/String

You can see the message definition here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.