supervisor.step() returns too early #76
-
To make the robotic arm rotate its joints precisely, I let the robot send a specific message which denotes that it is still moving, and let the supervisor send robot a special action number, say -1, which denotes that supervisor is not sending an action to the robot but asking whether the robot stops moving. The above solution can solve the problem, but I am looking for some more efficient ways. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Hey @KelvinYang0320, This issue sounds peculiar. Can you share controllers or point me to code that reproduces this behaviour? |
Beta Was this translation helpful? Give feedback.
-
Hello @KelvinYang0320, i took a look at the code and the example and - correct me if i am wrong - i think that a robot action takes more than one step to complete. As a consequence the supervisor has to wait for the previous action to complete before getting the new observations and sending back the new action. Webots motors controlled by setPosition run an internal PID controller to reach the position you asked for. This can take multiple steps. The solution you implemented seems perfectly fine to me. I think you are forced to implement such a scheme (or anything similar really) to wait for the action to complete. I would suggest that you use the RobotSupervisor scheme, you can see an example here. Note that the linked example uses the latest dev release of deepbots which you can find here. With the robot-supervisor scheme we use the robot node as a supervisor, without needing any emitter-receiver communication, and all needed functions are implemented in one controller. Moreover, the example uses the new reset procedure that simplifies reset and makes it far-far faster. Switching from the emitter-receiver to the robot-supervisor scheme is more a matter of copy-pasting and deleting some stuff, no big deal really (i have done it myself in the example i linked). The new scheme will make your code far simpler and more efficient. I think that by switching to the new scheme your issue will be solved by default. Feel free to ask any other questions and i'll be happy to help. |
Beta Was this translation helpful? Give feedback.
Hello @KelvinYang0320, i took a look at the code and the example and - correct me if i am wrong - i think that a robot action takes more than one step to complete. As a consequence the supervisor has to wait for the previous action to complete before getting the new observations and sending back the new action.
Webots motors controlled by setPosition run an internal PID controller to reach the position you asked for. This can take multiple steps. The solution you implemented seems perfectly fine to me. I think you are forced to implement such a scheme (or anything similar really) to wait for the action to complete.
I would suggest that you use the RobotSupervisor scheme, you can see an ex…