roboticslab-uc3m / kinematics-dynamics

Kinematics and dynamics solvers and controllers.
https://robots.uc3m.es/kinematics-dynamics/
GNU Lesser General Public License v2.1
19 stars 12 forks source link

Add encoder timestamps to ICartesianControl's stat() signature #176

Closed PeterBowman closed 5 years ago

PeterBowman commented 5 years ago

Closes https://github.com/roboticslab-uc3m/kinematics-dynamics/issues/175. The signature of ICartesianControl::stat has been changed in order to include the instant in which joint data acquisition has been performed:

bool stat(std::vector<double> &x, int * state = 0, double * timestamp = 0);

Now, the state parameter is optional, therefore consumers don't need to declare an unused variable anymore, just call iCartesianControl->stat(x) in case they don't care about the current controller state (nor the encoder timestamp).

The BCC implementation relies on the availability of a yarp::dev::IPreciselyTimed implementation on the remote robot. If that's not the case, BCC generates a timestamp on the fly. This could be turned into an error on BCC's initialization.

Python bindings have been updated, see example: ret, state, timestamp = iCartesianControl->stat(x). I believe that the glue file .i could be improved upon, but this is beyond my SWIG skills.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.2%) to 56.457% when pulling 432caef2e7af2dd7a0452d3da7decbc19651a7cf on cc-stat-stamps into 3a51f68f8a35d187bbff522ad1d98101043db51c on develop.

jgvictores commented 5 years ago

Excellent! BTW, nice to finally see some use of typemaps.i in practice. Ok ready to merge?

PeterBowman commented 5 years ago

I'd rather have this working (ref):

It should also be noted that although the %apply directive is used to associate typemap rules to datatypes, you can also use the rule names directly in arguments. For example, you could write this:

That is, write the typemap rule specific to a single function (stat) instead of all function parameters that happen to share the same name (state, timestamp). However, I did not succeed to make that work with class methods...

Ok ready to merge?

Yes!