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

Revision history [back]

This looks like a question that's more appropriate for StackOverflow - it's a general programming issue.

With that being said: if you're getting an error on line 93, it's because values doesn't contain an element at position i. Attempting to access this location in the vector causes your program to crash because the location doesn't exist in the vector.

Your i variable will loop from 0 to 100, which means it will try 101 vector elements. Ensure that you have at least this many elements in your vector by checking values.size() or printing it to the terminal.

Finally, just as a note, your code contains no way to break out of your loop. It will continue to check the i=100 element over and over until ROS is killed.