This code publishes odom information using the difference between the previous tf and the current tf in a situation where tf is given at every time step (in 2D).
Ubuntu 20.04 ROS Noetic
>> cd ~/catkin_ws/src
>> git clone ~
>> cd ..
>> catkin_make
>> source ./devel/setup.bash
>> rosrun tf2odom tf2odom
Subscribe: /tf
Publish : /odom
Unit: position[m],velocity[m/s],angular rate[rad/s]