robotology / walking-teleoperation

Software related to walking and teleoperation.
BSD 3-Clause "New" or "Revised" License
30 stars 14 forks source link

add rpc server to the oculus module to control finite state machine of the module #70

Closed kouroshD closed 2 years ago

kouroshD commented 3 years ago

Problem: Especially by using the VIVE, it is often tricky to distinguish the left from the right hand. It would be better and safer to start the teleoperation pipeline from a terminal command Solution: An RPC command is added to the oculus module.

kouroshD commented 3 years ago

@S-Dafarra @GiulioRomualdi if you can test this feature for the demo, it would be great. I could build it without any problem, but I could not test it.

S-Dafarra commented 3 years ago

I quickly checked it. Here a couple of comments:

  1. the RPC answer is asynchronous, hence you need to use some mutex around.
  2. I would suggest using separate methods dealing with each command.
  3. Instead of using the respond method, you can specify a thrift with all the commands you need (http://www.yarp.it/git-master/thrift_tutorial_simple.html). This has the following advantages:
    • for each command it automatically generates a virtual method that you can implement, thus automatically addressing point 2 above;
    • it handles automatically the help command;
    • it handles automatically more complex inputs, like vectors
    • if you write some documentation, this is automatically reported when typing help myCommand
    • it is more scalable; it is easier to add/change/remove commands

You can find some example of usage of the thrifts in the walking-controller:

kouroshD commented 3 years ago

@S-Dafarra I have updated the PR with the requested changes. Please have a look on it. Thanks.

kouroshD commented 3 years ago

@S-Dafarra Thank you for the comments, I have updated the PR with your comments.

kouroshD commented 3 years ago

@S-Dafarra I have updated the PR with your suggestions. Moreover, I have rebased the code. Let me know if you have other comments as well. Thanks.

kouroshD commented 2 years ago

We have tested PR added to this branch : https://github.com/robotology/walking-teleoperation/tree/modify_dcmWalkingRetargeting_rpc_Oculus It was working as expected. @S-Dafarra If you can approve the PR, I will proceed with the merge.

S-Dafarra commented 2 years ago

Just one comment for future reference. When using the gloves now, we could avoid connecting to the JoypadControlClient. In any case we can proceed.