## Table of Contents

## Introduction

When we bring a robot into an indoor or outdoor environment, it needs to understand three basic things about the environment:

- What is my body structure and motion possibilities
- Where am I and what is my position and orientation (pose)?
- Position and orientation of all other things in the environment .

The robot builds this pose understanding with the help of transforms. Not only that , robots also understand their own body structure, which consists of components and sensors, with the help of transforms. Transforms are mathematical operations used to convert coordinates and orientations from one reference frame to another. They are fundamental in robotics because robots often operate in environments where they need to understand and interact with various objects and coordinate systems.

## Starting Point

- What are Frames and homogeneous Transformation Matrix
- How Robot structures is created with Transforms
- Why we nee transforms with sensors?

## Learning Outcomes

- Calculate relations between objects of environment with Transforsm
- Mathematical foundations of transforms
- Transform sensor data to the robot’s coordinate system.

### What are transforms ?

The word itself means the change between something , in robotics context it is time based change of pose. For example

- We define robot motion in simple words that “
*my robot moved forward*” but in transforms terms it is explained with more detailed- My robot’s transform is x:0 , y:0 , z:0 at Time 10 seconds . It is translated in X and transform became robot is at x:1, y:0 , z:0 on time 13 seconds.

- In simple explanation we might call that our robot just took a turn but with transform we can explain it liek this,
- My robot’s heading is 0 radians along Y axis at time 3 seconds . It did rotation in heading and its transform became +1.5 radians along Y axis at time 8 seconds

### Basic Concepts

#### Frames

First jargon of transforms is a frame which in robotics is a coordinate system used to define the position and orientation of an object. Each frame has its own origin and axes, which can be translated and rotated relative to other frames. *Chain of frame *is created with the help of parent child relationships. For example

- World ( parent to base ) -> Base ( child to world and parent to wheel ) -> Wheel ( child to base and parent to wheel sensor ) -> Wheel sensor ( child to wheel … )

A frame of reference, or simply a frame, is a coordinate system that defines the position and orientation of objects in space. In robotics, multiple frames are used to represent the positions of different parts of the robot and the objects it interacts with.

#### Order of Transforms

The order in which transforms are applied is crucial. For example, rotating a frame before translating it yields a different result than translating it before rotating it. Understanding and correctly applying the order of transformations is key to accurate robotic motion and environment repreentation .

#### Homogeneous Co Ordinates and Matrix Multiplications

Transforms are often represented as matrices, and the process of applying a transform involves matrix multiplication. This operation combines multiple transformations into a single matrix, which can then be applied to a point or vector.The mathematical foundation of transforms involves linear algebra and matrix operations. Understanding how to manipulate matrices and apply them to coordinates is essential for working with transforms in robotics.

Homogeneous coordinates are used to represent points in space in a way that allows both translation and rotation to be applied using matrix multiplication. This simplifies the mathematics of transforms and makes it easier to combine multiple transformations.The homogeneous transformation matrix is a powerful tool that combines rotation and translation into a single matrix operation, making it easier to convert coordinates between frames.

### Practicing Robotics Applications through ROS2

#### Constructing a Mobile Robot with Transforms ( links and joints )

Designing and constructing a robot involves defining the relative positions and orientations of its parts using transforms. This ensures that the robot can move and operate as intended, with each part interacting correctly with the others. In a robot, we have multiple components; some are moving and some are static . With a file called URDF ( unified robotics description format), we define with components as having static or dynamic transforms. There are two jargons that you need to understand

**Link**: A visual and inertial body**Joint**: connection type between different frames and links.

As an example, we can simply create robot structures with these transforms and later add visual elements to represent a robot body. Transforms are created in the form of trees; for example, in our mobile robot, you can understand the tree as. The base link is the parent of all other links on our robot. URDF generates the following tree:

**Static transformations**remain constant over time. They define the fixed spatial relationship between two frames. For example, the relationship between a robot’s base frame and its sensors (e.g., a camera or LIDAR) is usually a static transform since the sensor is typically mounted at a fixed position on the robot.

**Dynamic transformations**change over time. They define the spatial relationship between two frames that are in motion relative to each other. For instance, the position of a robot’s wheels relative to the base frame changes as the wheels rotate, making this a dynamic transformation.

All transforms in a robotic system are typically referenced to a common frame, often called the “world” frame. This ensures a consistent reference for all transformations, allowing the robot to accurately understand its position and orientation in the environment.

#### Sensor Data Interpretation

In robotics, we use sensors like cameras and distance sensors to understand the world around robots. Each sensor has its own way of seeing things, like a camera seeing a scene from its point of view. This “point of view” is what we call the sensor’s frame of reference or coordinate system. Imagine a robot moving around. It also has its own coordinate system, kind of like its own map of where it is and how it’s oriented for example . X:10 , Y:20, Z:0 . So what the camera sensor is showing us through the video is that it is located at X:10 , Y:20 Z:0.5, where this 0.5 is where sensor is mounted or in transform, we call camera sensor transform

We can observe below that the robot camera is looking forward and the obstacle is on the left. With robot transformation, we will get more information than just obstacle presence.

If we have our camera transformed along the Z axis in rotation and looking towards the obstacle, we would say that obstacle is in front of our robot. **So this incorrect transformation will cause decision-making algorithmic failures.**

Robot performs translation transform in X axis . Without sensor data to robot transformation, we would say that there is no obstacle but with robot sensor data to robot transformation,** we can say At x = 0 and x = 2, we do not have obstacles**

When we talk about transforms, we’re talking about a way to help the robot understand what the sensor sees in relation to where the robot is. For example, if a sensor is mounted on top of a robot, it might “see” things from a higher position than the robot’s base. So, we use a transform to adjust the sensor’s data to match the robot’s perspective. For example

## Summary

Transforms are a fundamental concept in robotics, enabling robots to understand and interact with their environment. They allow robots to convert coordinates and orientations from one reference frame to another, which is essential for tasks like navigation, manipulation, and sensing.

- Transforms help robots understand their own position and orientation relative to their environment, as well as the positions of objects around them.
- Frames are used to define the coordinate systems of different parts of the robot and the objects it interacts with.
- Homogeneous transformation matrices combine rotation and translation into a single matrix operation, simplifying the conversion of coordinates between frames.
- The order of transformations is crucial, as applying them in the wrong order can lead to incorrect results.
- Transforms play a critical role in robot localization, sensor data interpretation, and overall robotic motion and interaction.

The repository that contains the respective source code is: **Repository Link**

## FAQ Section

**What are transforms, and why does robotics depend on them?**Transforms are mathematical operations that convert coordinates and orientations from one reference frame to another. They are essential in robotics for navigation, manipulation, and sensing, allowing robots to understand their position and interact with their environment.

**What is a frame of reference in robotics?**A frame of reference is a coordinate system used to define the position and orientation of objects. In robotics, frames are used to represent the positions of different parts of the robot and the objects it interacts with.

**How Do Homogeneous Transformation Matrices Work?**Homogeneous transformation matrices combine rotation and translation into a single matrix operation, making it easier to convert coordinates between frames. They are a key tool in the application of transforms in robotics.

**Why is the order of transformations important?**The order of transformations (rotation vs. translation) is crucial because it affects the final position and orientation of the object being transformed. Applying transformations in the wrong order can lead to incorrect results.

**What are common mistakes in matrix multiplication?**Common mistakes in matrix multiplication include incorrect ordering of operations and arithmetic errors, which can lead to incorrect transformations and unpredictable robot behaviour.