Topology Optimization of Flexible Bodies in Controlled Mechanical Systems