The aim of this paper is to introduce a novel method for determining the structure and dimensions of a walking robot using an optimization method. With this solution the parameters of the robot's gait algorithm can also be fine-tuned. Prior to the construction of the authors' latest robot called Szabad(ka) II, a sophisticated modeling was carried out. With the help of this model, the functionality of the robot could be checked before the manufacturing process. Until recently modeling has been used mostly for the verification of the construction, but as the next step it will be used for defining the structure and dimensions. The definition of the optimal parameters can be solved with optimization methods. The Particle Swarm Optimization (PSO) meets the expectations.