def draw_chains(self): ''' Draws the source and target chain on the same axes, for debugging purposes. ''' mlab.figure() mlab.grid('on') mlab.draw(self.source) mlab.draw(self.target, 'r')
# ----------------------------------------------------------- # # Manipulate chain pose with setJointAngles(chain, angles) pr2_initial_angles = np.matrix([0,0,0,0]) pr2 = mlab.setJointAngles(pr2, pr2_initial_angles) human_initial_angles = np.matrix([0,-110,40,-60]) human = mlab.setJointAngles(human, human_initial_angles) # Visualize chains with the draw() function. mlab.figure() mlab.grid('on') mlab.headSphere() #creates a dummy head that provides context. mlab.draw(pr2,'k') mlab.draw(human) # ----------------------------------------------------------- # # Retargeting Chains: # ----------------------------------------------------------- # # easy_retarget(source, target) abstracts away all the messy bits. pr2_retargeted = mlab.easy_retarget(human, pr2) # draw on the open figure: mlab.draw(pr2_retargeted,'g') mlab.title('Retargeting Demo') mlab.legend('black - pr2 initial pose','blue - human source pose', 'green - pr2 retargeted pose')