# Extract linear velocity

Greetings, dear community! I was wondering if you could help with some questions. I'm a college student and a beginner at using ROS, and right now I'm trying to implement a trajectory tracking algorithm for a differential robot. I'm using as a base a open model Gazebo simulation available on https://docs.neobotix.de/display/ROSS..., and I wrote my nodes for the algorithm. The problem that I'm facing right now is I don't know from which topic of the simulation I should take the reading of the wheels previous velocities needed for the program. The last attempt I did was to subscribe to the joint topic to get the wheels angular displacement to obtain the wheel angular velocity and multiply the result by the wheel radius, and get in this way the wheel previous linear velocity. But the robot didn't performance as I was expecting. The work I've done so far can be found on https://gitlab.com/ga_07/electrical-p..., inside my_simulation directory. I will appreciate any help you can give me!

What did you expect and what did you get? Instead of describing your approach can you please show us (i.e., paste the relevant code directly into your question)

enter code here

Sure! Here's a part of my code in which I have the question. I'm trying to get the linear velocity from each wheel (that's what I was expecting), so I tried a subscription to joint_state topic to obtain the wheel displacement measured on radians. Using those data, I calculated the angular velocity and then multiply it by wheel radius to finally have the linear velocity. I'm not sure if this is a correct way to get those values and I think this could be one of the mistakes on my simulation. I'll be thankful for any advice or help you can give me