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

WIP: Perception Neuron MoCap example #366

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,272 changes: 1,272 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/BVH-files/Sit-Stand3_chr00.bvh

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/BVHSettings.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Main.ModelSetup.BVHFileData =
{
FileName = MOCAP_C3D_DATA_PATH +"/"+ Main.ModelSetup.TrialSpecificData.TrialFileName + ".bvh"; //add the extension to the file name here

ModelDrawOnOff = On;
ModelDrawScale =0.15;
ModelDrawRGBs={{212,49,117}/256,{0.2,0.1,0.3},{49,171,212}/256};


// Positions in BVH file are in centi meters
TranslationScale = 0.01;
// Angles are in degrees.
RotationScale = pi/180.0;


InitialPos_FrameNo=Main.ModelSetup.TrialSpecificData.FirstFrame;

Rotation2PiFixOnOff = On;
Rotation1PiFixOnOff = Off;

InterPolType = PiecewiseLinear ;

};


22 changes: 22 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/BodyModelConfig.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#path __BM_PLUGIN_FILE__ "BodyModelConfig.any"
#define BM_CONFIG_PLUGIN __BM_PLUGIN_FILE__
// ----------------------------------------------------------
// Model configuration:
// For more info on body model configuration options please load the model and double click on:
// #path HTML_DOC "<AMMR_PATH_DOC>/bm_config/index.html"
// ----------------------------------------------------------
Main = {

#define BM_LEG_MODEL _LEG_MODEL_TLEM2_
#define BM_TRUNK_CERVICAL_MUSCLES OFF
#define BM_SCALING _SCALING_XYZ_
#define BM_MANNEQUIN_DRIVER_DEFAULT OFF

#define BM_TRUNK_MUSCLES OFF
#define BM_ARM_RIGHT ON
#define BM_ARM_LEFT ON
#define BM_ARM_MUSCLES_RIGHT OFF
#define BM_ARM_MUSCLES_LEFT OFF


};
51 changes: 51 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/C3DSettings.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//AnyInputC3D
Main.ModelSetup.C3DFileData = {

FileName = MOCAP_C3D_DATA_PATH +"/"+ Main.ModelSetup.TrialSpecificData.TrialFileName + ".c3d"; //add the extension to the file name here

// Search/replace in marker names.
// This option can be used to remove
// prefixes from marker name, or replace
// characters from which are illegal in AnyScript
SearchAndReplace = {
/*{"old", "new"},*/
{"WeirdMarkerPrefix", ""}
};

ConstructModelOnOff = Off;
ConstructChartOnOff = Off;

MarkerUseAllPointsOnOff = On;
MarkerUseCamMaskOnOff = Off;
PointsScaleFactor = 1/1000;
MarkerDrawOnOff = On;

AnyInt MarkerFilterOrder = 1;
AnyInt AnalogFilterOrder = 1;

MarkerFilterIndex = 0;
AnalogFilterIndex = 1;

MarkerBsplineOrder = 4;

Filter = {
N = .MarkerFilterOrder;
Fc = {5};
Type = LowPass;
};

/// This filter is used for the analog data
AnyFunButterworthFilter LowPassFilter = {
AutomaticInitialConditionOnOff = On;
N = .AnalogFilterOrder ;
AnyVar CutOffFrequency=12;
AnyVar SampleFreq=.Header.VideoFrameRate* .Header.NoAnalogSamplesPer3DFrame ;
W = {CutOffFrequency/(iffun(eqfun(SampleFreq,0),100.0,SampleFreq)*0.5)};
Type = LowPass;
};

MarkerScaleXYZ = 0.015*{1,1,1};
MarkerRGB={0,0,1};


};

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@

#define BVH_MODEL Main.ModelSetup.BVHFileData.Model

