humanoid-path-planner / hpp_tutorial

Tutorial for humanoid path planner platform
BSD 2-Clause "Simplified" License
7 stars 12 forks source link

CPP version tutorial for hpp-manipulation #42

Closed DrawZeroPoint closed 2 years ago

DrawZeroPoint commented 2 years ago

Dear HPP developers,

I wonder if it is possible to provide an official CPP version of the manipulation tutorial which has been implemented in Python.

Any suggestions about implementing manipulation planning with CPP are also appreciated.

florent-lamiraux commented 2 years ago

Dear @DrawZeroPoint Thank you for your interest in our project. It is possible to execute all python commands in C++, however this is not the way we usually use HPP. That is why we do not provide such an example. Tell me exactly what you intend to do and I will try to help you do it.

jmirabel commented 2 years ago

Apart from tutorials, you'll find C++ examples in https://github.com/humanoid-path-planner/hpp_benchmark/tree/master/src. None of them uses the graph in C++.

DrawZeroPoint commented 2 years ago

Dear @florent-lamiraux

I totally understand that using the python codes together with the cobra server could be efficient and straightforward. However, I do notice that it is heavily dependent on the server and sometimes I have to restart the server to run the code (though it could definitely be circumvented, yet the solution is unknown for me, for now).

This turned me to the CPP version which proved to be great in the path planning task. I reimplemented the pipeline following the CPP version tutorial 1, enabling planning paths for a tailored humanoid controlled via ROS. The implementation is located at here. Continue implementing the manipulation part with CPP seems to be reasonable for software compactness and integrity.

Using python also ends up invoking some underlying CPP functions. Maybe it is more clear to have a tutorial directly using these functions such that the user could see the relationship and differences more clearly and understand the code and the theory behind it better.

florent-lamiraux commented 2 years ago

Normally, you should not have to restart hppcorbaserver as long as you insert the following lines in your script:

from hpp.corbaserver.manipulation import Client
from hpp.corbaserver import loadServerPlugin
loadServerPlugin ("corbaserver", "manipulation-corba.so")
Client ().problem.resetProblem ()

I see in your example that you try to control a robot via ROS and you want to plan motions using HPP. We do that on a daily basis using python.

I you really want to control HPP via C++, you can look at the examples pointing out above by @jmirabel. An example of constraint graph built in C++ can be found here: https://github.com/humanoid-path-planner/hpp-manipulation-corba/blob/a1ae1e6f2b8d886af4d7dbbd30070e601f57dba7/src/graph.impl.cc#L951.

Be also aware that displaying robots and graphs in gepetto-gui is not possible in C++.

DrawZeroPoint commented 2 years ago

@florent-lamiraux @jmirabel Thank you for your suggestions. After going through the CPP resources and evaluate the pros and cons, I think the wise choice is getting back on the right track and using Python.