Swarm-Based Planning And Control Of Robotic Functions