//Main.HumanModel.Anthropometrics.SegmentScaleFactors ={
// AnyFolder& StdPar = Main.HumanModel.Scaling.StandardParameters;
// Pelvis = {
// AnyVar bvh_pelvis_width = vnorm(BVH_MODEL.Hips.Seg.RightUpLeg.sRel-
// BVH_MODEL.Hips.Seg.LeftUpLeg.sRel); ///< distance between hip joints
//
// WidthScale = bvh_pelvis_width/0.1631771; // This distance is the distance of the hip joint center of a model with height 1.724318181818. This is the height of the person for a standard pelvis width (0.1686071)//.StdPar.Pelvis.Width;
// DepthScale = WidthScale;
// LengthScale = WidthScale;
// };
//
// Thorax = {
// AnyVar bvh_trunk_height =
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Seg.Spine.sRel) +
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Seg.Spine1.sRel) +
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Seg.Spine2.sRel) +
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Seg.Spine3.sRel)+
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.Seg.Neck.sRel);
//
// AnyVar bvh_shoulder_width =
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.Seg.RightShoulder.sRel-
// Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.Seg.LeftShoulder.sRel)+
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.Seg.LeftArm.sRel)+
// vnorm( Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.RightShoulder.Seg.RightArm.sRel);
//
// LengthScale = bvh_trunk_height/0.571014; // Distance for subject with height 1.8 .StdPar.Trunk.Height;
// WidthScale = bvh_shoulder_width /0.3715324; // Distance for subject with height 1.8
// DepthScale = WidthScale;
// };
//
// Lumbar = {
// LengthScale = .Thorax.LengthScale;
// WidthScale = .Thorax.WidthScale;
// DepthScale = .Thorax.DepthScale;
// };
//
// Head = {
// AnyVar bvh_head_height = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.Neck.Head.Seg.End_Site.sRel);
// LengthScale = bvh_head_height /0.20197; // Distance for subject with height 1.8 .StdPar.Head.Height;
// WidthScale = LengthScale;
// DepthScale = LengthScale;
// };
// Right.Clavicula = {
// LengthScale = ..Thorax.WidthScale;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Left.Clavicula = {
// LengthScale = ..Thorax.WidthScale;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Right.Scapula = {
// LengthScale = ..Thorax.WidthScale;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Left.Scapula = {
// LengthScale = ..Thorax.WidthScale;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Right.Humerus = {
// AnyVar bvh_upperarm_length = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.RightShoulder.RightArm.Seg.RightForeArm.sRel);
// LengthScale = bvh_upperarm_length/0.335480637; //Distance for subject with height 1.8; //..StdPar.Humerus.Length;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Left.Humerus = {
// AnyVar bvh_upperarm_length = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.Seg.LeftForeArm.sRel);
// LengthScale = bvh_upperarm_length/0.335480637; //Distance for subject with height 1.8 ..StdPar.Humerus.Length;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Right.Ulna = {
// AnyVar bvh_lowerarm_length = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.RightShoulder.RightArm.RightForeArm.Seg.RightHand.sRel);
// LengthScale = bvh_lowerarm_length/0.271635; // Distance for subject with height 1.8//..StdPar.Ulna.Length;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Left.Ulna = {
// AnyVar bvh_lowerarm_length = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.Seg.LeftHand.sRel);
// LengthScale = bvh_lowerarm_length/0.271635; //Distance for subject with height 1.8 ..StdPar.Ulna.Length;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Right.Radius = {
// LengthScale = .Ulna.LengthScale;
// DepthScale = .Ulna.DepthScale;
// WidthScale = .Ulna.WidthScale;
// };
// Left.Radius = {
// LengthScale = .Ulna.LengthScale;
// DepthScale = .Ulna.DepthScale;
// WidthScale = .Ulna.WidthScale;
// };
// Right.Hand = {
// AnyVar bvh_hand_length = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.Seg.LeftInHandMiddle.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.Seg.LeftHandMiddle1.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.LeftHandMiddle1.Seg.LeftHandMiddle2.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.LeftHandMiddle1.LeftHandMiddle2.Seg.LeftHandMiddle3.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.LeftHandMiddle1.LeftHandMiddle2.LeftHandMiddle3.Seg.End_Site.sRel);
// LengthScale = bvh_hand_length/0.16536859; // This is the standard hand length for a subject with height 1.72
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Left.Hand = {
// AnyVar bvh_hand_length = vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.Seg.LeftInHandMiddle.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.Seg.LeftHandMiddle1.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.LeftHandMiddle1.Seg.LeftHandMiddle2.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.LeftHandMiddle1.LeftHandMiddle2.Seg.LeftHandMiddle3.sRel)
// +vnorm(Main.ModelSetup.BVHFileData.Model.Hips.Spine.Spine1.Spine2.Spine3.LeftShoulder.LeftArm.LeftForeArm.LeftHand.LeftInHandMiddle.LeftHandMiddle1.LeftHandMiddle2.LeftHandMiddle3.Seg.End_Site.sRel);
// LengthScale = bvh_hand_length/0.16536859;
// DepthScale = LengthScale;
// WidthScale = LengthScale;
// };
// Right.Thigh = {
// AnyVar bvh_thigh_length= vnorm(Main.ModelSetup.BVHFileData.Model.Hips.RightUpLeg.Seg.RightLeg.sRel);
// LengthScale = bvh_thigh_length/0.36168; // Distance for subject with height 1.6163..StdPar.Right.Thigh.Length;
// DepthScale = 1;
// WidthScale = 1;
// };
// Left.Thigh = {
// AnyVar bvh_thigh_length= vnorm(Main.ModelSetup.BVHFileData.Model.Hips.LeftUpLeg.Seg.LeftLeg.sRel);
// LengthScale = bvh_thigh_length/0.36168; // Distance for subject with height 1.6163..StdPar.Left.Thigh.Length;
// DepthScale = 1;
// WidthScale = 1;
// };
// Right.Shank = {
// AnyVar bvh_shank_length=vnorm(Main.ModelSetup.BVHFileData.Model.Hips.RightUpLeg.RightLeg.Seg.RightFoot.sRel);
// LengthScale = bvh_shank_length/0.36784; // Distance for subject with height 1.57298 ..StdPar.Right.Shank.Length;
// DepthScale = 1;
// WidthScale = 1;
// };
// Left.Shank = {
// AnyVar bvh_shank_length=vnorm(Main.ModelSetup.BVHFileData.Model.Hips.LeftUpLeg.LeftLeg.Seg.LeftFoot.sRel);
// LengthScale = bvh_shank_length/0.36784; // Distance for subject with height 1.57298 ..StdPar.Left.Shank.Length;
// DepthScale = 1;
// WidthScale = 1;
// };
// Right.Foot = {
// AnyVar bvh_foot_length =vnorm(Main.ModelSetup.BVHFileData.Model.Hips.RightUpLeg.RightLeg.RightFoot.Seg.End_Site.sRel[2]);
// AnyVar bvh_foot_height =vnorm(Main.ModelSetup.BVHFileData.Model.Hips.RightUpLeg.RightLeg.RightFoot.Seg.End_Site.sRel[1]);
// LengthScale = bvh_foot_length/0.15954434; // ..StdPar.Right.Foot.Length;
// DepthScale = bvh_foot_height/0.07558622;
// WidthScale = DepthScale;
// };
// Left.Foot = {
// AnyVar bvh_foot_length =vnorm(Main.ModelSetup.BVHFileData.Model.Hips.LeftUpLeg.LeftLeg.LeftFoot.Seg.End_Site.sRel[2]);
// AnyVar bvh_foot_height =vnorm(Main.ModelSetup.BVHFileData.Model.Hips.LeftUpLeg.LeftLeg.LeftFoot.Seg.End_Site.sRel[1]);
// LengthScale = bvh_foot_length/0.15954434; //..StdPar.Left.Foot.Length;
// DepthScale = bvh_foot_height/0.07558622;
// WidthScale = DepthScale;
// };
//};


32 changes: 32 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/ExtraDrivers.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// This file contains a set of auxillary drivers. They are usefull/necessary
// in some cases where the marker protocol doesn't provide enough information
// to specify all degrees of freedom. Hence, these drivers complement a
// specific driver protocol. Many of these drivers are soft, and an only serve
// to stabalize the solver in postures where the markers doesn't provide unique
// kinematic solution.

AnyFolder ExtraDrivers = {


// --------------------------------------------------------------------------
// The BM_MANNEQUIN drivers are used to support the degrees of freedom where
// the markers do not provide enough information.
// See this file for options: #path HTML_DOC "<AMMR_PATH_DOC>/bm_config/index.html"
// --------------------------------------------------------------------------

#define BM_MANNEQUIN_DRIVER_WEAK_SWITCH ON

#define BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_RIGHT ON
#define BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_LEFT ON




#define BM_MANNEQUIN_DRIVER_NECK OFF



// This link to the mannequin drivers ensures they are picked up by the study.
AnyFolder& MannequinDrivers = Main.HumanModel.DefaultMannequinDrivers;

};
64 changes: 64 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/ForcePlates.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Main.EnvironmentModel.ForcePlates =
{

Main.EnvironmentModel.GlobalRef =
{
AnyRefNode FloorOffset =
{
sRel = {0,0.04,0};
};

};



//-------- Predictive forceplate for the right leg
// See: #include "<ANYBODY_PATH_AMMR>/Tools/GRFPrediction/FootPlateConditionalContact.any"
FootPlateConditionalContact GRF_Prediction_Right(
NORMAL_DIRECTION = "Y",
NUMBER_OF_NODES = 25,
NODES_FOLDER = FootNodes,
PLATE_BASE_FRAME = Main.EnvironmentModel.GlobalRef.FloorOffset,
SHOW_TRIGGER_VOLUME = ON
) =
{
CreateFootContactNodes25 FootNodes(foot_ref =
Main.HumanModel.BodyModel.Right.Leg.Seg.Foot) = {};

// Additional force plate settings
Settings =
{
LimitDistHigh = 0.025; // Vertical height
FrictionCoefficient = 0.8;
};
};






//-------- Predictive forceplate for the left leg
// See: #include "<ANYBODY_PATH_AMMR>/Tools/GRFPrediction/FootPlateConditionalContact.any"
FootPlateConditionalContact GRF_Prediction_Left(
NORMAL_DIRECTION = "Y",
NUMBER_OF_NODES = 25,
NODES_FOLDER = FootNodes,
PLATE_BASE_FRAME = Main.EnvironmentModel.GlobalRef.FloorOffset,
SHOW_TRIGGER_VOLUME = ON
) =
{
CreateFootContactNodes25 FootNodes(foot_ref =
Main.HumanModel.BodyModel.Left.Leg.Seg.Foot) = {};

Settings =
{
LimitDistHigh = 0.025;
FrictionCoefficient = 0.8;
};
};



};

27 changes: 27 additions & 0 deletions Application/MocapExamples/BVH_NeuronMoCap/LabSpecificData.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Main.ModelSetup.LabSpecificData = {

// Switch to enable Inertial MoCap functionality
#define MOCAP_INPUT_DATA_TYPE "BVH"
#path MOCAP_BVHSETTINGS "BVHSettings.any"

#define MOCAP_C3D_DATA_PATH "BVH-files"


#path BODY_MODEL_CONFIG_FILE "BodyModelConfig.any"

#path MOCAP_MARKER_PROTOCOL_FILE "MarkerProtocol.any"
#path MOCAP_EXTRA_DRIVERS_FILE "ExtraDrivers.any"

#define MOCAP_USE_GRF_PREDICTION ON
#path MOCAP_FORCE_PLATE_FILE "ForcePlates.any"

Gravity = -9.81*{0,1,0};


LowPassFilterSettings =
{
MarkerFilterCutOffFrequency = 4;
};


};
Loading