BIPOP

# Tutorial

## Trajectory.sci

Brief: defines the trajectory to follow.

### Details and location

In the case of this tutorial, the function [q, qdot, qddot] = Trajectory(time) is defined in the ActuationModel/NoDynamics/ComputedTorqueControl directory. In this application, there is no actuators dynamics, what means that when we want to apply a torque to a joint, it is applied instantaneously. In our case, the torques to apply are not known in advance, but we know the trajectory that the model should follow. The Computed Torque Control will compute the torques to apply to the joints of the model in order to follow this trajectory. For this control law to work, the trajectory needs to be fully specified: position, velocity and acceleration of every joints at every time.

### Definition

Let's propose a simple trajectory to the human model we use here. In the Trajectory.sci file in the ActuationModel/NoDynamics/ComputedTorqueControl directory, write the following lines after the definition of the SitToStand trajectory and just before the end command corresponding to the if TrajectoryName == 'SitToStand':

``` elseif TrajectoryName == 'ArmMovement' then
position = zeros(42,1);
velocity = zeros(42,1);
acceleration = zeros(42,1);

position(20) = sin(%pi*t)*%pi/3 + %pi/2;
velocity(20) = %pi*cos(%pi*t);
acceleration(20) =-%pi^2*sin(%pi*t);

contacts = [1:8, 12+(1:8), 12*2+(1:8)]
```

The trajectory corresponds to a movement upward and downward of the arm (20th degree of freedom). Velocity and acceleration are obtained by direct differentiation. Everything else should not move (a very simple trajectory, as we said), all this without any changes in the contacts. To understand the last line, you need to know more about the contacts in HuMAnS. The toolbox works with a vector containing the position of all the potential contact points: in this case, the 8 first points, corresponding to the feet, are considered to be in contact, out of the 12 potential contact points. You need to select then all the X, Y and Z components, which are stored in a single vector in that strict order (see page 25 of the User Documentation), what explains the structure of the vector contacts here.

Last modification: