# Topics Quiz: Robot move toward the wall successfully, but ranges\[360\] value always return around 2.5m. Please help

**URL:** <https://get-help.theconstruct.ai/t/topics-quiz-robot-move-toward-the-wall-successfully-but-ranges-360-value-always-return-around-2-5m-please-help/1151>\
**Category:** ROS Basics In 5 Days (Python)\
**Tags:** quiz\
**Created:** [October 22, 2019, 11:23pm UTC](https://get-help.theconstruct.ai/t/topics-quiz-robot-move-toward-the-wall-successfully-but-ranges-360-value-always-return-around-2-5m-please-help/1151 "2019-10-22T23:23:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bayodesegun](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/bayodesegun/32/10684_2.png) [@bayodesegun](https://get-help.theconstruct.ai/u/bayodesegun)\
**Post date:** [October 23, 2019, 7:34am UTC](https://get-help.theconstruct.ai/t/topics-quiz-robot-move-toward-the-wall-successfully-but-ranges-360-value-always-return-around-2-5m-please-help/1151/2 "2019-10-23T07:34:52Z")

</div>

Hi @etiennebouthiette,

First of all, welcome to the community!

The error you have described is quite strange, as the value should become smaller as the robot moves towards the wall. Please try the following hints and try again. I suspect hints 1 and 2 may be the culprits here, 2 especially!

1. Remove the `rospy.Rate` object from your program completely - you don’t need it here.

2. Try refining the robot movement logic like this:

```auto
# This snippet ensures that when the robot is close to the wall, linear movement is stopped and
# the robot turns. Otherwise, angular movement (turning) is stopped and linear movement continues
# 1.5 may not be the optimal value, check the actual value when the robot is close to the wall
if msg.ranges[360] < 1.5: 
  pos.angular.z = 0.1
  pos.linear.x = 0.0
else:
  pos.angular.z = 0.0
  pos.linear.x = 0.1

pub.publish(pos)

```

With your current code, linear and angular movement is always present, so I imagine that **the robot might be moving in circles somewhat, instead of moving forward**. Also, by using `+=` for the speed, you’re always increasing it, predisposing the robot to erratic movement.

1. You’re expecting `msg.ranges[360]` to have a value up to `30`, but it really does not get that high in the simulation. Appears to be up to `3.0`.

---

_[View the full topic](https://get-help.theconstruct.ai/t/topics-quiz-robot-move-toward-the-wall-successfully-but-ranges-360-value-always-return-around-2-5m-please-help/1151)._
