Manuscript Offprint
arXiv:2611.05585Contact-Implicit Whole-Body Trajectory Optimization for Dynamic Humanoid Locomotion on Parameterizable Uneven Terrain
AUTHOR'S CORRECTED VERSION OF: IEEE ROBOTICS AND AUTOMATION LETTERS, VOL. 10, NO. 11, PP. 11674–11681, NOV. 2025. DOI: 10.1109/LRA.2025.3614066
1
Contact-Implicit Whole-Body Trajectory Optimization for Dynamic Humanoid Locomotion on Parameterizable Uneven Terrain
Roberto Mauceri , Stefano Dafarra , Giulio Romualdi , Marco Gabiccini , and Daniele Pucci
Abstract—This letter presents a trajectory planner for humanoid robots to perform dynamic motions on complex, parameterizable terrains using a contact-implicit whole-body optimization framework. The planner generates feasible movements without predefined contact sequences, considering the robot's full dynamics and kinematics. To plan bipedal locomotion on steps, ramps, and other terrains, we propose a mathematical model to approximate ground geometry with a smooth surface. The rigid interaction between the robot and the ground is modeled via novel contact constraints, extending the domain of applicability from flat and horizontal surfaces to any arbitrary smooth surface. Effectiveness is demonstrated using nonlinear programming to plan motions on various terrain topologies. We also explore dynamic trajectory generation by embedding high-level requirements in the cost function and the initial guess. Preliminary feasibility tests were conducted over non-coplanar terrains, both in simulation and on the real robot ErgoCub.
Index Terms—Humanoid and bipedal locomotion, optimization and optimal control, whole-body motion planning and control.
A successful physics-based strategy for motion planning is trajectory optimization (TO), which selects, from the infinite set of physically feasible trajectories, those that globally or locally minimize metrics encoding a desired behavior [1]. TO offers a high level of abstraction and provides powerful tools for the explicit management of contact constraints (e.g., mixed-integer convex programming (MICP) [2] or linear complementarity problem [3]). It has proven effective in robotics fields that require creating and breaking contacts with the environment, such as manipulation [4]–[6] and legged locomotion [3], [7]–[16]. Common terrain modeling approaches for legged locomotion rely on planar region extraction from point clouds to simplify foothold planning [17], [18], while others explore continuous terrain representations [19] or discretized heightmaps [15], enabling richer geometric descriptions.
Traditional TO approaches rely on predefined contacts, where contact locations and timings are fixed in advance. In [20], the authors explored robust walking on uneven terrain using convex programming (CP), which ensures global optimality. Given predefined footstep locations and timings, their approach regulates the robot centroidal dynamics (CD) while satisfying the contact wrench cone criterion [21], [22]. Footholds are selected based on the method proposed in [8]. The terrain is modeled as stepping stones with flat convex regions where foot placement is permitted. Recent work has advanced these ideas by integrating contact location determination and motion planning into a unified CP framework, addressing challenges of terrain adaptability and dynamic motion for quadrupeds [12] (Table I). To mitigate the combinatorial complexity of MICP, [13] leveraged the sparsity properties of L1-norm minimization and a center-of-mass (CoM) model to reformulate contact planning as a feasibility linear program. Their approach, validated in humanoid simulations, shows promise for online planning on non-flat terrain (Table I).
To overcome the limitations of predefined contacts, contact-implicit approaches let the planner freely determine them, offering greater flexibility and adaptability [16]. A common technique is the use of complementarity conditions (CCs), which encode rigid contacts and allow smooth transitions between free motion and contact phases [3], [7]. However, CCs are non-convex and introduce nonlinearities, making optimization challenging and often ill-conditioned. Several strategies address these issues: relaxed CCs add a small tolerance in the contact constraints [23], penalty-based approaches penalize CC violations within the cost function [4], and dynamic CCs reformulate the conditions using Baumgarte stabilization [14].
Nonlinear programming (NLP) provides an alternative to MICP when models deviate from convexity. Convex formu-
Manuscript received April, 21, 2025; Revised June, 19, 2025; Accepted September, 5, 2025.
This paper was recommended for publication by Editor A. Kheddar upon evaluation of the Associate Editor and Reviewers' comments.
Roberto Mauceri, Stefano Dafarra, Giulio Romualdi and Daniele Pucci are with the Artificial and Mechanical Intelligence, Istituto Italiano di Tecnologia, 16163 Genoa, Italy. Roberto Mauceri and Daniele Pucci are also with the Dept. of Computer Science, University of Manchester, Manchester M13 9PL, U.K. (e-mail: roberto.mauceri@iit.it; stefano.dafarra@iit.it; giulio.romualdi@iit.it; daniele.pucci@iit.it).
Marco Gabiccini is with the Dept. of Civil and Industrial Engineering, University of Pisa, 56126 Pisa, Italy (e-mail: m.gabiccini@ing.unipi.it).
This author-corrected version fixes typos in Eqs. (7)–(8) and includes minor textual clarifications. The implementation and results are unchanged.
© 2025 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works.
AUTHOR'S CORRECTED VERSION OF: IEEE ROBOTICS AND AUTOMATION LETTERS, VOL. 10, NO. 11, PP. 11674–11681, NOV. 2025. DOI: 10.1109/LRA.2025.3614066
lations typically rely on simplified or reduced models to preserve convexity, so they cannot capture whole-body dynamics (WBD) or highly dynamic trajectories on non-convex terrain. NLP, on the other hand, accommodates system nonlinearities and enables the exploration of richer, more realistic dynamic motions [3], [7], [14]. However, NLP is challenged by multiple local minima induced by terrain morphology and locomotion patterns, requiring careful initial guess selection to enhance the likelihood of finding optimal solutions. Solving the nonlinear equations in NLP can be computationally intensive and prone to numerical instability, potentially increasing solution times and limiting online applicability. Many NLP solvers rely on gradient-based methods requiring derivatives of the cost function and constraints. When applied to legged locomotion, these techniques demand differentiable contact descriptions. The method in [19] implements an NLP problem that fixes the number of contact events while letting the solver determine step timings and footholds on a continuous heightmap. This approach avoids CCs but significantly limits the search space. Alternatively, [15] uses onboard sensors to capture terrain and represent it through a non-smooth heightmap. Terrain gradients are computed via numerical differentiation, but solver accuracy is limited by map resolution. Filtered maps are used separately for foothold placement, torso orientation, and edge avoidance. The gravito-inertia acceleration (GIA) model is used (Table I).
Another methodology for nonlinear optimization is differential dynamic programming (DDP). Traditionally it does not handle constraints explicitly, but extensions like Feasibility-driven DDP (FDDP [11] and BOX-FDDP [24]) manage infeasible initial guesses and control constraints. DDP can achieve greater computational efficiency compared to NLP, making DDP-based planners suitable for online applications (Table I).
In parallel to optimization-based methods, reinforcement learning (RL) has emerged as a powerful tool for discovering robust control policies in environments with high variability and uncertainty but often requires extensive training data and may perform inefficiently without demonstration priors. Table I compares the state-of-the-art optimizers listed above.
This letter tackles the challenge of humanoid motion planning on uneven terrain via a contact-implicit TO framework. Unlike prior approaches, our method integrates the robot WBD with a differentiable terrain and a mathematically coupled CC-based contact model. A notable aspect of our terrain model is its ability to remain smooth while closely approximating discontinuities common in human-centric environments. Our approach formulates planning as an optimal control (OC) problem solved via NLP. The key contributions are:
-
The introduction of a differentiable representation of uneven terrain, combined with generalized contact constraints.
-
A mass-scaling of the system's centroidal dynamics to improve efficiency and dynamic motion results.
-
The validation of our method by generating locomotion trajectories on non-flat surfaces, showcasing its ability to synthesize dynamic motions.
We conducted preliminary tests to evaluate the feasibility of the generated trajectories, validating the approach through both simulations and real-world experiments on the humanoid robot ErgoCub over non-coplanar terrain (Fig. 1).
TABLE I COMPARISON OF OPTIMIZERS FOR PLANNING ON UNEVEN TERRAIN.
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| Ace17 [12] | ✓ | CD | MICP | ✓ | |||||
| Win18 [19] | ✓ | ✓ | ✓ | CD | NLP | ✓ | |||
| Mas20 [11] | ✓ | ✓ | WBD | FDDP | ✓ | ✓ | |||
| Ton20 [13] | ✓ | CoM | MICP | ✓ | ✓ | ||||
| Jen22 [15] | ✓ | ✓ | GIA | NLP | ✓ | ✓ | |||
| Our Work | ✓ | ✓ | ✓ | WBD | NLP | ✓ | ✓ |
A: differentiable terrain; B: uneven surfaces; C: strongly curved or inclined surfaces; D: dynamic motions; E: dynamic model; F: optimization method; G: online generation; H: humanoid robot; I: implicit contacts.

