ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The problem is that you do not properly initalize the random number generator with a seed. See e.g. http://www.cplusplus.com/reference/cstdlib/srand/ for an explanation. You do have the srand call in there already, but commented out. Thus, this program will always produce the same "random" values.

Depending on how you start the pubvel node, you should probably initialize them differently. See e.g. this stackoverflow discussion on how to initialize it differently.

Or you could use the Boost Random Library which afaik doesn't have this problems.