Robot not stopping

I cant see why the robot is not stopping moving


Thanks for your help

Hi @info2016frei,

It seems you are doing the topics_quiz (or a similar exercise). Here are some hints for you:

  • When moving the robot initially, set move.angular.z to zero. Only set it to non-zero when your robot is close to the wall and needs to turn right/left. We expect that the robot will move towards the wall at first, without turning. Imagine that you are driving the robot…you would go straight first and then turn only when you get close, right?
  • You don’t need to publish to move.linear.z at all; it’s not needed here. Only move.linear.x (forward) and move.angular.z (turn) are needed.
  • It’s better to put the whole of your motion logic in the callback so that the robot moves forward or turns based on feedback from the sensor.
  • When you need to turn the robot, better to set move.linear.x=0. In other words, while linear.x is non-zero, angular.z should be zero and vice-versa.
  • Inspect the values of the ranges array; I don’t think you will get up to 30; they seem btw 1.0-3.0, so you can take 3.0 as your 30.
  • We are not expecting you to stop the robot completely for the quiz, as stopping it might affect the grading. The robot should keep going after turning and should no longer detect the wall. It’s natural to want to stop the robot at some point, but don’t worry too much about that for now.

Thank you very much for your help

1 Like

You’re welcome, I updated the response to make it clearer.