Aerospace production volumes have increased over time and robotic solutions have been progressively introduced in the aeronautic assembly lines to achieve high-quality standards, high production rates, flexibility and cost reduction. Robotic workcells are sometimes characterized by robots mounted on slides to increase the robot workspace. The slide introduces an additional degree of freedom, making the system kinematically redundant, but this feature is rarely used to enhance performances. The paper proposes a new concept in trajectory planning, that exploits the redundancy to satisfy additional requirements. A dynamic programming technique is adopted, which computes optimized trajectories, minimizing or maximizing the performance indices of interest. The use case is defined on the LABOR (Lean robotized AssemBly and cOntrol of composite aeRostructures) project which adopts two cooperating six-axis robots mounted on linear axes to perform assembly operations on fuselage panels. Considering the needs of this workcell, unnecessary robot movements are minimized to increase safety, the mechanical stiffness is maximized to increase stability during the drilling operations, collisions are avoided, while joint limits and the available planning time are respected. Experiments are performed in a simulation environment, where the optimal trajectories are executed, highlighting the resulting performances and improvements with respect to non-optimized solutions.