Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pickle support is not working in Pinocchio Model + unittest #1192

Closed
cmastalli opened this issue Apr 29, 2020 · 5 comments
Closed

Pickle support is not working in Pinocchio Model + unittest #1192

cmastalli opened this issue Apr 29, 2020 · 5 comments

Comments

@cmastalli
Copy link
Member

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.

@jcarpent
Copy link
Contributor

jcarpent commented Apr 29, 2020

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.

@jcarpent
Copy link
Contributor

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.

@cmastalli
Copy link
Member Author

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

@gabrielebndn
Copy link
Contributor

gabrielebndn commented Apr 29, 2020

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

@cmastalli
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants