stack-of-tasks / sot-core

Hierarchical task solver plug-in for dynamic-graph
BSD 2-Clause "Simplified" License
19 stars 32 forks source link

[dg plugins] re-package the smooth-reach plugins. #178

Closed MaximilienNaveau closed 3 years ago

MaximilienNaveau commented 3 years ago

Re-packaged the smooth reach entity as it is very handy to initialize the experiment using a switch_vector.

I tested it by loading the entity into an ipython and displaying the signals.

I will also use it in my controllers.

nim65s commented 3 years ago

Thanks for this :) As you did test that, could you add an unittest ? If you don't have time for it, you can just copy-paste me your ipython history :)

jmirabel commented 3 years ago

Eventually, re-implementing the Entity::getDocString or adding some doxygen documentation explaining what the entity does would be welcome.

MaximilienNaveau commented 3 years ago

I did nit really do much more than:

In [2]: from dynamic_graph.sot.core.smooth_reach import SmoothReach

In [3]: s = SmoothReach

In [4]: s = SmoothReach("banana")

In [5]: s.displaySignals()
--- <banana> signal list:
    |-- <Sig:SmoothReach(banana)::output(vector)::goal (Type Fun)
    |-- <Sig:SmoothReach(banana)::input(vector)::start (Type Cst) UNPLUGGED

In [6]: s.goal?
Type:           SignalTimeDependentVector
String form:    Sig:SmoothReach(banana)::output(vector)::goal (Type Fun)
File:           ~/devel/workspace_ros2/install/lib/python3.6/site-packages/dynamic_graph/wrap.so
Docstring:      <no docstring>
Init docstring:
Raises an exception
This class cannot be instantiated from Python

In [7]: s.set?
Type:           Command
String form:    <dynamic_graph.wrap.Command object at 0x7fe53511b260>
File:           ~/devel/workspace_ros2/install/lib/python3.6/site-packages/dynamic_graph/wrap.so
Docstring:     
Set the curve.

Input:
 - A vector (goal).
Input:
 - A int (duration).
Void return.
Init docstring:
Raises an exception
This class cannot be instantiated from Python
Call docstring:
object __call__(tuple args, dict kwds) :
    execute the command

    C++ signature :
        object __call__(tuple args, dict kwds)

In [8]:                                                             

For the doc and test I do not really have time right now but we can keep an issue open and I will do it a bit later. WDYT?

MaximilienNaveau commented 3 years ago

Eventually, re-implementing the Entity::getDocString or adding some doxygen documentation explaining what the entity does would be welcome.

Do you have a link to a file where this getDocString is implemented?

jmirabel commented 3 years ago

You only have to reimplement function virtual std::string Entity::getDocString() const in inherited entities. The result of this function is used as class docstring in Python.

nim65s commented 3 years ago

done for the dumb test: https://github.com/nim65s/sot-core/commit/f2d69e916aa9132fb28574ef8f1d28b4278c22b7

MaximilienNaveau commented 3 years ago

Thanks @nim65s !

olivier-stasse commented 3 years ago

Should I merge ?

MaximilienNaveau commented 3 years ago

Yes from my part I will do another PR for more unit-tests and doc