Collocation has been a popular method to compute walking motions for humanoid robots using whole-body models and contact constraints, such as in [20; 21], where motions could be obtained in a time in the range of minutes to hours. In previous works, we have achieved the first walking motions on one of the most disseminated complex humanoid robots iCub [22], by means of the table cart model and ZMP criterion [8], allowing the robot to achieve walking on level ground and, for the first time, on slopes and stairs, with the aim of measuring the walking capabilities of iCub. In particular, this work has been performed on the reduced version of the iCub available in our lab with neither head and arms (named the HeiCub(iCub of Heidelberg University)), but the results are transferable to the full iCub models. We later improved the walking performances by means of a closed-loop control scheme based on NMPC, which allowed the robot to be able to change walking directions online [23]. In this work, instead, we want to use the whole-body dynamic model of the robot to generate walking motions on level ground. Similar to the setup of the problem for HRP-2 in [15], here, we formulate the optimal control problem for walking using the detailed model of the the humanoid robot iCub/HeiCub. In the optimal control problem, we set several objective functions and constraints to describe the hybrid dynamics of walking and to respect the physical constraints of the robot itself. In contrast to [20; 21], the problem is solved using a direct multiple direct shooting method [24], which allows obtaining precise and accurate results and has been used previously to obtain open-loop stable robot motions [25]. The obtained motions are then transferred to the robot, and the outcomes are discussed with a comparison with the motions we had previously achieved on the same robot with reduced models. The main contributions of this paper consist of:  
* Formulation of the whole-body dynamic model for walking problems for the humanoid robot iCub. * Formulation of the optimal control problem for a complex walking sequence involving cyclic, as well as non-cyclic motion phases. * The use of a direct multiple shooting method, which allows solving the equations of motion at a high precision at all times in the gait and to precisely take into account the kinematic and dynamic constraints of the robot. * Implementation and experimental validation on the HeiCub humanoid, a reduced iCub, with computation of performance indicators as a comparison with motions generated using reduced models. This paper is organized as follows: In Section 2, we give a description of the iCub humanoid robot and its reduced version HeiCub. Section 3 describes in detail the different walking phases involved in the optimal control problem, as well as the dynamics equations in all cases. In Section 4, we illustrate the optimal control problem formulation giving the details of states, controls, parameters, objective functions and constraints. Section 5 shows the numerical results and the software tools used, followed by the experimental results obtained on the robot in Section 6. The paper concludes in Section 7 with a final discussion of the work and conclusions, as well as possible future developments.