0
$\begingroup$

I am developing a project with 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, 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
  • 2
    $\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, 2022 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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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