Pinocchio: Pickle support is not working in Pinocchio Model + unittest

Created on 29 Apr 2020  路  5Comments  路  Source: stack-of-tasks/pinocchio

I have installed the latest devel branch, I can confirm that the Pickle support works only in Pinocchio Data. I am using Python 2.5 under Ubuntu 18.04.

I suggest to include Pickle support unit-test for all cases, e.g. Pinocchio model and data, and vectors.

Most helpful comment

The loaders in example-robot-data add an extraneous armature variable to model (https://github.com/Gepetto/example-robot-data/blob/93aa00253d2bab99d0f1335ecbfc0845315e3e06/python/example_robot_data/robots_loader.py#L35). May this be the cause? Personally, I would suggest to get rid of it

All 5 comments

I'm sorry @cmastalli to contradict you, but I just want to mention that pickling is tested for both Model and Data. Please see the relevant Python unit tests. They are indeed passing on Travis and Github Action.
PS: what is your Python 2.5? It looks very weird.

The way Pickling is working in Pinocchio is not traditional, in the sense that I'm using Boost.Serialization to serialize the containers. This sensibly reduces the amount of work, it is more efficient (than traditional pickling) and very flexible. In this context, it will require some additional work to support the pickling of vectors (I guess @cmastalli meant std::vector) that I do not think this would be useful.

I'm sorry @cmastalli to contradict you, but I just want to mention that pickling is tested for both Model and Data. Please see the relevant Python unit tests. They are indeed passing on Travis and Github Action.

Sorry if I assumed that it was not tested.

PS: what is your Python 2.5? It looks very weird.

I dig a bit into this issue. Maybe the problem is in the RobotWrapper, let me share my code

import pinocchio
import example_robot_data
import copy

model1 = example_robot_data.loadANYmal().model
model2 = pinocchio.buildSampleModelHumanoid()
copy.copy(model1) # it doesn't work
copy.copy(model2) # it works

You can find the loading mechanism in example-robot-data (base on RobotWrapper): https://github.com/Gepetto/example-robot-data/blob/master/python/example_robot_data/robots_loader.py#L66

The loaders in example-robot-data add an extraneous armature variable to model (https://github.com/Gepetto/example-robot-data/blob/93aa00253d2bab99d0f1335ecbfc0845315e3e06/python/example_robot_data/robots_loader.py#L35). May this be the cause? Personally, I would suggest to get rid of it

The loaders in example-robot-data add an extraneous armature variable to model. May this be the cause? Personally, I would suggest to get rid of it

Nice catch! I will revise the example-robot-data mechanism and include some unittests.

I think I could close this issue. Thank you guys.

Was this page helpful?
0 / 5 - 0 ratings