geometry_msgs/Point() access in subscriber

hi im just wodering if i use this line “self.publisher.publish(location)” to publish the location of an object where location is of type Point() and how would i be able to access that streamed information in my subscriber code ?

another question when i use the term msg is it somewhat of a print statemenet in a way .

any help with these questions would be great thank .
many thanks,
Kieran

The topic in question here is the key. You create a publisher of type Point to this topic, and also a subscriber of type Point to the same topic. Whenever you publish to the topic, the subscriber gets the message you publish in the subscriber callback.

I’m sorry I don’t understand what you mean here.

okay the first part makes sense. soo if i needed to acces the x,y,z points in the subscriber would i use something like msg.X,msg.Y,msg.Z ?

Best way to find out is to print the whole message first and observe its attributes.
You can also use:

rosmsg info Point

well i have that part working so im using computer vision to detect a person in a room then using ros2 to send taht position data into unity to spawn a person in that position but the trouble im having is accessing that data in unity inside my subscriber node . i want to be able to retrieve that prined out data and then spawn a person model into that position

As I have not worked with Unity (we are based on Gazebo), I may not be of much help here, but what you need to do is to somehow get Unity to read the data you have on a specific ros2 topic, to which you are publishing the position data. You may not even need to use a subscriber.

The first question you need to answer properly, how can I send some data to Unity? Can Unity read from a topic directly? Then you can take it from there.