# Making a robot stop after a certain amount of time - Hello Robot Tutorial

This is not a bug report or anything but more of a misunderstanding of the library functions probably…

So, I was doing the Hello Robot Tutorial and I wanted to try the extra practices under point 4.4. However, when I use the following code in the ‘send_robot_actions’ function to make the robot stop, it won’t stop:

``````    def send_robot_actions(self, step_size):
# Every articulation controller has apply_action method
# which takes in ArticulationAction with joint_positions, joint_efforts and joint_velocities
# as optional args. It accepts numpy arrays of floats OR lists of floats and None
# None means that nothing is applied to this dof index in this step
# ALTERNATIVELY, same method is called from self._jetbot.apply_action(...)
if(self._time >= 5):
return
self._jetbot_articulation_controller.apply_action(ArticulationAction(joint_positions=None,
joint_efforts=None,
joint_velocities=5 * np.array([-1, -1])))
self._time += step_size
print(self._time)
return
``````

self._time is defined in ‘setup_post_load’, and the print(self._time) stops printing the time at the correct time but the robot just keeps going… Am I misunderstanding how the apply_action function or the joint_velocities input work?

You should set the velocity to 0, otherwise it keeps its velocity. Here are the changes:

``````def send_robot_actions(self, step_size):
# Every articulation controller has apply_action method
# which takes in ArticulationAction with joint_positions, joint_efforts and joint_velocities
# as optional args. It accepts numpy arrays of floats OR lists of floats and None
# None means that nothing is applied to this dof index in this step
# ALTERNATIVELY, same method is called from self._jetbot.apply_action(...)

if(self._time >= 5):
self._jetbot_articulation_controller.apply_action(ArticulationAction(joint_positions=None,
joint_efforts=None,
joint_velocities=np.array([0, 0])))
return
self._jetbot_articulation_controller.apply_action(ArticulationAction(joint_positions=None,
joint_efforts=None,
joint_velocities=5 * np.array([-1, -1])))
self._time += step_size
print(self._time)
return
``````
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.