IC Python API:RLPy RlBodyDevice
- Main article: Modules.
Inheritance
This class inherits public member functions from:
Detailed Description
This class is used to represent the body mocap device.
Provide methods to control full body animation including head rotation, torso movement and limb movement.#{bone_name, parent_bone_name, Hik_bone_name}
hips = ["hips", "", "Hips"]
rightupleg = ["rightupleg", "hips", "RightUpLeg"]
rightleg = ["rightleg", "rightupleg", "RightLeg"]
rightfoot = ["rightfoot", "rightleg", "RightFoot"]
leftupleg = ["leftupleg", "hips", "LeftUpLeg"]
leftleg = ["leftleg", "leftupleg", "LeftLeg"]
leftfoot = ["leftfoot", "leftleg", "LeftFoot"]
spine = ["spine", "hips", "Spine"]
spine1 = ["spine1", "spine", "Spine3"]
spine2 = ["spine2", "spine1", "Spine6"]
spine3 = ["spine3", "spine2", "Spine9"]
neck = ["neck", "spine3", "Neck"]
head = ["head", "neck", "Head"]
rightshoulder = ["rightshoulder", "spine3", "RightShoulder"]
rightarm = ["rightarm", "rightshoulder", "RightArm"]
rightforearm = ["rightforearm", "rightarm", "RightForeArm"]
righthand = ["righthand", "rightforearm", "RightHand"]
righthandthumb1 = ["righthandthumb1", "righthand", "RightHandThumb1"]
righthandthumb2 = ["righthandthumb2", "righthandthumb1", "RightHandThumb2"]
righthandthumb3 = ["righthandthumb3", "righthandthumb2", "RightHandThumb3"]
rightinhandindex = ["rightinhandindex", "righthand", "RightInHandIndex"]
righthandindex1 = ["righthandindex1", "rightinhandindex", "RightHandIndex1"]
righthandindex2 = ["righthandindex2", "righthandindex1", "RightHandIndex2"]
righthandindex3 = ["righthandindex3", "righthandindex2", "RightHandIndex3"]
rightinhandmiddle = ["rightinhandmiddle", "righthand", "RightInHandMiddle"]
righthandmiddle1 = ["righthandmiddle1", "rightinhandmiddle", "RightHandMiddle1"]
righthandmiddle2 = ["righthandmiddle2", "righthandmiddle1", "RightHandMiddle2"]
righthandmiddle3 = ["righthandmiddle3", "righthandmiddle2", "RightHandMiddle3"]
rightinhandring = ["rightinhandring", "righthand", "RightInHandRing"]
righthandring1 = ["righthandring1", "rightinhandring", "RightHandRing1"]
righthandring2 = ["righthandring2", "righthandring1", "RightHandRing2"]
righthandring3 = ["righthandring3", "righthandring2", "RightHandRing3"]
rightinhandpinky = ["rightinhandpinky", "righthand", "RightInHandPinky"]
righthandpinky1 = ["righthandpinky1", "rightinhandpinky", "RightHandPinky1"]
righthandpinky2 = ["righthandpinky2", "righthandpinky1", "RightHandPinky2"]
righthandpinky3 = ["righthandpinky3", "righthandpinky2", "RightHandPinky3"]
leftshoulder = ["leftshoulder", "spine3", "LeftShoulder"]
leftarm = ["leftarm", "leftshoulder", "LeftArm"]
leftforearm = ["leftforearm", "leftarm", "LeftForeArm"]
lefthand = ["lefthand", "leftforearm", "LeftHand"]
lefthandthumb1 = ["lefthandthumb1", "lefthand", "LeftHandThumb1"]
lefthandthumb2 = ["lefthandthumb2", "lefthandthumb1", "LeftHandThumb2"]
lefthandthumb3 = ["lefthandthumb3", "lefthandthumb2", "LeftHandThumb3"]
leftinhandindex = ["leftinhandindex", "lefthand", "LeftInHandIndex"]
lefthandindex1 = ["lefthandindex1", "leftinhandindex", "LeftHandIndex1"]
lefthandindex2 = ["lefthandindex2", "lefthandindex1", "LeftHandIndex2"]
lefthandindex3 = ["lefthandindex3", "lefthandindex2", "LeftHandIndex3"]
leftinhandmiddle = ["leftinhandmiddle", "lefthand", "LeftInHandMiddle"]
lefthandmiddle1 = ["lefthandmiddle1", "leftinhandmiddle", "LeftHandMiddle1"]
lefthandmiddle2 = ["lefthandmiddle2", "lefthandmiddle1", "LeftHandMiddle2"]
lefthandmiddle3 = ["lefthandmiddle3", "lefthandmiddle2", "LeftHandMiddle3"]
leftinhandring = ["leftinhandring", "lefthand", "LeftInHandRing"]
lefthandring1 = ["lefthandring1", "leftinhandring", "LeftHandRing1"]
lefthandring2 = ["lefthandring2", "lefthandring1", "LeftHandRing2"]
lefthandring3 = ["lefthandring3", "lefthandring2", "LeftHandRing3"]
leftinhandpinky = ["leftinhandpinky", "lefthand", "LeftInHandPinky"]
lefthandpinky1 = ["lefthandpinky1", "leftinhandpinky", "LeftHandPinky1"]
lefthandpinky2 = ["lefthandpinky2", "lefthandpinky1", "LeftHandPinky2"]
lefthandpinky3 = ["lefthandpinky3", "lefthandpinky2", "LeftHandPinky3"]
bone_list = [hips, rightupleg, rightleg, rightfoot, leftupleg, leftleg, leftfoot, spine, spine1, spine2,
spine3, neck, head, rightshoulder, rightarm, rightforearm, righthand, righthandthumb1,
righthandthumb2, righthandthumb3, rightinhandindex, righthandindex1, righthandindex2,
righthandindex3, rightinhandmiddle, righthandmiddle1, righthandmiddle2, righthandmiddle3,
rightinhandring, righthandring1, righthandring2, righthandring3, rightinhandpinky,
righthandpinky1, righthandpinky2, righthandpinky3, leftshoulder, leftarm, leftforearm,
lefthand, lefthandthumb1, lefthandthumb2, lefthandthumb3, leftinhandindex, lefthandindex1,
lefthandindex2, lefthandindex3, leftinhandmiddle, lefthandmiddle1, lefthandmiddle2,
lefthandmiddle3, leftinhandring, lefthandring1, lefthandring2, lefthandring3, leftinhandpinky,
lefthandpinky1, lefthandpinky2, lefthandpinky3]
t_pose_data = [0.0, 105.85, 0.0, 0, 0, 0, -11.5, -1.85, 0.0, 0, 0, 0, 0.0, -48.0, 0.0, 0, 0, 0, 0.0, -48.0, 0.0, 0, 0, 0, 11.5, -1.85, 0.0, 0, 0, 0, 0.0, -48.0, 0.0, 0, 0, 0, 0.0, -48.0, 0.0, 0, 0, 0.0, 0.0, 16.654, 0.0, 0, 0, 0, 0.0, 11.312, 0.0, 0, 0, 0, 0.0, 11.78, 0.0, 0, 0, 0, 0.0, 11.312, 0.0, 0, 0, 0, 0.0, 12.091, 0.0, 0, 0, 0, 0.0, 9.0, 0.0, 0, 0, 0, -3.5, 8.061, 0.0, 0, 0, 0, -14.0, 0.0, 0.0, 0, 0, 0, -29.0, 0.0, 0.0, 0, 0, 0, -28.0, 0.0, 0.0, 0, 0, 0, -2.702, 0.206, 3.388, 0, 30, 0, -3.998, 0.0, 0.0, 0, 0, 0, -2.778, 0.0, 0.0, 0, 0, 0, -3.5, 0.552, 2.148, 0, 0, 0, -5.664, -0.099, 1.085, 0, 0, 0, -3.93, 0.0, 0.0, 0, 0, 0, -2.228, 0.0, 0.0, 0, 0, 0, -3.672, 0.562, 0.822, 0, 0, 0, -5.618, -0.091, 0.341, 0, 0, 0, -4.288, 0.0, 0.0, 0, 0, 0, -2.688, 0.0, 0.0, 0, 0, 0, -3.654, 0.584, -0.14, 0, 0, 0, -5.032, -0.024, -0.52, 0, 0, 0, -3.737, 0.0, 0.0, 0, 0, 0, -2.593, 0.0, 0.0, 0, 0, 0, -3.432, 0.51, -1.305, 0, 0, 0, -4.496, -0.024, -1.184, 0, 0, 0, -2.993, 0.0, 0.0, 0, 0, 0, -1.891, 0.0, 0.0, 0, 0, 0, 3.5, 8.061, 0.0, 0, 0, 0, 14.0, 0.0, 0.0, 0, 0, 0, 29.0, 0.0, 0.0, 0, 0, 0, 28.0, 0.0, 0.0, 0, 0, 0, 2.702, 0.206, 3.388, 0, -30, 0, 3.998, 0.0, 0.0, 0, 0, 0, 2.778, 0.0, 0.0, 0, 0, 0, 3.5, 0.552, 2.148, 0, 0, 0, 5.664, -0.099, 1.085, 0, 0, 0, 3.93, 0.0, 0.0, 0, 0, 0, 2.228, 0.0, 0.0, 0, 0, 0, 3.672, 0.562, 0.822, 0, 0, 0, 5.618, -0.091, 0.341, 0, 0, 0, 4.288, 0.0, 0.0, 0, 0, 0, 2.688, 0.0, 0.0, 0, 0, 0, 3.654, 0.584, -0.14, 0, 0, 0, 5.032, -0.024, -0.52, 0, 0, 0, 3.737, 0.0, 0.0, 0, 0, 0, 2.593, 0.0, 0.0, 0, 0, 0, 3.432, 0.51, -1.305, 0, 0, 0, 4.496, -0.024, -1.184, 0, 0, 0, 2.993, 0.0, 0.0, 0, 0, 0, 1.891, 0.0, 0.0, 0, 0, 0]
fram1_data = [-0.05, 106.89, -3.65, -6.91, 173.25, -1.78, -11.44, -1.88, -0.06, -6.14, 12.7, -9.17, 0.19, -48.07, 0.02, 27.03, -11.94, 0.71, 0.52, -48.92, -0.88, -7.01, -2.03, 16.63, 11.54, -1.81, -0.15, 6.95, 20.59, 4.21, 0.11, -48.01, 0.07, 6.32, -4.32, 0.42, 0.84, -47.31, -0.06, -7.0, 21.87, -1.47, -0.1, 16.66, -0.05, 3.42, 0.62, -2.97, -0.04, 11.32, -0.06, 0.86, 0.14, -0.75, -0.02, 11.78, 0.01, 1.43, 0.21, -1.24, -0.05, 11.31, -0.03, 0.33, -1.32, 0.27, -0.15, 12.08, -0.0, 0.34, -1.33, 0.27, -0.14, 9.01, 0.01, 8.37, -24.14, 3.38, -3.52, 8.02, -0.02, -2.34, 1.02, 10.14, -14.04, -0.15, -0.07, -27.48, 30.59, 18.74, -28.99, -0.1, -0.12, 7.78, 36.33, 6.57, -27.99, -0.02, -0.02, 18.56, -1.48, -48.22, -2.7, 0.21, 3.39, -0.0, 56.65, 24.69, -4.0, 0.0, 0.0, -0.0, 13.01, 7.06, -2.78, 0.0, 0.0, -0.0, -3.83, 0.0, -3.5, 0.55, 2.15, -0.0, 0.0, 0.0, -5.66, -0.1, 1.08, -0.0, 15.0, 12.78, -3.93, 0.0, 0.0, -0.0, 0.0, 12.78, -2.23, 0.0, 0.0, -0.0, 0.0, 12.78, -3.67, 0.56, 0.82, -0.0, 0.0, 0.0, -5.62, -0.09, 0.34, -0.0, 0.0, 14.26, -4.29, 0.0, 0.0, -0.0, 0.0, 14.26, -2.69, 0.0, 0.0, -0.0, 0.0, 14.26, -3.65, 0.58, -0.14, -0.0, 0.0, 0.0, -5.03, -0.02, -0.52, -0.0, -15.0, 13.89, -3.74, 0.0, 0.0, -0.0, 0.0, 13.89, -2.59, 0.0, 0.0, -0.0, 0.0, 13.89, -3.43, 0.51, -1.3, -0.0, 0.0, 0.0, -4.5, -0.02, -1.18, -0.0, -25.0, 10.03, -2.99, 0.0, 0.0, -0.0, 0.0, 10.03, -1.89, 0.0, 0.0, -0.0, 0.0, 10.03, 3.48, 8.09, 0.04, 5.92, 19.77, -1.93, 14.08, 0.06, 0.03, 1.13, -12.31, -70.29, 28.98, 0.11, 0.07, 3.24, -2.94, 1.22, 28.0, -0.02, 0.26, 4.08, 10.77, 6.19, 2.7, 0.21, 3.39, -0.0, -52.26, -28.52, 4.0, 0.0, 0.0, -0.0, -2.75, -5.08, 2.78, 0.0, 0.0, -0.0, -5.53, 0.0, 3.5, 0.55, 2.15, -0.0, 0.0, 0.0, 5.66, -0.1, 1.08, -0.0, -15.0, -16.84, 3.93, 0.0, 0.0, -0.0, 0.0, -16.84, 2.23, 0.0, 0.0, -0.0, 0.0, -16.84, 3.67, 0.56, 0.82, -0.0, 0.0, 0.0, 5.62, -0.09, 0.34, -0.0, 0.0, -18.32, 4.29, 0.0, 0.0, -0.0, 0.0, -18.32, 2.69, 0.0, 0.0, -0.0, 0.0, -18.32, 3.65, 0.58, -0.14, -0.0, 0.0, 0.0, 5.03, -0.02, -0.52, -0.0, 15.0, -21.5, 3.74, 0.0, 0.0, -0.0, 0.0, -21.5, 2.59, 0.0, 0.0, -0.0, 0.0, -21.5, 3.43, 0.51, -1.3, -0.0, 0.0, 0.0, 4.5, -0.02, -1.18, -0.0, 25.0, -24.8, 2.99, 0.0, 0.0, -0.0, 0.0, -24.8, 1.89, 0.0, 0.0, -0.0, 0.0, -24.8]
fram2_data = [6.44, 106.86, 2.11, -6.0, 144.52, -2.36, -11.52, -1.83, -0.05, 7.03, 9.66, 1.24, -0.07, -48.0, -0.04, 3.28, -11.53, -0.02, 0.81, -47.99, -0.85, -4.79, 2.47, 2.48, 11.55, -1.86, 0.02, 5.86, 10.68, 8.65, 0.17, -47.99, 0.05, 6.93, -0.61, 4.33, -0.25, -47.97, 0.22, -3.08, 22.35, -10.46, 0.04, 16.65, 0.0, 3.11, -0.77, 2.42, 0.01, 11.31, -0.03, 0.78, -0.18, 0.61, -0.02, 11.78, -0.0, 1.31, -0.28, 1.01, -0.02, 11.31, -0.01, 0.04, -0.33, 0.2, 0.02, 12.09, -0.04, 0.04, -0.33, 0.2, -0.03, 9.0, -0.08, 1.2, -5.81, 3.62, -3.51, 8.06, 0.02, -3.8, -0.27, 7.17, -14.01, -0.01, -0.01, -0.67, 7.81, 71.31, -29.0, 0.01, -0.15, -4.46, 0.72, 6.46, -28.0, 0.05, -0.07, 13.32, -6.34, -14.73, -2.7, 0.21, 3.39, -0.0, 51.61, 20.16, -4.0, 0.0, 0.0, -0.0, 2.94, 2.53, -2.78, 0.0, 0.0, -0.0, 5.46, 0.0, -3.5, 0.55, 2.15, -0.0, 0.0, 0.0, -5.66, -0.1, 1.08, -0.0, 15.0, 19.35, -3.93, 0.0, 0.0, -0.0, 0.0, 19.35, -2.23, 0.0, 0.0, -0.0, 0.0, 19.35, -3.67, 0.56, 0.82, -0.0, 0.0, 0.0, -5.62, -0.09, 0.34, -0.0, 0.0, 23.71, -4.29, 0.0, 0.0, -0.0, 0.0, 23.71, -2.69, 0.0, 0.0, -0.0, 0.0, 23.71, -3.65, 0.58, -0.14, -0.0, 0.0, 0.0, -5.03, -0.02, -0.52, -0.0, -15.0, 22.43, -3.74, 0.0, 0.0, -0.0, 0.0, 22.43, -2.59, 0.0, 0.0, -0.0, 0.0, 22.43, -3.43, 0.51, -1.3, -0.0, 0.0, 0.0, -4.5, -0.02, -1.18, -0.0, -25.0, 18.58, -2.99, 0.0, 0.0, -0.0, 0.0, 18.58, -1.89, 0.0, 0.0, -0.0, 0.0, 18.58, 3.49, 8.08, 0.03, 2.26, 10.43, -4.93, 14.02, 0.02, 0.07, 4.27, -8.99, -74.93, 29.0, 0.1, 0.04, -2.67, -3.66, 4.19, 28.01, 0.05, 0.03, 4.62, 3.08, 7.23, 2.7, 0.21, 3.39, -0.0, -52.71, -22.76, 4.0, 0.0, 0.0, -0.0, -3.65, 0.68, 2.78, 0.0, 0.0, -0.0, -2.84, 0.0, 3.5, 0.55, 2.15, -0.0, 0.0, 0.0, 5.66, -0.1, 1.08, -0.0, -15.0, -14.1, 3.93, 0.0, 0.0, -0.0, 0.0, -14.1, 2.23, 0.0, 0.0, -0.0, 0.0, -14.1, 3.67, 0.56, 0.82, -0.0, 0.0, 0.0, 5.62, -0.09, 0.34, -0.0, 0.0, -17.7, 4.29, 0.0, 0.0, -0.0, 0.0, -17.7, 2.69, 0.0, 0.0, -0.0, 0.0, -17.7, 3.65, 0.58, -0.14, -0.0, 0.0, 0.0, 5.03, -0.02, -0.52, -0.0, 15.0, -18.98, 3.74, 0.0, 0.0, -0.0, 0.0, -18.98, 2.59, 0.0, 0.0, -0.0, 0.0, -18.98, 3.43, 0.51, -1.3, -0.0, 0.0, 0.0, 4.5, -0.02, -1.18, -0.0, 25.0, -24.32, 2.99, 0.0, 0.0, -0.0, 0.0, -24.32, 1.89, 0.0, 0.0, -0.0, 0.0, -24.32]
mocap_manager = RLPy.RGlobal.GetMocapManager()
body_device_ID = "YourDeviceID"
body_device = mocap_manager.AddBodyDevice(body_device_ID)
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
body_device.AddAvatar(avatar)
body_device.SetEnable(avatar, True)
body_setting = body_device.GetBodySetting(avatar)
body_setting.SetReferenceAvatar(avatar)
body_setting.SetActivePart(RLPy.EBodyActivePart_FULL_BODY)
body_setting.SetMotionApplyMode(RLPy.EMotionApplyMode_REFERENCE_TO_COORDINATE)
body_device.SetBodySetting(avatar, body_setting)
device_setting = body_device.GetDeviceSetting()
device_setting.SetMocapCoordinate(RLPy.ECoordinateAxes_Y, RLPy.ECoordinateAxes_Z, RLPy.ECoordinateSystem_RIGHT_HAND)
device_setting.SetCoordinateOffset(0, [0, 0, 0])
position_setting = device_setting.GetPositionSetting()
rotation_setting = device_setting.GetRotationSetting()
rotation_setting.SetType(RLPy.ERotationType_EULER)
rotation_setting.SetUnit(RLPy.ERotationUnit_DEGREES)
rotation_setting.SetEulerOrder(RLPy.EEulerOrder_ZXY)
rotation_setting.SetCoordinateSpace(RLPy.ECoordinateSpace_LOCAL)
position_setting.SetUnit(RLPy.EPositionUnit_CENTIMETERS)
position_setting.SetCoordinateSpace(RLPy.ECoordinateSpace_LOCAL)
body_device.SetTPoseData(t_pose_data)
body_device.Initialize(bone_list)
if body_device.IsTPoseReady() == True:
#Record or Preview
mocap_manager.Start(RLPy.EMocapState_MOCAP_RECORD)
fram1_time = 1000
fram2_time = 5000
body_device.ProcessData(fram1_data, fram1_time)
body_device.ProcessData(fram2_data, fram2_time)
mocap_manager.Stop()
Member Functions
GetBodySetting
RLPy.RIBodyDevice.GetBodySetting ( self, spAvatar )
Get body setting.
Parameters
spAvatar [IN] avatar - RLPy.RIAvatar
Returns
GetDeviceSetting
RLPy.RIBodyDevice.GetDeviceSetting ( self )
Get RDeviceSetting.
Returns
GetProcessDataIndex
RLPy.RIBodyDevice.GetProcessDataIndex ( self, spAvatar )
Get device data index.
Parameters
spAvatar [IN] avatar - RLPy.RIAvatar
Returns
Initialize
RLPy.RIBodyDevice.Initialize ( self, kBoneList )
Initialize body mocap setting.
Parameters
kBoneList [IN] device mocap input bone list - string
Return Values
RLPy.RStatus.Success Success
RLPy.RStatus.Failure Fail
IsTPoseReady
RLPy.RIBodyDevice.IsTPoseReady ( self, spAvatar )
is T-Pose set ready
Parameters
spAvatar [IN] avatar - RLPy.RIAvatar
Returns
ProcessData
RLPy.RIBodyDevice.ProcessData ( self, nDataIndex, kData, nDeviceTime = -1 )
Set device data to IC avatar.
Parameters
nDataIndex [IN] device data index - int
kData [IN] device data - float
nDeviceTime [IN] device time in millisecond - int
Return Values
RLPy.RStatus.Success Success
RLPy.RStatus.Failure Fail
SetBodySetting
RLPy.RIBodyDevice.SetBodySetting ( self, args )
Set body setting.
Parameters
kAvatarList [IN] avatar list - RLPy.RIAvatar
spSetting [IN] body setting - RLPy.RBodySetting
Return Values
RLPy.RStatus.Success Success
RLPy.RStatus.Failure Fail
SetProcessDataIndex
RLPy.RIBodyDevice.SetProcessDataIndex ( self, spAvatar, nIndex )
Set device data index.
Parameters
spAvatar [IN] avatar - RLPy.RIAvatar
nIndex [IN] data index - int
Return Values
RLPy.RStatus.Success Success
RLPy.RStatus.Failure Fail
SetTPoseData
RLPy.RIBodyDevice.SetTPoseData ( self, spAvatar, kData )
Set T-Pose data to IC avatar.
Parameters
spAvatar [IN] avatar - RLPy.RIAvatar
kData [IN] T-Pose data - float
Return Values
RLPy.RStatus.Success Success
RLPy.RStatus.Failure Fail
Inherited By
This class is inherited by the following classes:
Class | Description |
---|---|
IDeviceBase | This is the base class of all device class. |