This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== High Jump ====== <callout type="info" icon="true" title="About">This tutorial demonstrates how to use **feed-forward control** to perform a standing high jump task. It shows how to use different types of **functions** for feed-forward control, as well as the how to setup the objective function.</callout> ==== Piece-Wise Constant Control ==== * Click on ''File -> Open...'', and open ''Tutorials/Tutorial 2a - High Jump.scone'' In the editor, you'll see a section called 'Controller', with the following code: <code python> # Controller for the Model FeedForwardController { symmetric = 1 # Function for feed-forward pattern PieceWiseConstant { control_points = 2 control_point_y = 0.3~0.01<0,1> # Initial y value of control points control_point_dt = 0.2~0.01<0,1> # initial delta time between control points } } </code> <callout type="warning" icon="true">Keywords in SCONE are **case sensitive**.</callout> {{ :scone-parameters.png?nolink|}} The [[ref:feed_forward_controller]] is the type of controller, and the [[ref:function]] defines the type of function. In this case, we define a [[ref:piece_wise_constant_function]] function with two control points, and a variable time between control points. The values after ''control_point_y'' and ''control_point_dt'' define [[doc:parameters|parameters]] to be optimized, and have the following format: ''//mean//''~''//standard deviation//''<''//minimum//'', ''//maximum//''> The actual [[doc:parameters|parameters]] that are used in this scenario are shown in the //Parameters Window// (see picture on the right-hand side), which can be activated by ''Windows -> Parameters''. Here you will see the setpoints ''Y1'' and ''Y2'' for each muscle, as well as the time delta ''DT0'' between the setpoints. * To start the optimization, click on ''Scenario -> Optimize Scenario'' If you do not wish to optimize a parameter, for instance if you wish to use a piece-wise function with a fixed time interval of 0.1 seconds, simply change ''control_point_dt'' to: <code python> control_point_dt = 0.1 # this parameter is no longer optimized </code> Alternatively, you can change the initial mean and standard deviation for each of the parameters. ==== Polynomial Control ==== Instead of using a [[ref:piece_wise_constant_function]] function, it is also possible to use a [[ref:piece_wise_linear_function]] function or a [[ref:polynomial]], simply by changing the ''type'' of the function. To use a polynomial to define the muscle excitation signal for each muscle, change the code into the following (see also ''Tutorials/Tutorial 2b - High Jump Polynomial.scone''): <code python> # Controller for the Model FeedForwardController { symmetric = 1 # 2nd degree polynomial ax^2 + bx + c Polynomial { degree = 2 coefficient0 = 0.3~0.01<0,1> # initial value for c coefficient1 = 0~0.1<-10,10> # initial value for b coefficient2 = 0~0.1<-10,10> # initial value for a } } </code> You can see in the //Parameters// window that the name of the parameters has changed -- these now represent the coefficients of the polynomial function that describes the excitation curve for each muscle. ==== Straight Pose Jump ==== If you have run the optimization for a while, you will notice that the model has a tendency to lean backwards during the jump. The reason for this is that our optimization objective only cares about how high it jumps, not about the pose of its upper body. The objective function is defined by the [[ref:objective]] and [[ref:measure]] tags. The objective type is a [[ref:simulation_objective]], which is used for objective functions that are the result of a simulation. Inside the [[ref:objective]] you'll find the [[ref:measure]] that defines the //fitness function// of the objective. By default, [[ref:jump_measure]] measures the maximum height of the Center of Mass (COM) of the model. We can add an additional term to also take into account the orientation of the upper body (see also ''Tutorial 2c - Straight Pose Jump.scone''): <code python> # Composite measure for straight pose jumping CompositeMeasure { # Fitness measure for jumping JumpMeasure { termination_height = 0.75 prepare_time = 0.2 } # Penalize backwards leaning pose DofMeasure { dof = pelvis_tilt position { min = -45 max = 0 abs_penalty = -10 } } } </code> We changed the measure type to [[ref:composite_measure]], and combine our [[ref:jump_measure]] with an additional [[ref:dof_measure]]. The [[ref:dof_measure]] adds a penalty when a specific Degree of Freedom (DOF) is outside a specific range. In this case, we define the valid range to be between -45 and 0 degrees, and apply a fitness value of -10 per degree at which the pelvis_tilt is outside this range. ==== Analyzing the Results ==== After clicking on one of the results, analyze the activation patterns in the ''Analysis'' tool, to find out what jumping strategies are found by the optimizer.