Chain Reaction 2013, created by U.K.’s Cambridge Science Centre, involved schools, families, individuals and company teams building a series of Heath Robinson (a.k.a. Rube Goldberg) links to form a huge chain of crazy contraptions that trigger one another.
A few of us MathWorks engineers participated by providing one link in the chain, and by hosting a series of interactive robotics exercises for visitors.
The guidelines for all links in the chain were that they had to start by the previous link pulling a string, and end by pulling the string for the next link. We decided our link in the chain would be a robot ball boy for a tennis match.
- Previous link in the chain pulls a string to trigger our link.
- String pulls a piece of card revealing a tennis ball on the court.
- Robot ball boy identifies the ball by image recognition using an on board camera, moves towards the ball and captures it using its pincers
- Robot turns until it recognises a tennis player at the other end of the court then moves down the court to give the ball to the player
- Having sensed that it has reached the end line of the court using a light sensor, the robot releases the ball which falls into guttering
- The ball hits a tennis racket suspended on a pivot under the table
- The handle of the racket pitches upwards, pulling a string which in turn triggers the next link in the chain
Our robot was powered by a Raspberry Pi computer. The Run on Target Hardware support for Raspberry Pi allowed us to use Simulink to design the controller for the robot and generate C code to be downloaded to the robot.
The starting point for the algorithm was a set of blocks receiving input from the sensors including a light sensor and a video stream from an on-board camera. The algorithm then sent signals to a pair of motor drive blocks, each wheel on the robot being driven by its own motor.
Simulink and Stateflow let us create the control software for our robot and continuously improve the algorithms throughout the day. A state machine controlled the different modes of operation of the robot exactly as we first specified it on paper. Practical use of the robot quickly showed that an idle state and a Touch button on the top of the robot would be necessary to stop and restart the robot when it went wrong and this was very easily added to the Stateflow chart.
For visitors to get a hands on experience on the technology running these robots we made two available for play. Fragments of the main Simulink model were extracted letting us easily explain the control algorithms we were using. There were hundreds of questions and suggestions for what the robot should do and, in many cases, visitors made adjustments to the controller and helped us to improve the way it worked. Within a few minutes each change was modelled and the code was regenerated and running on the robot. The highlight of our day was seeing the awestruck look on people’s faces as their motion and control ideas translated into robot movement!
The end result was a successful link in the chain and many visitors with a new understanding and enthusiasm for robotics and control.