# Transform matrix from base to camera and base to lidar

**URL:** <https://forum.hello-robot.com/t/transform-matrix-from-base-to-camera-and-base-to-lidar/285>\
**Category:** Ask\
**Created:** [August 17, 2021, 3:27pm UTC](https://forum.hello-robot.com/t/transform-matrix-from-base-to-camera-and-base-to-lidar/285 "2021-08-17T15:27:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smth](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/smth/32/94_2.png) [@smth](https://forum.hello-robot.com/u/smth)\
**Post date:** [August 17, 2021, 3:27pm UTC](https://forum.hello-robot.com/t/transform-matrix-from-base-to-camera-and-base-to-lidar/285/1 "2021-08-17T15:27:50Z")

</div>

Does anyone have

- the transform matrix from the Head Camera (in 0.0 pitch/yaw) to the robot base
- the transform matrix from the Lidar to the robot base

If you don’t have it at hand, how does one determine what is the center of the robot base?  
I couldn’t find anything off-hand in the docs.

We’re basically trying to transform the RealSense point-cloud into base frame and global frame.

---

<div class="post-metadata">

**Author:** ![smth](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/smth/32/94_2.png) [@smth](https://forum.hello-robot.com/u/smth)\
**Post date:** [August 17, 2021, 6:03pm UTC](https://forum.hello-robot.com/t/transform-matrix-from-base-to-camera-and-base-to-lidar/285/2 "2021-08-17T18:03:53Z")

</div>

We ended up loading the URDF in [PyTransform3D](https://rock-learning.github.io/pytransform3d), setting the joint angles, and getting the transform.

Will publish the code as reference in a bit.

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [August 17, 2021, 6:52pm UTC](https://forum.hello-robot.com/t/transform-matrix-from-base-to-camera-and-base-to-lidar/285/3 "2021-08-17T18:52:29Z")

</div>

Thanks @smth, the PyTransform3D library sounds like a good approach. I was going to suggest the [urdfpy](https://urdfpy.readthedocs.io/en/latest/index.html) library. It includes a URDF parser and can find the [transform for a given joint configuration](https://urdfpy.readthedocs.io/en/latest/examples/index.html#doing-forward-kinematics) to the base link. For those working in ROS, there’s also tf2.

The only other suggestion I have is to use the URDF calibrated for your robot to ensure a good matching between the point cloud and the robot’s geometry.
