Skip to main content

Design Optimization

Tutorial Developers: Robert Salati, B.J. Fregly, Rice Computational Neuromechanics Lab, Rice University

Last Updated: 3/10/2026

For the last step in the soccer kicking example, you will use the Design Optimization (DO) tool to design a better soccer kicking motion. This will be done in multiple ways:

  1. Using a constraint on the toe marker velocity
  2. Using a user defined cost term to increase toe marker velocity
  3. Allowing the DO problem to change the final time of the problem

Setting up a DO settings file

  1. Copy and paste your settings file VOSettings.xml and name it DOSettings.xml
  2. Open DOSettings.xml in a text editor and change the XML headings at the top and bottom of the file from <VerificationOptimizationTool> to <DesignOptimizationTool>
  3. Change <initial_guess_directory> and <tracked_quantities_directory> to VOResults
  4. In the Final_Toe_Marker_Velocity_Value constraint, change the max error to 14.4 and the min error to 14.3
  5. Save this settings file.

Running DO

Open runDOTool.m in Matlab and click run

Runtime

This DO run takes 36 iterations to finish.

Exploration Opportunities

Modification #1: Add free final time

In a text editor, copy and paste the following into your settings file:

<final_time_range>0.26 0.36</final_time_range>

Modification #2: Add a user defined cost term:

In a text editor, copy and paste the following cost term into your RCNL Cost Term set:

<RCNLCostTerm name="User_Defined_Cost_Term" >
<!--Indicate whether the term is enabled or not. Default is false.-->
<is_enabled>true</is_enabled>
<!--Type of cost term.-->
<type>user_defined</type>
<!--Name of Matlab function containing cost term implementation.-->
<function_name>footSpeedCost</function_name>
<!--Type of cost term (discrete or continuous).-->
<cost_term_type>discrete</cost_term_type>
<!--Required cost term input.-->
<marker_name>R_Toe</marker_name>
<!--Required cost term input.-->
<target_speed>14.35</target_speed>
</RCNLCostTerm>

Disable the Final_Toe_Marker_Velocity_Value constraint term

Modificiation #3: Add a user defined constraint term:

In a text editor, copy and paste the following constraint term into your RCNL Constraint Term set:

<RCNLConstraintTerm name="User_Defined_Constraint_Term">
<!--Flag (true, false) indicating whether this contraint term is enabled. Default is false.-->
<is_enabled>true</is_enabled>
<!--Type of constraint term.-->
<type>user_defined</type>
<!--Type of constraint term (path or terminal).-->
<constraint_term_type>terminal</constraint_term_type>
<!--Name of Matlab function defining constraint term.-->
<function_name>footSpeedConstraint</function_name>
<!--Space separated list containing markers to be included in this cost term.-->
<marker_name>R_Toe</marker_name>
<!--Maximum error allowed by this constraint term.-->
<max_error>14.4</max_error>
<!--Minimum error allowed by this constraint term.-->
<min_error>14.3</min_error>
</RCNLConstraintTerm>

Make sure both the other user defined cost term and toe velocity constraint term are disabled.