loco-3d / crocoddyl

Crocoddyl is an optimal control library for robot control under contact sequence. Its solver is based on various efficient Differential Dynamic Programming (DDP)-like algorithms
BSD 3-Clause "New" or "Revised" License
858 stars 174 forks source link

Enabled copy and deepcopy in all objects #1121

Closed cmastalli closed 1 year ago

cmastalli commented 1 year ago

This PR allows us to do the following:

import crocoddyl
import copy

m = crocoddyl.ActionModelUnicycle()
d = m.createData()

m1 = copy.copy(m)
m2 = copy.deepcopy(m)

d1 = copy.copy(d)
d2 = copy.deepcopy(d)
cmastalli commented 1 year ago

@nim65s and @wxmerkt, thanks for your feedback.

I have reverted back the changes in the test_XX.py as suggested by @nim65s. Let me know if you have further points to be addressed.

wxmerkt commented 1 year ago

Thank you for the swift action. No further comments, this looks great and is a significant improvement for users deriving/prototyping new models