dartsim/dart — pull request #288 by mxgrey (2014-12-16 01:52:55+00:00)
Title: DegreeOfFreedom class

This pull request introduces the DegreeOfFreedom class which serves as a proxy class for getting/setting the data (e.g. position, velocity, acceleration, force, limits, etc) of individual generalized coordinates (aka degrees of freedom). This pull request also gives names to each degree of freedom and allows each degree of freedom to be accessed by name. The name of each degree of freedom in a given Skeleton is kept unique by the NameManager class.

By default, each degree of freedom is given a name based on the name of the joint it belongs to. For SingleDofJoints, their single dof is just given the same name as the joint itself. For MultiDofJoints, the dof is given a name with the pattern "\_\" where "\" is simple the name of its joint, and "\" indicates its role in the joint. For example, a TranslationalJoint named "joint1" will be given degrees of freedom with the following names: "joint1_x", "joint1_y", and "joint1_z".

The user can rename any DegreeOfFreedom at any time, however names that match already existing DOF names will be altered by the NameManager to prevent a lookup conflict.

When the user changes a joint name using Joint::setName(~), they are given the option of whether or not to have the joint's degrees of freedom automatically renamed as well (default is true).

Something to consider: Currently, if the Skeleton's Joint NameManager needs to change a joint's name to prevent a naming conflict, it will also rename that Joint's DegreesOfFreedom to match the new name. This could potentially wipe out custom names that the user might have given to that Joint's DegreesOfFreedom. Should we have a flag that the user can set to prevent this behavior?