Revision: 6423
          http://sourceforge.net/p/smartbody/code/6423
Author:   arishapiro
Date:     2016-06-14 17:29:57 +0000 (Tue, 14 Jun 2016)
Log Message:
-----------
Fixed for Perception Neuron puppeteering via the SBRealtimeManager.
Works in non-displacement, non-reference mode.

Sample setup:
scene.getRealtimeManager().setStringAttribute("perceptionNeuronIP", 
"172.16.33.27")

class MyController (PythonController):

        def init(self, pawn):
                # setup rig nodes
                print "Setting up Perception Neuron control..."
                
        def evaluate(self):
                retarget = 
scene.getRetargetManager().getRetarget("perceptionneuron.bvh","Evan.dae")
                perceptionNeuronMap = 
scene.getJointMapManager().getJointMap("perceptionneuron")
                zebra2Map = scene.getJointMapManager().getJointMap("zebra2")
                # every time step, get the value from one channel and then 
modify another
                realtimeManager = scene.getRealtimeManager()
                if 
(realtimeManager.getAttribute("perceptionNeuronStatus").getValue() == 
"Connected"):
                        skel = scene.getCharacter("ChrBrad").getSkeleton()
                        numJoints = skel.getNumJoints()
                        for j in range(0, numJoints):
                                joint = skel.getJoint(j)
                                name = joint.getName()
                                # get the original source name
                                zebra2Name = zebra2Map.getMapTarget(name)
                                perceptionNeuronJointName = 
perceptionNeuronMap.getMapSource(zebra2Name)
                                if perceptionNeuronJointName == "":
                                        continue
                                #print "MAPPED NAME" + name + " " + 
perceptionNeuronJointName
                                # get any current data
                                if (perceptionNeuronJointName == "Hips"):
                                        pos = 
realtimeManager.getDataVec(perceptionNeuronJointName + "/pos")
                                        scaledPos = SrVec()
                                        scaledPos.setData(0, pos.getData(0) * 
.01)
                                        scaledPos.setData(1, pos.getData(1) * 
.01)
                                        scaledPos.setData(2, pos.getData(2) * 
.01)
                                        self.setChannelPos(zebra2Name, 
scaledPos)
                                rot = 
realtimeManager.getDataQuat(perceptionNeuronJointName)                          
          
                                retargetedRot = 
retarget.applyRetargetJointRotation(zebra2Name, rot)
                                
                                #print "QUAT" + str(rot.getData(0)) + " " +  
str(rot.getData(1)) + " " + str(rot.getData(2)) + " " + str(rot.getData(3))
                                self.setChannelQuat(zebra2Name, rot)
                        

Modified Paths:
--------------
    trunk/core/smartbody/SmartBody/src/sb/SBRealtimeManager.cpp
    trunk/core/smartbody/SmartBody/src/sb/SBRealtimeManager.h

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Smartbody-svn mailing list
Smartbody-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/smartbody-svn

Reply via email to