Fish robots have helped scientists discover why fish school together.