# Reset odom to a different coordinate system

I am running a robot which publishes odom. In one of my application, I need to reset the odom to to a certain position at a particular moment. Since I could not change the original odom, I will write another ROS node, which listens to odom, but publishes a new message in odom format. My application will use the new odom message

For example, when the robot starts, its odom is x=0, y=0, yaw=0 (this would be quaternion in odom). Then the robot moved to a certain location, x = x1, y=y1, yaw = a1. At this moment, my new node will start to publish new odom message. The initial message published by my node will be x=X1, y=Y1, ywa=A1. As the robot continues to move, my node will read the original odom, x=x2, y=y2, yaw=a2 and publish new odom message x=X2, y=Y2, yaw=A2...

x1, y1, a1, x2, y2, a2, X1, Y1, A1 are all known, but I am not sure how to calculate X2, Y2, A2. And I do not think the fomular below are correct:

```
X2 = X1 - x1 + x2
Y2 = Y1 - y1 + y2
A2 = A1 - a1 + a2
```

Can anyone help?