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

Revision history [back]

The problem is that your member variable is declared static (why?).

You need to initialize a static member variable in the .cpp file, if you need that. See this SO question and maybe have a look at what static member variables are used for and how they are used here.

I suggest to NOT make this member variable static. In this use case this makes no sense as all instances of the UltrasonicSensors class would share the same variable and thus overwrite it. I guess this is not the intended behavior here.