Fig. 1. The robot ErgoCub performing a step-up trajectory (open loop).
II. BACKGROUND
A. Notation
-
-tuples in the real vector space are denoted by bold lowercase letters . is the null -tuple.
-
Matrices are denoted by uppercase letters . represent, respectively, the identity and the square null matrices of order .
-
Geometric points in the 3D Euclidean space are denoted by uppercase upright letters , while geometric vectors in the 3D Euclidean vector space are denoted by bold lowercase letters .
-
Reference frames are denoted by calligraphic letters . is the origin of , while is its orientation.
-
Given two frames and , with we refer to a new frame characterized by the same origin of and the same orientation of (mixed frames [25]).
-
Coordinates of points and vectors expressed with respect to (w.r.t.) a frame are denoted by , .
-
is the absolute inertial frame. Its origin is positioned at ground level and its -axis points in the direction opposite to the local gravitational field.
-
is the body-fixed frame associated with the floating-base of the multi-body system (the waist of the robot).
-
is the frame associated with the -th contact point located on the foot contact point and oriented as .
-
is the centroidal frame [26], whose origin is the robot center of mass , and oriented as .
-
is the translation between and , is the rotation aligning with , is the transformation between and .
-
is the operator associating a 3-tuple with a matrix , such that , , with the usual cross-product in .
B. Humanoid Robot Modeling
A humanoid robot can be modeled as a multibody system consisting of rigid bodies (links) connected by means of joints with one degree of freedom. The robot configuration is defined as the pair , which belongs to the Lie group , where is the joint position vector. As is not a vector, we refrain from using boldface notation. According to Lie group theory, we can define the vector of the system generalized velocities , where is the twist describing the instantaneous relative motion of w.r.t. , while are the joint velocities.
The floating-base system dynamics is completely described by the Euler-Poincaré equations, here expressed in the centroidal frame [27, Eq. (3.95b)], [28]:
where is the generalized centroidal inertia matrix, is the bias term which accounts for the Coriolis, centrifugal, and gravitational effects, are the internal joint torques, and is the -th external wrench expressed w.r.t. . The transpose of the Jacobian matrix maps the -th external wrench to a vector of external generalized forces.
C. Centroidal Momentum Dynamics
Trajectory planning for floating-base multi-body systems can be computationally demanding due to the high dimensionality and nonlinearities of the full dynamic model. A widely adopted simplification relies on CD [29], which encapsulates the fundamental characteristics of whole-body motion, such as momentum and contact interactions, while substantially reducing the dimensionality of the state space:
where is the centroidal momentum [29], is the local gravity acceleration, is the mass of the system, and is the -th contact point. It describes how the system's linear and angular momenta evolve, ignoring its internal structure. It is completely equivalent to the first six rows of Eq. (1) (i.e., the projection of the full dynamics onto the 6D space of the centroidal momentum). The centroidal momentum matrix [29] represents the linear map between and , denoted by the matrix :
D. Optimal Control Problem and Nonlinear Programming
A constrained OC problem involves finding a control policy for a dynamical system to minimize a cost functional and satisfying constraints involving state and control time signals. NLP techniques are crucial for addressing the optimization challenges of OC problems, since the former represent a finite-dimensional approximation of the latter. An NLP problem consists of three main elements:
-
a p-tuple of optimization variables , that can be freely chosen within its domain.
-
A scalar function in the optimization variables to be minimized (cost function).
-
A set of equations or inequalities that algebraically link the optimization variables (constraints).
The solution of the NLP problem is the vector of optimization variables that simultaneously satisfies all constraints and minimizes the objective function:
The set is called feasible set. and are assumed to be differentiable functions. The differentiability of all the problem functions enables the use of derivative-based optimization algorithms. This includes gradient-based methods, which directly compute gradients and Hessian matrices, and interior point methods, which indirectly use derivatives through the formulation and manipulation of barrier functions [30].
The infinite-dimensional OC problem can be transcribed into a finite-dimensional NLP problem by using the so-called direct methods (e.g., single shooting, multiple shooting or direct collocation [31]), and can be easily tackled through the use of numerical strategies [32], [33].
III. CONTRIBUTIONS
A. Uneven Terrain Modeling
This section introduces a terrain model that smoothly approximates discontinuous shapes like steps and ramps. The model ensures a differentiable representation, crucial for optimization methods relying on derivatives. To achieve smoothness while capturing discontinuities, each terrain element is modeled as a 2D differentiable manifold, defined by the graph of the following smooth map :
where is the explicit function describing a generally oriented plane in the 3D space, is a positive semi-definite differentiable function and is a real number, called sharpness. To clarify the steps that led to the definition of such a function, we can start with the definition of the one-dimensional parametric function:
with and . For each value of the sharpness in its domain, there are two fixed points in the function graph (they do not depend on ):
When , it approximates a step function. The idea is to make the variable a function of the planar variables (), in order to obtain surfaces with a “prism”-like shape. This means that is nearly zero everywhere except in a limited region where it is close to one. (Fig. 2):
AUTHOR'S CORRECTED VERSION OF: IEEE ROBOTICS AND AUTOMATION LETTERS, VOL. 10, NO. 11, PP. 11674–11681, NOV. 2025. DOI: 10.1109/LRA.2025.3614066
The function should be chosen in such a way that:
• ,
is the implicit function that describes the shape of the upper part of the “prism” (usually a point),
is the implicit function that describes the shape of the lower part of the “prism”.
This geometric model allows us to represent elements such as parallelepipeds, cylinders, tori, and “prisms” with a desired base shape. Here are some examples of common shapes:
• Rectangle:
where is a parameter related to the sharpness of the shape corners and are the half-widths of the rectangle edges. If the shape is a square. If the shape is an ellipse or a circle (if ).
• Equilateral Triangle:
If we want a “prism” with an inclined upper base, we can multiply the exponential function by the expression of a generically oriented plane:
where is the 2-tuple collecting the angular coefficients of the plane and is the height of the plane in . Where the exponential function is close to 1, the surface will approximate that plane. Thus, we have obtained Eq. (4) introduced earlier. Eventually, to obtain even more complex shapes, it is possible to replace the plane with a generic function (Fig. 4). In the end, we can make an affine change of coordinates to translate (with ), rotate and/or deform (with ) the original shape: .
Individual elements can be combined through a simple addition to create more complex shapes (e.g. stairs or inclined jumping platforms) . Given the explicit function of a smooth surface , it is always possible to evaluate the tangent plane at any point and the vector perpendicular to this (local surface normal):
This vector will play a pivotal role in the contact modeling.
B. Contact Modeling on Smooth Uneven Terrain
We consider a point contact model with Coulomb friction, requiring a tangent plane and normal vector at each surface point, as ensured by differentiable surfaces. Assuming a known terrain, we can derive a vector field that assigns the local normal vector to each point Q. Let us define:
-
the orthogonal projector on the plane perpendicular to a given vector x. It is defined as ,
-
the orthogonal projector along the axis parallel to a given vector . It is defined as ,
where , with the Euclidean norm.

