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

Put K4ABT_JOINT_ constants into enum and use them consistently #109

Open
StephanHasler opened this issue Sep 28, 2023 · 0 comments
Open

Comments

@StephanHasler
Copy link

I like to send detected skeletons from one program to another in a custom format. In this format I like to refer to each body joint by its name like SHOULDER_LEFT rather than its ID 5. I could map IDs to names using the K4ABT_JOINT_NAMES list. But the names in K4ABT_JOINT_NAMES are not really suited for my purpose, because they contain spaces and dashes and the order of words is reversed.

I would prefer to get the name directly from the constant. This would be much easier if the constants are part of an enum.

from enum import Enum

class K4ABT_JOINTS(Enum):
    K4ABT_JOINT_PELVIS = 0
    K4ABT_JOINT_SPINE_NAVEL = 1
    K4ABT_JOINT_SPINE_CHEST = 2
    K4ABT_JOINT_NECK = 3

# Now its easy to get the name of the joint from the ID
K4ABT_JOINTS(0).name 
'K4ABT_JOINT_PELVIS'

K4ABT_JOINTS(3).name 
'K4ABT_JOINT_NECK'

If you have no objections against this, I could provide a pull request.

Also the JOINT constants could be used more consistently.
Currently, in the definition of the K4ABT_SEGMENT_PAIRS the indices are used instead of the constants.

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

1 participant