You initialized goal, but not goal_pose or pose at the top. If you call turtleWalk() before any of your subscribers have had a chance to run, then those variables will still be undefined. I'd say you should either define them with a default value, or ensure your callbacks have run before calling turtleWalk
You initialized goal, but not goal_pose or pose at the top. If you call turtleWalk() before any of your subscribers have had a chance to run, then those variables will still be undefined. I'd say you should either define them with a default value, or ensure your callbacks have run before calling turtleWalkturtleWalk().