# Reset\_revolution\_counter() unexpected behavior

**URL:** <https://forum.universal-robots.com/t/reset-revolution-counter-unexpected-behavior/13153>\
**Category:** URScript\
**Created:** [March 24, 2021, 4:59am UTC](https://forum.universal-robots.com/t/reset-revolution-counter-unexpected-behavior/13153 "2021-03-24T04:59:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristianbehe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/cristianbehe/32/2428_2.png) [@cristianbehe](https://forum.universal-robots.com/u/cristianbehe)\
**Post date:** [March 24, 2021, 4:59am UTC](https://forum.universal-robots.com/t/reset-revolution-counter-unexpected-behavior/13153/1 "2021-03-24T04:59:39Z")

</div>

Hi,

I am having trouble using this function as a secondary program. First of all, is it possible to use it like this?  
I want to be able to reset the wrist3 revolution counter without stoping the main program.

However, when I execute the following script:

```auto
sec resetRevolutionCounter():
  reset_revolution_counter()
end

```

The wrist3 joint gives a full rotation at high speed but the counter is not reset.

If a execute simply:

```auto
reset_revolution_counter()

```

The robot does not move and the counter is reset, however, the main primary program is stopped.

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [March 24, 2021, 8:41am UTC](https://forum.universal-robots.com/t/reset-revolution-counter-unexpected-behavior/13153/2 "2021-03-24T08:41:48Z")

</div>

When during the program are you calling the function? Since it relates to joint positions of the robot, I suspect that i will have no effect in the case the robot is moving. If it can’t be called as a secondary program, you might be able to call it from within a thread, which would need to wait for some variable or function for, I suspect, the robot to stop moving.

---

<div class="post-metadata">

**Author:** ![cristianbehe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/cristianbehe/32/2428_2.png) [@cristianbehe](https://forum.universal-robots.com/u/cristianbehe)\
**Post date:** [March 26, 2021, 8:05am UTC](https://forum.universal-robots.com/t/reset-revolution-counter-unexpected-behavior/13153/3 "2021-03-26T08:05:30Z")

</div>

Thank you for the reply,  
Yes, the problem was the location of the function in the program. The full rotation was due to the program trying to go to the old configuration once the revolution counter was reset. For anyone interested [see discussion here](https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/pull/343).
