visual3d:documentation:pipeline:meta_commands:shift_force_platform_corners_using_a_meta-command
Shift Force Platform Corners Using a Meta-command
One of our customers noted that all force platforms were shifted in space by a measurable amount. It is certainly possible to modify each corner location by computing the required new corner locations, but this seemed like an interesting challenge for a meta-command. The command could be made more elegant (and more general), but this seemed a good compromise as an example.
Note: This meta-command example assumes that there are 3 force platforms, and that each of the corners will be shifted consistently by a shift in the x, y, and z components by (100,200,300).
The meta-command listed below can be called from this Visual3D script:
FP_CORNER_SHIFT /FP_NUMBERS=1+2+3 /X_SHIFT=100 /Y_SHIFT=200 /Z_SHIFT=300 ;
The following Meta Command can be Cut-and-Paste into a file named FP_CORNER_SHIFT.v3m
! BEGIN_META ! META_CMD_NAME=FP_CORNER_SHIFT ! META_PARAM= FP_NUMBERS : string ::yes ! META_PARAM= X_SHIFT : string ::yes ! META_PARAM= Y_SHIFT : string ::yes ! META_PARAM= Z_SHIFT : string ::yes ! END_META ! ---------------------------------------- ! Create a METRIC signal containing the ! force platform parameter corners ! ---------------------------------------- Metric_From_Parameter /METRIC_NAME=C3D_CORNERS /PARAMETER_GROUP=FORCE_PLATFORM /PARAMETER_NAME=CORNERS ; ! ------------------------------- ! create an offset to be used ! when parsing the corners metric ! ------------------------------- Metric_Explicit /RESULT_METRIC_NAME=OFFSET /RESULT_METRIC_FOLDER=CORNERS /METRIC_VALUE=0 ; ! ------------------------------------ ! Create a vector containing the shift ! ------------------------------------ Metric_Explicit /RESULT_METRIC_NAME=SHIFT /RESULT_METRIC_FOLDER=CORNERS /METRIC_VALUE=::X_SHIFT&+&::Y_SHIFT&+&::Z_SHIFT ; ! ------------------------------- ! clean up some temporary signals ! ------------------------------- Remove_Signals /SIGNAL_TYPES=METRIC+METRIC+METRIC+METRIC /SIGNAL_NAMES=CORNER1+CORNER2+CORNER3+CORNER4 /SIGNAL_FOLDER=CORNERS+CORNERS+CORNERS+CORNERS '; Remove_Signals /SIGNAL_TYPES=METRIC+METRIC+METRIC+METRIC /SIGNAL_NAMES=C1+C2+C3+C4 /SIGNAL_FOLDER=CORNERS+CORNERS+CORNERS+CORNERS ; ! ------------------------------------------ ! Loop over the input Force Platform numbers ! ------------------------------------------ For_Each /ITERATION_PARAMETER_NAME=INDEX /ITEMS=::FP_NUMBERS ; ! ------------------------------ ! Extract Corner values ! append the values from each FP ! ------------------------------ Evaluate_Expression /EXPRESSION=VECTOR(METRIC::PROCESSED::C3D_CORNERS[(1+METRIC::CORNERS::OFFSET)],METRIC::PROCESSED::C3D_CORNERS[2+METRIC::CORNERS::OFFSET],METRIC::PROCESSED::C3D_CORNERS[3+METRIC::CORNERS::OFFSET]) /RESULT_NAME=TEMP /RESULT_TYPE=METRIC /RESULT_FOLDER=CORNERS ; Metric_Mean /RESULT_METRIC_NAME=CORNER1 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE /RESULT_METRIC_FOLDER=CORNERS /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=TEMP /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS /EVENT_SEQUENCE= /EXCLUDE_EVENTS= /GENERATE_MEAN_AND_STDDEV=FALSE /APPEND_TO_EXISTING_VALUES=TRUE ; Evaluate_Expression /EXPRESSION=VECTOR(METRIC::PROCESSED::C3D_CORNERS[(4+METRIC::CORNERS::OFFSET)],METRIC::PROCESSED::C3D_CORNERS[5+METRIC::CORNERS::OFFSET],METRIC::PROCESSED::C3D_CORNERS[6+METRIC::CORNERS::OFFSET]) /RESULT_NAME=TEMP /RESULT_TYPE=METRIC /RESULT_FOLDER=CORNERS ; Metric_Mean /RESULT_METRIC_NAME=CORNER2 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE /RESULT_METRIC_FOLDER=CORNERS /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=TEMP /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS /EVENT_SEQUENCE= /EXCLUDE_EVENTS= /GENERATE_MEAN_AND_STDDEV=FALSE /APPEND_TO_EXISTING_VALUES=TRUE ; Evaluate_Expression /EXPRESSION=VECTOR(METRIC::PROCESSED::C3D_CORNERS[(7+METRIC::CORNERS::OFFSET)],METRIC::PROCESSED::C3D_CORNERS[8+METRIC::CORNERS::OFFSET],METRIC::PROCESSED::C3D_CORNERS[9+METRIC::CORNERS::OFFSET]) /RESULT_NAME=TEMP /RESULT_TYPE=METRIC /RESULT_FOLDER=CORNERS ; Metric_Mean /RESULT_METRIC_NAME=CORNER3 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE /RESULT_METRIC_FOLDER=CORNERS /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=TEMP /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS /EVENT_SEQUENCE= /EXCLUDE_EVENTS= /GENERATE_MEAN_AND_STDDEV=FALSE /APPEND_TO_EXISTING_VALUES=TRUE ; Evaluate_Expression /EXPRESSION=VECTOR(METRIC::PROCESSED::C3D_CORNERS[(10+METRIC::CORNERS::OFFSET)],METRIC::PROCESSED::C3D_CORNERS[11+METRIC::CORNERS::OFFSET],METRIC::PROCESSED::C3D_CORNERS[12+METRIC::CORNERS::OFFSET]) /RESULT_NAME=TEMP /RESULT_TYPE=METRIC /RESULT_FOLDER=CORNERS ; Metric_Mean /RESULT_METRIC_NAME=CORNER4 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE /RESULT_METRIC_FOLDER=CORNERS /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=TEMP /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS /EVENT_SEQUENCE= /EXCLUDE_EVENTS= /GENERATE_MEAN_AND_STDDEV=FALSE /APPEND_TO_EXISTING_VALUES=TRUE ; ! ------------------------------------------------------ ! increment the offset for parsing the Corner parameters ! ------------------------------------------------------ Add_Constant_To_Signals /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=OFFSET /SIGNAL_FOLDER=CORNERS /RESULT_NAMES=OFFSET /RESULT_FOLDER=CORNERS ! /RESULT_SUFFIX= ! /SIGNAL_COMPONENTS= /CONSTANT=12 ; End_For_Each /ITERATION_PARAMETER_NAME=INDEX ; ! -------------------------------------- ! add the offsets to each of the corners ! -------------------------------------- Add_Signals /SIGNAL_TYPES=METRIC+METRIC /SIGNAL_NAMES=CORNER1+SHIFT /SIGNAL_FOLDER=CORNERS+CORNERS /RESULT_NAME=C1 /RESULT_FOLDER=CORNERS ; Add_Signals /SIGNAL_TYPES=METRIC+METRIC /SIGNAL_NAMES=CORNER2+SHIFT /SIGNAL_FOLDER=CORNERS+CORNERS /RESULT_NAME=C2 /RESULT_FOLDER=CORNERS ; Add_Signals /SIGNAL_TYPES=METRIC+METRIC /SIGNAL_NAMES=CORNER3+SHIFT /SIGNAL_FOLDER=CORNERS+CORNERS /RESULT_NAME=C3 /RESULT_FOLDER=CORNERS ; Add_Signals /SIGNAL_TYPES=METRIC+METRIC /SIGNAL_NAMES=CORNER4+SHIFT /SIGNAL_FOLDER=CORNERS+CORNERS /RESULT_NAME=C4 /RESULT_FOLDER=CORNERS ; ! ------------------------------------------------ ! create pipeline parameters to be used ! for the modify_force_platform_parameters command ! ------------------------------------------------ Set_Pipeline_Parameter_To_Data_Value /PARAMETER_NAME=C1 /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=C1 /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ; Set_Pipeline_Parameter_To_Data_Value /PARAMETER_NAME=C2 /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=C2 /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ; Set_Pipeline_Parameter_To_Data_Value /PARAMETER_NAME=C3 /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=C3 /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ; Set_Pipeline_Parameter_To_Data_Value /PARAMETER_NAME=C4 /SIGNAL_TYPES=METRIC /SIGNAL_NAMES=C4 /SIGNAL_FOLDER=CORNERS ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ; ! ---------------------------------- ! Modify the corners ! not that FP_USED must be specified ! ---------------------------------- Modify_Force_Platform_Parameters /FP_USED=3 /FP_CORNER1=::C1 /FP_CORNER2=::C2 /FP_CORNER3=::C3 /FP_CORNER4=::C4 ; ! ------------------------------- ! clean up some temporary signals ! ------------------------------- Remove_Signals /SIGNAL_TYPES=METRIC+METRIC+METRIC+METRIC /SIGNAL_NAMES=CORNER1+CORNER2+CORNER3+CORNER4 /SIGNAL_FOLDER=CORNERS+CORNERS+CORNERS+CORNERS ; Remove_Signals /SIGNAL_TYPES=METRIC+METRIC+METRIC+METRIC /SIGNAL_NAMES=C1+C2+C3+C4 /SIGNAL_FOLDER=CORNERS ;
visual3d/documentation/pipeline/meta_commands/shift_force_platform_corners_using_a_meta-command.txt · Last modified: 2024/07/17 11:46 by sgranger