Giter Club home page Giter Club logo

Comments (2)

keenon avatar keenon commented on May 20, 2024

Thanks for the bug report! Can you paste a copy of the code you're running that's leading to the seg-fault, so I can reproduce the issue?

from nimblephysics.

giuli13 avatar giuli13 commented on May 20, 2024
  smpl_skel = nimble.dynamics.Skeleton()
  Pelvis, PelvisNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  LHip, LHipNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RHip, RHipNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  Spine1, Spine1Node = smpl_skel.createTranslationalJointAndBodyNodePair()
  LKnee, LKneeNode =smpl_skel.createTranslationalJointAndBodyNodePair()
  RKnee, RKneeNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  Spine2, Spine2Node = smpl_skel.createTranslationalJointAndBodyNodePair()
  LAnkle, LAnkleNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RAnkle, RAnkleNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  Spine3, Spine3Node = smpl_skel.createTranslationalJointAndBodyNodePair()
  LFoot, LFootNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RFoot, RFootNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  Neck, NeckNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  LCollar, LCollarNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RCollar, RCollarNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  Jaw, JawNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  LShoulder, LShoulderNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RShoulder, RShoulderNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  LElbow, LElbowNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RElbow, RElbowNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  LWrist, LWristNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RWrist, RWristNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  LHand, LHandNode = smpl_skel.createTranslationalJointAndBodyNodePair()
  RHand, RHandNode = smpl_skel.createTranslationalJointAndBodyNodePair()
smpl_Node = [PelvisNode, LHipNode, RHipNode, Spine1Node, LKneeNode, RKneeNode, Spine2Node, LAnkleNode, RAnkleNode, Spine3Node, LFootNode, RFootNode, NeckNode, LCollarNode, RCollarNode, 
JawNode, LShoulderNode, RShoulderNode, LElbowNode, RElbowNode, LHandNode, RHandNode]
smpl_bones = [Pelvis, LHip, RHip, Spine1, LKnee, RKnee, Spine2, LAnkle, RAnkle, Spine3, LFoot, RFoot, Neck, LCollar, RCollar, 
Jaw, LShoulder, RShoulder, LElbow, RElbow, LHand, RHand]

for bone in smpl_bones:
    bone.setName(str(bone))

panoptic_skel = nimble.dynamics.Skeleton()
Neck, NeckNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
Nose, NoseNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
Pelvis, PelvisNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LShoulder, LShoulderNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LElbow, LElbowNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LWrist, LWristNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LHip, LHipNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LKnee, LKneeNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LAnkle, LAnkleNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
RShoulder, RShoulderNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
RElbow, RElbowNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
RWrist, RWristNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
RHip, RHipNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
RKnee, RKneeNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
RAnkle, RAnkleNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LEye, LEyeNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
LEar, LEarNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
REye, REyeNode = panoptic_skel.createTranslationalJointAndBodyNodePair()
REar, REarNode = panoptic_skel.createTranslationalJointAndBodyNodePair()

panoptic_Node = [NeckNode, NoseNode, PelvisNode, LShoulderNode, LElbowNode, LWristNode, LHipNode, LKneeNode, LAnkleNode, RShoulderNode, 
RElbowNode,RWristNode, RHipNode, RKneeNode, RAnkleNode, LEyeNode, LEarNode, REyeNode, REarNode]
panoptic_bones = [Neck, Nose, Pelvis, LShoulder, LElbow, LWrist, LHip, LKnee, LAnkle, RShoulder, 
RElbow,RWrist, RHip, RKnee, RAnkle, LEye, LEar, REye, REar]

for bone in panoptic_bones:
    bone.setName(str(bone))

panoptic_poses = np.empty(shape=(57,300))

for idx in range(300):
    panoptic_initial_position = joints_extraction_panoptic(idx+300)
    panoptic_initial_position = scaler.fit_transform(panoptic_initial_position)
    panoptic_poses[:,idx] = panoptic_initial_position.flatten()
    
smpl_poses = np.empty(shape=(72,300))

for idx in range(300):
    smpl_initial_position = joints_extraction_smpl(idx)
    smpl_initial_position = scaler.fit_transform(smpl_initial_position)
    smpl_poses[:,idx] = smpl_initial_position.flatten()


joints_panoptic = np.empty(shape=(57,1))
joints_smpl = np.empty(shape=(72,1))
for i in range(1):
    panoptic_skel.fitJointsToWorldPositions(panoptic_bones, panoptic_poses[:,i])
    joints_panoptic[:,i] = panoptic_skel.getPositions()
    smpl_skel.fitJointsToWorldPositions(smpl_bones, smpl_poses[:,i])
    joints_smpl[:,i] = smpl_skel.getPositions()
    print("Panoptic Skel Pos :", panoptic_skel.getPositions())
    print("Panoptic Joints: ",joints_panoptic[:,i])
    print("SMPL Skel Pos :", smpl_skel.getPositions())
    print("SMPL Joints: ",joints_smpl[:,i])
converter: nimble.biomechanics.SkeletonConverter = nimble.biomechanics.SkeletonConverter(smpl_skel, panoptic_skel)

converter.linkJoints(smpl_skel.getJoint("LShoulder"), panoptic_skel.getJoint("LShoulder"))
converter.linkJoints(smpl_skel.getJoint("RShoulder"), panoptic_skel.getJoint("RShoulder"))
converter.linkJoints(smpl_skel.getJoint("RElbow"), panoptic_skel.getJoint("RElbow"))
converter.linkJoints(smpl_skel.getJoint("LElbow"), panoptic_skel.getJoint("LElbow"))
converter.linkJoints(smpl_skel.getJoint("RWrist"), panoptic_skel.getJoint("RWrist"))
converter.linkJoints(smpl_skel.getJoint("LWrist"), panoptic_skel.getJoint("LWrist"))
converter.linkJoints(smpl_skel.getJoint("RKnee"), panoptic_skel.getJoint("RKnee"))
converter.linkJoints(smpl_skel.getJoint("LKnee"), panoptic_skel.getJoint("LKnee"))
converter.linkJoints(smpl_skel.getJoint("LAnkle"), panoptic_skel.getJoint("LAnkle"))
converter.linkJoints(smpl_skel.getJoint("RAnkle"), panoptic_skel.getJoint("RAnkle"))



converter.rescaleAndPrepTarget()

mySkeletonPoses = converter.convertMotion(joints_panoptic, logProgress=True)`

from nimblephysics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.