Play Rock, Paper, Scissors with TJBot
Follow along as one team teaches TJBot to play a game.
Co-authored by Reema AlMeshari
In this blog post, we are going to share our project experience about teaching a little cute robot how to play Rock, Paper, Scissors.
TJBot was born in 2016 at IBM Research. It consists of a cartoon or a 3D-printed body, Raspberry Pi, a camera, speakers, microphone, RGB LED light, and servo motor — assembled together, resulting in a robot that can see, speak, listen, and wave.
When TJBot arrived in Saudi Arabia, he was nicknamed “Saudbot.” Saud is excited to learn new things and explore the world around him.
The first game he learned is Rock, Paper, Scissors. We got inspired by JeanCarl Bisson, a developer advocate from IBM.
The picture shown above is the dashboard of the game. First, the player presses the Play button to start the game. Then, Saudbot will say the game rules to the player. Afterward, it will count down from three to one, and the player will play his move in front of the Saudbot camera to take picture of it. Later, Saudbot will say his move and who won. Finally, the scoreboard on the dashboard will be updated by the result.
We are using different services in this game: Node-RED on IBM Cloud, Node-RED on Raspberry Pi, Watson™ Visual Recognition, Watson Text to Speech, and Watson IoT™.
The flow goes like this:
- Player presses Play
- Publish IoT play command
- Subscribe to play command
- Synthesize game rules
- Classify move
- Publish IoT event
- Display score
- Persist history in storage
- Synthesize game result
Watson Visual Recognition
Saud uses IBM’s Watson Visual Recognition to help him identify the player move. The service is trained with three classes: a rock class, a paper class, and a scissors class. This was the fun part — where we asked the team to give us a hand!
We trained each class with about 25 images, and the more you add images the better it becomes.
Experience using Node-RED and Watson IoT
We created an IoT platform service to connect our Raspberry Pi to it. This creates a Node-RED application we used to build our dashboard.
The Node-RED dashboard flow is running on the cloud, built using nodes from the node-red-dashboard palette.
The other Node-RED flow is on Raspberry Pi to control its logic. First, you have to set up Node-RED on the Raspberry Pi; follow the steps to do so. Then you can start building programs using nodes.
Using Watson IoT and Node-RED made programming objects more fun and less complex with less time, which is why we think projects like this present a great value for teaching young people how to make cognitive objects and enable them to innovate.
In the future, we plan to make Saud learn new things and interact more with the people in the office.