Set detected object based on world reference frame

Hello,
After running the launch file

roslaunch zed_wrapper zed2.launch

I get the published objects data from the topic /zed2/zed_node/obj_det/objects (after setting the parameters od_enabled=True in the zed_wrapper/params/zed2.yaml) and it sure gives the detected objects position in the world coordinate frame as the default. However, those position are based on camera reference frame.

Since my zed2 camera is attached to the robot that moves in the world, i need the detected object position based on world reference frame.

In python code, you can specify like this to set it to the reference frame world

runtime_parameters = sl.RuntimeParameters()
runtime_parameters.measure3D_reference_frame = sl.REFERENCE_FRAME.WORLD

then you can just use the runtime parameters in the grab function as follows:

zed.grab(runtime_parameters)

But im using the zed2 node which publishes the data based on the parameters of the .yaml files.

My question is, where to specify such parameter? I dont see any parameter which corresponds to that in the zed2.yaml and common.yaml files.

any help is very much appreciated. Thanks!

Hi Krisna,
object positions are in the world (map) reference frame with the origin in the starting position of the robot, they are not relative to the camera frame.

Hi,
But why are the positions of the detected object changes when I move the camera? Even though the object did not move.

I created a ROS marker object, set the header.frame_id to map, and assign the points of it with the detected object position (in this case person) by the camera.

In RViz, the marker points move as if the object are getting closer to the camera, but what’s happening is the other way around, where the one that actually move is the camera that is getting closer to the object.

@Krisna please provide more information (a video could be useful for example) because what you describe is not clear.

@Krisna sorry, my fault. The position of the objects is relative to the left camera sensor frame:

you can obtain the position of the objects in the map frame by using TF, something like this:

Tutorials and doc:
http://wiki.ros.org/tf/Overview/Using%20Published%20Transforms
http://wiki.ros.org/tf/Tutorials/Writing%20a%20tf%20listener%20(C%2B%2B)