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

Revision history [back]

click to hide/show revision 1
initial version

This is most likely a Python problem, not a ROS problem.

The start in your callback(msg) method is a different variable. The name is the same, but that variable shadows the start in the global scope. To refer to the global start, add global before it.

This is most likely a Python problem, not a ROS problem.

The start in your callback(msg) method is a different variable. The name is the same, but that variable shadows the start in the global scope. To refer to the global start, add global before it.

See Python Global, Local and Nonlocal variables (random Google search result) for some more explanation.