Fig. 2. Surface with a torus-like shape: with and s = 4. The blue curve is the geometric locus of points satisfying the implicit function , the red curves are the geometric locus of points satisfying the implicit function .
Before providing the constraints that formally describe contacts on uneven terrain, it is important to emphasize the assumptions behind this contact model: contacts are assumed to be rigid (neither body deforms upon contact) and static (no slipping), whereas impact events are assumed to be inelastic (kinetic energy is generally not conserved).
With we denote a contact force applied to the point P, while with we denote the distance vector connecting the point on the surface Q to the point P, fixed to the foot. Q is chosen as the point located at the intersection of the surface with the vertical line passing through the point P. Alternative selection criteria may also be considered. It is imperative, however, that during the contact phase. The coefficient of static friction is represented by .
• Contact Condition:
• No-slip Condition:
• Friction Cone Condition:
• No-penetration Condition:
• Unilateral Contact Condition:
The CCs expressed by the Eqs. (6) and (7) are implemented in their relaxed versions (i.e., , instead of CC = 0. is the desired relaxation interval), since this mitigates issues of numerical instability, as detailed in [23]. Thus, all the conditions are described by inequalities.
C. OC Problem - Dynamical System
In our case, state x and control u are defined as:
where and represent, respectively, the contact points and the associated contact forces on the robot feet. The quantities and are system inputs which we assume the planner can control in order to generate smoother variations in contact point positions and forces. These inputs allow for finer control over the contact dynamics, ensuring more gradual and smooth transitions in the system behavior. The robot configuration and velocity are defined as:
where represents the floating-base orientation w.r.t. the absolute frame in terms of unit quaternions , while and represent, respectively, the relative linear and angular velocity of the floating-base w.r.t. the absolute frame, expressed w.r.t. the mixed frame .
We consider the combination of the centroidal dynamics:
where is the linear momentum, and the full kinematics:
where the operator represents the Hamilton product. With an abuse of notation, here denotes a 4-tuple representing the components of a pure quaternion. First-order dynamics have been applied to contact points and forces:
Scaling of the System Dynamics: We observed that the planner converges more quickly to a feasible solution when the centroidal dynamics is independent of the robot total mass m. This is achieved by scaling the quantities , , and by m, resulting in mass-normalized quantities denoted with a tilde: , , and . With these variables, the only equation where mass explicitly appears is the centroidal momentum consistency constraint (Section III-D).
D. OC Problem - Constraints
-
Differential Constraints: They consist of the mass-scaled equations presented in Section III-C. The related initial and final conditions are included in the equality constraints.
-
Inequality Constraints:
• Contact Constraints: Inequalities introduced in Eqs. (6) to (10). On each foot, four contact points have been chosen and correspond to the vertices of the sole ( ). Once set, their positions relative to the foot frame do not change during the motion (see point 3-Equality Constraints).
• Joint Limits: , , and , with evaluated inverting the Euler-Poincaré Eq. (1). Joint torques can also be expressed on the motor side (that is, upstream of gearboxes), as presented in [34], and are denoted as motor torques . In this way, it is possible to impose constraints directly on the maximum torques exerted by the motors, available on datasheets.
Rotation matrices are parameterized using unit quaternions by means of the formula , where is the scalar part, while is the vector part of .
3 ) Equality Constraints:
• Rigid Connection of the Contact Points to the Feet, Unit Quaternions and Center of Mass Consistency: The constraints adopted here are consistent with those formally introduced by Dafarra et al. [14].
• Centroidal Momentum Consistency: It consists in the mass-scaled version of Eq. (3). This is the only equation in which the robot total mass appears explicitly.
E. OC Problem - Tasks
We define a task as a function whose minima represent an objective we aim to achieve and which represents a characteristic we want to be present in the generated motion. The weighted sum of multiple tasks constitutes the cost function. This allows mathematical encoding of high-level directives on the behavior that the system should exhibit. Bar-superscripted symbols denote constant desired values, while the subscript W denotes the weighting matrices in the weighted norms.
• State and Control Regularization Tasks:
In this case, the regularization value is the null tuple. To evaluate the distance between two unit quaternions , , the pseudometric is used [35].
• Swing Height Task and Force Regularization Task: The tasks utilized herein correspond to those delineated in the framework proposed by Dafarra et al. [14].
• Motor Torque Minimization Task:
It prevents the use of maximum available motor torques.
• Lateral Foot Distance Task:
where is a constant value that specifies the desired lateral foot distance. It prevents leg self-penetration during walking motions along the direction.
F. Choice of the Initial Guess
Given the non-convex nature of the NLP problem, the choice of the initial guess plays a crucial role in shaping the resulting trajectories, as different choices may lead to distinct local minima. This work highlights the importance of the initial guess for the time evolution of contact forces. For instance, where these forces are set equal to zero, the computed solution results in realistic jumping motions. The initial guess is built by interpolating between two robot configurations (initial and final) constrained to static equilibrium.
- Robot Configurations in Static Equilibrium: This subsection addresses the challenge of determining the desired configuration of a robot and the contact forces exerted upon it when positioned on uneven terrain. The objective is to compute the robot configuration, , given the CoM position, , and feet poses, and , ensuring that each foot maintains contact at no fewer than three distinct points.
Our approach follows a systematic procedure for each foot:
AUTHOR'S CORRECTED VERSION OF: IEEE ROBOTICS AND AUTOMATION LETTERS, VOL. 10, NO. 11, PP. 11674–11681, NOV. 2025. DOI: 10.1109/LRA.2025.3614066
• Select the desired 2D pose, defined by the planar coordinates of a contact point and the yaw angle .
• Determine the height of this contact point to ensure its alignment with the ground surface.
• Rotate the foot about this initial contact point, , by adjusting roll and pitch angles so that two additional contact points, and , also lie on the ground surface.
Since the couple is generally non-unique, the solution is determined by minimizing to ensure least deviations in the ankle angles. The problem is constrained by the condition that and belong to the ground surface. The contact points' positions are then used to solve a statics problem to evaluate feasible contact forces. This problem is hyper-static, meaning static equilibrium equations alone can't determine the contact forces uniquely. Therefore, a criterion must be defined to select one feasible solution from the infinite possibilities. This criterion can be framed as an optimization problem with contact forces as variables, subject to contact constraints Eqs. (6) to (10).
Once feasible contact forces are evaluated, we seek a robot configuration with the CoM in the desired position and feet in the desired poses. This problem can also be framed as an optimization problem, where the variables are the components of . Constraints include the desired foot poses, the CoM position, joint limits, and unit norm for the base quaternion. The objective function is a regularization task on the joint positions and base pose.
- Interpolation between Two States: A continuous transition between initial and final states is done using linear interpolation for the vector component and spherical linear interpolation for the quaternion component. During jumping, contact forces are set to zero for the flight phase. For walking, contact forces on the feet are alternately nullified. These guesses are simple and rough but sufficiently expressive to guide algorithmic convergence towards the desired behaviors.
IV. RESULTS
This section presents the results obtained by solving the discussed OC problem, taking into account all the details introduced in the previous sections. The transcription uses the multiple shooting method [33]. State-transition equality constraints are derived by discretizing the differential equations (Section III-C) using the explicit Euler method. To preserve the structure of the group of unit quaternions, an integration over the Lie algebra followed by the application of the exponential map is used [36]. The integration step is assumed to be constant. The time horizon is finite and its length has been varied according to the required task. It has been divided into time intervals of the same length . The NLP problem is solved using the software package IPOPT [37], employing the mumps and MA57 linear solvers [38]. The pipeline from the problem definition to its solution is implemented entirely in Python 3.10 with the help of the symbolic framework CasADi [39]. The dimension of the search space we considered is and the optimization computation time ranges from tens of seconds to a few minutes on a common laptop (11th Gen Intel Core i7,

Fig. 3. Time evolution of the contact condition (up) and the nine components of no-slip condition (down) for a single contact point during walking on undulating terrain (Fig. 4(c)), with relaxation intervals of N m and N m s respectively. Shaded areas indicate contact phases. The point is considered to be in contact when its vertical distance from the ground is below 1 mm.
32 GB of RAM). The selected weights of the cost function terms are wisely crafted based on the desired behavior. For some motions that include jumps, the weight of the task (12) has been significantly decreased and the torque limits have been deactivated. The proposed framework was tested using the dynamical models of two different robots. The transition between models required minimal changes to the planner, highlighting its robustness to parameter variations.
A. Generated Trajectories
• Stepping Up/Down a Step: The robot steps up/down a 20 cm high step. During this movement, the CoM vertical projection stays outside the support polygon, indicating a dynamic rather than quasi-static gait. The Swing Height Task ensures the robot lifts its leg enough to avoid unexpected collisions with the step edge.
• Walking on Complex Terrain: The robot successfully walks on ramps and complex terrain using the same initial guess as for flat-ground walking, highlighting the planner's versatility. Only the terrain information needs to be changed. Task (13) prevents the legs from self-penetrating. Since the surface is curved, partial foothold contacts and contact on differently oriented planar surfaces are common (for instance, in the snapshot of Fig. 4(a)). Penetration may occur in concave areas, as the planner only enforces that the four vertices of the foot do not penetrate the ground. This issue can be resolved by adding constraints to ensure that other internal points of the sole do not penetrate the terrain.
• Jumping: The robot performs jumps on flat terrain or on jumping platforms. As noted earlier, the initial guess is crucial and must feature zero forces during the flight phase. During the take-off and landing phases, the contact forces of the initial guess are scaled by a factor of 2 to 15 times the
TABLE II TRAJECTORY GENERATION: EXAMPLE DATA (FIG. 4).
| T [s] | N | MTM | CIP | CV | CT [s] | I | |
|---|---|---|---|---|---|---|---|
| (a) | 5.0 | 60 | 1.13 × 10-4 | 75.8 | 350 | ||
| (b) | 6.0 | 60 | ✓ | ✓ | 3.57 × 10-4 | 55.3 | 250 |
| (c) | 5.0 | 180 | ✓ | ✓ | 1.42 × 10-3 | 186.6 | 250 |
| (d) | 9.0 | 180 | ✓ | ✓ | 4.26 × 10-3 | 173.3 | 250 |
T: time horizon; N: number of time intervals; MTM: use of the motor torque minimization task; CIP: use of the constraint on the sole internal points; CV: solver constraint violation; CT: solver computation time; I: solver iterations.
static equilibrium value to induce a net CoM acceleration. For the front flip, joint regularization was adjusted to promote a crouched posture during the aerial phase.
Four samples of generated trajectories are shown in Fig. 4, with related data reported in Table II. Additional data and a wider range of dynamic motions appear in the supplementary video. Fig. 3 shows the time evolution of the contact and no-slip conditions for a single foot vertex during walking on undulating terrain (Fig. 4(c)). The relaxation intervals were set to [0, 0.001] N m and [-0.001, +0.001] N m s respectively. These constraints are never violated during the motion.
Compared with the method presented by Winkler et al. [19], our approach offers greater flexibility by allowing the number of contact events to be determined within the optimization rather than fixed a priori. By explicitly employing a smooth mathematical model of the terrain integrated with CCs, the planner can manage and exploit an arbitrary number of contact interactions that are not predetermined, which is crucial for planning highly dynamic motions on uneven surfaces. This expressiveness, however, comes at the cost of increased computational complexity and potential numerical challenges.
B. Tested Trajectories
Low-dynamic motions have been tested both in simulation and on the humanoid robot ErgoCub (Fig. 1). The trajectories, generated offline, are provided as a reference to a joint position PID controller. Thus, loop closure occurs exclusively at the joint level, with no guarantee of correct tracking of the floating-base pose. Since the sampled trajectory frequency is around 10 Hz, we increased the sample density by a factor of 10-20 through linear interpolation. The walking and step-climbing (height: 7 cm) motions have been proven to be remarkably accurate and have been successfully reproduced in the simulation and on the real robot, even in the absence of a high-level closed-loop controller. The robot performed the tasks without losing balance, thus validating the physical feasibility of the trajectories generated by the planner. The optimization yields feasible trajectories that naturally involve edge contacts, without requiring explicit enforcement. In this case, heel contact precedes toe contact, resulting in a gait pattern more closely resembling that of humans. Some trajectories involving contacts with a ramp have been successfully reproduced in simulation. More complex trajectories cannot be adequately executed as long as an open-loop control architecture is used. The supplementary video shows experiments conducted both in simulation and in the real world.
V. CONCLUSIONS AND FUTURE WORK
The paper presents an offline whole-body trajectory planner for humanoid locomotion on uneven terrain, framed as a constrained OC problem solved via direct transcription. The terrain was modeled using an originally devised representation for smooth surfaces, generalizing contact constraints beyond flat surfaces. The generated trajectories demonstrate the effectiveness of this approach, which enables dynamic motions on complex terrain. Future work will extend the real-robot validation to more dynamic motions once a high-level closed-loop controller is in place to ensure accurate tracking. Another possibility is to integrate the planner with RL modules. For example, the generated trajectories could serve as valuable motion priors for training learning-based controllers.
Regarding the limitations of the proposed model, it remains effective as long as real terrains can be approximated by relatively simple, easily parameterizable shapes. Additionally, its reliance on explicit functions for geometry description restricts the range of representable walking surfaces. Employing implicit functions could enable a richer set of geometric shapes. Nevertheless, while the current approach remains highly effective in structured, human-designed environments, developing a method to generate differentiable terrains from point clouds would enable planning over arbitrary, unstructured terrains unknown a priori. Finally, the current foot contact model (four contact points per foot) and lack of self-collision checks limit accuracy and realism.
REFERENCES
[1] S. Kuindersma, R. Deits, M. Fallon, A. Valenzuela, H. Dai, F. Permenter, T. Koolen, P. Marion, and R. Tedrake, "Optimization-based locomotion planning, estimation, and control design for the atlas humanoid robot," Autonomous robots, vol. 40, pp. 429–455, 2016. [2] Y. Ding, C. Li, and H.-W. Park, "Single leg dynamic motion planning with mixed-integer convex optimization," in 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2018, pp. 1–6. [3] M. Posa, C. Cantu, and R. Tedrake, "A direct method for trajectory optimization of rigid bodies through contact," The International Journal of Robotics Research, vol. 33, no. 1, pp. 69–81, 2014. [4] I. Mordatch, Z. Popović, and E. Todorov, "Contact-invariant optimization for hand manipulation," in Proceedings of the ACM SIGGRAPH/Eurographics symposium on computer animation, 2012, pp. 137–144. [5] M. Gabiccini, A. Artoni, G. Pannocchia, and J. Gillis, "A computational framework for environment-aware robotic manipulation planning," Robotics Research: Volume 2, pp. 363–385, 2018. [6] B. Aceituno-Cabezas and A. Rodriguez, "A global quasi-dynamic model for contact-trajectory optimization in manipulation," in Proceedings of Robotics: Science and Systems (RSS). Robotics: Science and Systems Foundation, 2020. [7] H. Dai, A. Valenzuela, and R. Tedrake, "Whole-body motion planning with centroidal dynamics and full kinematics," in 2014 IEEE-RAS International Conference on Humanoid Robots. IEEE, 2014, pp. 295–302. [8] R. Deits and R. Tedrake, "Footstep planning on uneven terrain with mixed-integer convex optimization," in 2014 IEEE-RAS International Conference on Humanoid Robots. IEEE, 2014, pp. 279–286. [9] M. Neunert, M. Stäuble, M. Gifthalter, C. D. Bellicoso, J. Carius, C. Gehring, M. Hutter, and J. Buchli, "Whole-body nonlinear model predictive control through contacts for quadrupeds," IEEE Robotics and Automation Letters, vol. 3, no. 3, pp. 1458–1465, 2018. [10] C. Mastalli, I. Havoutis, M. Focchi, D. G. Caldwell, and C. Semini, "Motion planning for quadrupedal locomotion: Coupled planning, terrain mapping, and whole-body control," IEEE Transactions on Robotics, vol. 36, no. 6, pp. 1635–1648, 2020.
AUTHOR'S CORRECTED VERSION OF: IEEE ROBOTICS AND AUTOMATION LETTERS, VOL. 10, NO. 11, PP. 11674–11681, NOV. 2025. DOI: 10.1109/LRA.2025.3614066

