# Zed2i robot integration in ros2

**URL:** <https://community.stereolabs.com/t/zed2i-robot-integration-in-ros2/4241>\
**Category:** ROS2\
**Created:** [December 25, 2023, 8:48pm UTC](https://community.stereolabs.com/t/zed2i-robot-integration-in-ros2/4241 "2023-12-25T20:48:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreacelani](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@andreacelani](https://community.stereolabs.com/u/andreacelani)\
**Post date:** [December 25, 2023, 8:48pm UTC](https://community.stereolabs.com/t/zed2i-robot-integration-in-ros2/4241/1 "2023-12-25T20:48:43Z")

</div>

Hi,  
I’m integrating a Zed2i camera into a ROS2 environment robot. I would like to use the Positional Tracking engine fully (visual-inertial odometry + mapping with loop closure).  
According to this: [ZED integration on a Robot - Stereolabs](https://www.stereolabs.com/docs/ros2/ros2-robot-integration) the `zed_camera_link` must be the root frame of the robot. Basically the base\_link is a child of zed\_camera\_link. Then I should put the robot in the right position so I set the ‘initial\_base\_pose’ parameter of common.yaml to the position of the camera (otherwise the robot is below the floor)  
Below an example of the camera urdf:

```auto
 <joint name="$(arg camera_name)_joint" type="fixed">
      <parent link="$(arg camera_name)_camera_link"/>
      <child link="base_link"/>
      <origin
        xyz="-0.7 0.0 -1.00"
        rpy="0 0 0"
      />
    </joint>

```

and the related common.yaml parameter:  
`initial_base_pose: [0.7, 0.0, 1.0, 0.0, 0.0, 0.0] # Initial position of the `camera_link` frame in the map -> [X, Y, Z, R, P, Y]`

the odom and pose topics, if I understood in the right way, are related to zed\_camera\_link and they are not related (directly) to base\_link.

This architecture is a bit uncomfortable since the “main” link from a navigation point of view is the base\_link (the “pivot” of the robot)

Actually I see a different approach in zed\_wrapper for ROS1 . According to this: [I'd like to change initial pose map to base\_link - #4 by Myzhar](https://community.stereolabs.com/t/id-like-to-change-initial-pose-map-to-base-link/220/4)

it’s possible to pass the position of the camera center as arguments in the main launch file zed2.launch keeping the TF chain as it should be: `map` → `odom` → `base_link`

Should I do it in ROS2 the same as in ROS1? Change the urdf of the camera and put zed\_camera\_link superposed to base\_link?

Thank you

---

<div class="post-metadata">

**Author:** ![Myzhar](https://community.stereolabs.com/user_avatar/community.stereolabs.com/myzhar/32/11_2.png) [@Myzhar](https://community.stereolabs.com/u/Myzhar)\
**Post date:** [December 26, 2023, 10:37am UTC](https://community.stereolabs.com/t/zed2i-robot-integration-in-ros2/4241/2 "2023-12-26T10:37:12Z")

</div>

Hi @andreacelani  
welcome to the Stereolabs community.

We recently introduced this behavior in the ROS 2 wrapper to simplify the behavior and improve the performance when using the positional tracking module of the ZED SDK and no other localization/odometry sources.

We can consider adding a new parameter to provide the robot’s pose in the `base_link` frame (or any other robot frame).  
This can easily achieved by using the TF2 tools.

[Please add a “feature request” issue to GitHub so we can track it](https://github.com/stereolabs/zed-ros2-wrapper/issues/new/choose).

---

<div class="post-metadata">

**Author:** ![andreacelani](https://community.stereolabs.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@andreacelani](https://community.stereolabs.com/u/andreacelani)\
**Post date:** [December 26, 2023, 12:26pm UTC](https://community.stereolabs.com/t/zed2i-robot-integration-in-ros2/4241/3 "2023-12-26T12:26:59Z")

</div>

Ok thank you.  
I tried to do it on my own and it worked, I mean “porting” the ROS1 implementation into ROS2 launch/urdf.  
My main concern about it is if it was intended to be used like that and from your answer it seems to be.
