# computing odometry, creating base controller

I am building my own custom robot and am finding it difficult to interface it to ROS (standard odometry and cmd_vel motor control). All I need is to publish odometry, based on the encoder ticks, and translate the twist messages (subscribed) into motor control signals, to be used with Navigation stacks. I found this tutorial - Publish odometry. But it only explains half of the problem. They insert vx, vy and vth values to generate fake odometry of a robot driving in circles. I am trying to calculate real odometry. Can someone help with the code for calculating vx, vy and vth from actual encoder ticks? I will measure the wheel diameter, the amount of ticks per revolution, and the distance between the wheels. But not sure how to implement that in calculating the vx, vy and vth. Intuitively it seems like a simple task, and there are pieces of code on odometry all over ROS tutorials/documentation. But I just can't seem to put it all together. Later, I will also need to find a way to convert geometry/Twist messages to motor power signal. I would really appreciate any help, and believe it will help others in the future.