I am presently doing a robotics project. I am using USARSIM (Urban Search and Rescue Simulation) to spawn a robot. I am trying to create different behaviors, like:

  • goal following behavior;
  • obstacle avoidance behavior, and;
  • wall following behavior for my robot.

I first generate the robots in USARSIM. Then I specify a goal location to the robot and provide it with a speed. The robot then moves to the goal location at the specified speed. USARSIM provides me the (x, y, z) coordinates of the vehicle at every time stamp. Based on the the coordinates received, I am trying to calculate the instantaneous speed of the robot at every time stamp. The instantaneous speed graph is fluctuating a lot.

In a specific case, I am providing the robot with 0.2 m/s. The velocity profile is shown below. I am unable to understand the reason behind it.

The velocity profile of my robot

Here are some observations that I have made.

  1. As I increase the speed of the robot, the variations are decreasing.
  2. Suppose, I provide a straight trajectory to the robot, it doesn't follow the straight trajectory. Does it explain why my velocity profile is fluctuating a lot ?

Graph of "Provided trajectory" versus "Followed trajectory"

Please let me know if any one can provide me a possible explanation for the variance in my velocity profile.

  • 1
    $\begingroup$ I assume you use finite differencing for the velocity, which is very sensitive to errors in the position. You could improve it with a low-pass-filter. $\endgroup$
    – fibonatic
    May 14, 2016 at 10:23

1 Answer 1


There can be many reasons for the fluctuating velocity.

The most commons is errors due to the finite differences method that I assume you are using.

If the system is not real time, the interrupt when you measure the distance might be sometimes later sometimes earlier then expected. Since the velocity you ploted is always below the target velocity and never above...there might be a nother problem in your case.

I do not know the simulation system you mentioned, but if it is not a real-time simulation system there is a possiblity that the simulation is tardy. Events in simulation happen later then in your computer clock. 1 second of simulation takes 1.2 seconds to calculate for example. If you use a real-time clock to get the interrupts and use that time to calculate the velocity, you think you are at simulation time 1 second but you are actually at simulation time 0.85 seconds, so the distance that should be covered in this time was not yet covered hence you get a lower velocity. This would also mean that your velocity should slowly drift downwards, which is not happening.

If you do not use a fixed time solver for the simulation, it might be that sometimes you are blow the simulation time sometimes you are "catching up".

It might very well be a combination of the above.

These are just guesses.

Are you using the time as a fixed interrupt or do you interrogate the simulation environment for the simulation time?

  • $\begingroup$ It is true that I am using finite difference method for calculating the instantaneous speed of the vehicle. The simulation environment provides the (x,y) coordinates of the vehicle at a frequency of 10 Hz. Though if one observes the time stamps, the difference is not exactly 100 milliseconds. It fluctuates between 85 and 100 milliseconds. One interesting point that you mentioned is that the vehicle is not achieving the maximum speed that is provided. What do you think could be the reason for this? Regarding the trajectory of the vehicle, could you provide a specific reason for why is it deviat $\endgroup$ May 17, 2016 at 18:58
  • $\begingroup$ Is the ground completle flat? Maybe you have movement in the z direction as well and the overall speed vector is 0.2 m/s $\endgroup$
    – 50k4
    May 19, 2016 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.