Robot does not move, exercise 4.1

I am doing section four of the course Python for Robotics right now.
So far everything was fine. When I try to run exercise 4.1 (or any othe exercise which includes moving the robot ) the robot is not moving. When i stop the process with stgr+c following text appears on the command window
"
File “test_functions1.py”, line 12, in
move_x_seconds(5)
File “test_functions1.py”, line 7, in move_x_seconds
robotcontrol.move_straight()
File “/home/simulations/public_sim_ws/src/all/ros_basics_examples/python_course_class/robot_control_class.py”, line 83, in move_straight
self.publish_once_in_cmd_vel()
File “/home/simulations/public_sim_ws/src/all/ros_basics_examples/python_course_class/robot_control_class.py”, line 38, in publish_once_in_cmd_vel
self.rate.sleep()
File “/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py”, line 103, in sleep
sleep(self._remaining(curr_time))
File “/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/timer.py”, line 166, in sleep
raise rospy.exceptions.ROSInterruptException(“ROS shutdown request”)
rospy.exceptions.ROSInterruptException: ROS shutdown request
user:~/catkin_ws/src/robot_control$"

Hello @valerie.mahler,

please post your code so we can figure out what is going on.

1 Like

Hey @simon.steinmann91,
Here is the code you asked for:

from robot_control_class import RobotControl
import time

robotcontrol = RobotControl()

def move_x_seconds(secs):
    robotcontrol.move_straight()
    time.sleep(secs)
    robotcontrol.stop_robot()


move_x_seconds(5)

thanks for your help

Hey @valerie.mahler,

I apologize for this error - there seems to be a problem with the simulation in that chapter. We will work on that as soon as possible and will let you know once it’s fixed.

In the meantime, could you please test your code with the simulation of the previous chapter so this does not block your progress? Thanks for your understanding.


By the way, welcome to the community!

Hi @bayodesegun,
no worries, and thanks for your answer!

I tried just moving the robot forward in all units. In unit 4 and 5 the problem occurs.
In all other Units it works :slight_smile:

2 Likes

Hello @valerie.mahler,

I’ve already fixed this issue, so you should be able to move the robot without problems. If you are not, please let me know.

Best,

1 Like

Hi, it seems there is still an issue with the simulation for 4 and 5. However, the code works fine in 3.

1 Like

Hi @anabell,

Thanks for the feedback. Let’s look into that and get back to you.


By the way, welcome to the Community!

Hi Bayodesegun
I have the same issue - nice to know I’m not the only one :slight_smile:
If I do:
user:~$ python -V
I get Python 2.7.12

Are we supposed to activate Python 3? I can see that is mentioned in this post:
Python 2.7 instead of python 3 in terminal.
After this I get this:
python -V
Python 3.5.2
, but the same result when running the code.

1 Like

Hi @mobe,

Thanks for letting us know. Welcome to the Community!

If you are referring to the problem of robot not moving in chapters 4 and 5, the problem is not with the python version but those simulations. We’re working on that and will let you know once it’s fixed.