orocos_kinematics_dynamics icon indicating copy to clipboard operation
orocos_kinematics_dynamics copied to clipboard

Segments are public in a Chain

Open francofusco opened this issue 5 years ago • 1 comments

Why is the member std::vector<Segment> segments public in Chain? Is there a specific reason? One would probably never do it, but this allows to do something like: chain.segments.push_back(Segment("foo", Joint(), Frame(Vector(1,0,0))); which I think would not cause any runtime error but cause several troubles in all solvers (since they check consistency of a chain using getNrOfSegments, which in turn uses nrOfSegments).

Wouldn't it be better to set it as private? Otherwise, what about writing a function like update() that updates the variables nrOfJoints and nrOfSegments in case segments are changed externally?

francofusco avatar Jan 09 '19 17:01 francofusco