Fig. 4. Examples of generated trajectories: (a) inclined platform jumps, (b) crater walk, (c) undulating terrain walk, and (d) challenging terrain walk.
[11] C. Mastalli, R. Budhiraja, W. Merkt, G. Saurel, B. Hammoud, M. Naveau, J. Carpentier, L. Righetti, S. Vijayakumar, and N. Mansard, "Crocodyl: An efficient and versatile framework for multi-contact optimal control," in 2020 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2020, pp. 2536–2542.
[12] B. Aceituno-Cabezas, C. Mastalli, H. Dai, M. Focchi, A. Radulescu, D. G. Caldwell, J. Cappelletto, J. C. Grieco, G. Fernández-López, and C. Semini, "Simultaneous contact, gait, and motion planning for robust multilegged locomotion via mixed-integer convex optimization," IEEE Robotics and Automation Letters, vol. 3, no. 3, pp. 2531–2538, 2017.
[13] S. Tonneau, D. Song, P. Fernbach, N. Mansard, M. Taïx, and A. Del Prete, "Sl1m: Sparse 11-norm minimization for contact planning on uneven terrain," in 2020 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2020, pp. 6604–6610.
[14] S. Dafarra, G. Romualdi, and D. Pucci, “Dynamic complementarity conditions and whole-body trajectory optimization for humanoid robot locomotion,” IEEE Transactions on Robotics, vol. 38, no. 6, pp. 3414–3433, 2022.
[15] F. Jenelten, R. Grandia, F. Farshidian, and M. Hutter, “Tamols: Terrain-aware motion optimization for legged systems,” IEEE Transactions on Robotics, vol. 38, no. 6, pp. 3395–3413, 2022.
[16] G. Kim, D. Kang, J.-H. Kim, S. Hong, and H.-W. Park, “Contact-implicit model predictive control: Controlling diverse quadruped motions without pre-planned contact modes or trajectories,” The International Journal of Robotics Research, p. 02783649241273645, 2024.
[17] S. Bertrand, I. Lee, B. Mishra, D. Calvert, J. Pratt, and R. Griffin, “Detecting usable planar regions for legged robot locomotion,” in 2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2020, pp. 4736–4742.
[18] Y. Sun, L. Zheng, H. Chen, and W. Zhang, “Multi-resolution planar region extraction for uneven terrains,” in 2024 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2024, pp. 2706–2712.
[19] A. W. Winkler, C. D. Bellicoso, M. Hutter, and J. Buchli, “Gait and trajectory optimization for legged systems through phase-based end-effector parameterization,” IEEE Robotics and Automation Letters, vol. 3, no. 3, pp. 1560–1567, 2018.
[20] H. Dai and R. Tedrake, “Planning robust walking motion on uneven terrain via convex optimization,” in 2016 IEEE-RAS 16th International Conference on Humanoid Robots. IEEE, 2016, pp. 579–586.
[21] H. Hirukawa, S. Hattori, K. Harada, S. Kajita, K. Kaneko, F. Kanehiro, K. Fujiwara, and M. Morisawa, “A universal stability criterion of the foot contact of legged robots-adios zmp,” in Proceedings 2006 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2006, pp. 1976–1983.
[22] Z. Qiu, A. Escande, A. Micaelli, and T. Robert, “Human motions analysis and simulation based on a general criterion of stability,” in International Symposium on Digital Human Modeling, 2011, pp. 1–8.
[23] Z. Manchester, N. Doshi, R. J. Wood, and S. Kuindersma, “Contact-implicit trajectory optimization using variational integrators,” The International Journal of Robotics Research, vol. 38, no. 12-13, pp. 1463–1476, 2019.
[24] C. Mastalli, W. Merkt, J. Marti-Saumell, H. Ferrolho, J. Solà, N. Mansard, and S. Vijayakumar, “A feasibility-driven approach to control-limited ddp,” Autonomous Robots, vol. 46, no. 8, pp. 985–1005, 2022.
[25] S. Traversaro and A. Saccon, “Multibody dynamics notation (version 2),” TU/e, 2019.
[26] A. Saccon, S. Traversaro, F. Nori, and H. Nijmeijer, “On centroidal dynamics and integrability of average angular velocity,” IEEE Robotics and Automation Letters, vol. 2, no. 2, pp. 943–950, 2017.
[27] S. Traversaro, “Modelling, Estimation and Identification of Humanoid Robots Dynamics,” Ph.D. dissertation, University of Genoa, 2017.
[28] G. Garofalo, B. Henze, J. Englsberger, and C. Ott, “On the inertially decoupled structure of the floating base robot dynamics,” IFAC-PapersOnLine, vol. 48, no. 1, pp. 322–327, 2015.
[29] D. E. Orin, A. Goswami, and S.-H. Lee, “Centroidal dynamics of a humanoid robot,” Autonomous robots, vol. 35, pp. 161–176, 2013.
[30] I. M. Bomze, V. F. Demyanov, R. Fletcher, T. Terlaky, I. Pólik, and T. Terlaky, “Interior point methods for nonlinear optimization,” Nonlinear Optimization: Lectures given at the CIME Summer School held in Cetraro, Italy, July 1-7, 2007, pp. 215–276, 2010.
[31] M. Diehl, H. G. Bock, H. Diedam, and P.-B. Wieber, “Fast direct multiple shooting algorithms for optimal robot control,” in Fast motions in biomechanics and robotics: optimization and feedback control. Springer, 2006, pp. 65–93.
[32] J. Nocedal and S. J. Wright, Numerical optimization. Springer, 1999.
[33] J. T. Betts, Practical methods for optimal control and estimation using nonlinear programming. SIAM, 2010.
[34] G. Nava, D. Ferigo, and D. Pucci, “Exploiting friction in torque controlled humanoid robots,” in 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2018, pp. 1226–1232.
[35] D. Q. Huynh, “Metrics for 3d rotations: Comparison and analysis,” Journal of Mathematical Imaging and Vision, vol. 35, pp. 155–164, 2009.
[36] J. Sola, J. Deray, and D. Atchuthan, “A micro lie theory for state estimation in robotics,” arXiv preprint arXiv:1812.01537, 2018.
[37] A. Wächter and L. T. Biegler, “On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming,” Mathematical programming, vol. 106, pp. 25–57, 2006.
[38] A. HSL, “collection of fortran codes for large-scale scientific computation,” See http://www.hsl.rl.ac.uk, 2007.
[39] J. A. Andersson, J. Gillis, G. Horn, J. B. Rawlings, and M. Diehl, “Casadi: a software framework for nonlinear optimization and optimal control,” Mathematical Programming Computation, vol. 11, pp. 1–36, 2019.