Building a home robot: Part 1 - introduction and head

(see all parts of "building a home robot")

Since I was a child and saw the tomy omnibot I was fascinated about robot companions. In the following years I took some tries to get or build one – for example the Sony Aibo in 2001 or my Cobra Robot.

Some weeks ago I started my first serious project of a self driving, self charging home robot - including things like face detection and voice output.

My girlfriend was not sure if it would be a little bit scary to live together with a home robot. So I decided to create a first prank design for the robot head especially for her ;-)


(A scary prank design created from old animatronics parts)

The real head will be much more cute and abstract, using a small monitor instead of physical eyeballs.

As the robot “brain” I choose a Raspberry PI 3 because it is small, fast and with low power consumption.  Other reasons were: cheap and native camera, hardware connections via the PIO port and the available official touchscreen monitor.

To create most of the body parts I want to use my 3D printer.

In the past I often used 3d editor programs like Autodesk 3D Studio or Cinema 4D – but never real CAD programs. After some research for a low cost but useful CAD program I found OpenSCAD.

This free open source tool and its unusual approach to create objects by writing program code suits perfect to my needs.

Only 3 hours later I had finished my first CAD model of a head prototype and started the 3d printer. (I plan to upload all the STL files to thingiverse.com to share them with other makers who want to built their own home robots)

The first prototype of the robot front head:

The following 4 improved prototypes:

An early prototype showing the complete head shape:

The final front part without raspberry pi...

...and with raspberry pi and the touchscreen monitor:


The next step will be the neck design and the motors for moving the head and the neck.

Continue reading: Part 2 - Neck design and movement

Using coroutines to create tutorials in Unity 3D

When reading the first time about unitys co-routine concept I thought by myself: How can this be useful?

In the meantime I found out that co-routines are one of the most interesting features of unity 3d.

For my actual game project I use them for several purposes; the most useful is to control interactive level tutorials.

The game contains an advisor avatar:

It guides the player through the level and automatically appears when a milestone is reached and the next hint is needed.

Co-routines are the perfect tool to manage this kind of tutorial.

  1. Create a co-routine and run it when the level starts.
  2. If a initial introduction is needed, this should be the first command inside the co-routine.
  3. Create a WHILE loop which waits till the next milestone event happens and contains a “yield return null;”.
  4. What a milestone is depends on the kind of game you are working on. For my actual game project these are “opening a dialogue”, “selecting a specific object” or “reaching a special place in the level”.
  5. When the condition of the milestone becomes TRUE, the WHILE loop will exit. In my game the next command after the WHILE loop invokes the advisor popup to explain the next step.
  6. Then the next WHILE loop to wait for the next milestone follows – and so on. 

Here is an example how such a tutorial code could look like:

    protected IEnumerator HintPlayback(int moneyToAdd, int itemsToBuy)
    {
        yield return new WaitForSeconds(4);

        ShowMessage("Please look at the pending tasks.");

        while (!this.tasks.AreOpen) yield return null;

        ShowMessage(string.Format("Please add some money - at least {0}$.", moneyToAdd));

        while (!this.money < moneyToAdd) yield return null;

        ShowMessage(string.Format("Perfect. Now please buy at least {0} items.", itemsToBuy));

        while (!this.items.count < itemsToBuy) yield return null;

        ShowMessage("You have completed the tutorial.");

        yield break;
    }

 

You can also skip one ore more hints if milestones are skipped: just check for both conditions (for milestone 1 and 2)  in the WHILE loop of milestone 1.