From iLab Cookbook

Technologies: NaoRobot


The Nao Robot is a small, versatile, humanoid robot with various sensors, automatic voice synthesizing and recognition, collision detection, and a video camera. It comes with a programming environment that can be run on a PC, Mac or Linux computer and can be programed in C#, C++, python or visually in their proprietary SDE. This page will give a brief introduction to using the visual programming environment, Choregraphe, and an explanation on how to use Nao with Visual Studio in C#. This allows us to integrate with other technologies in the iLab, like the Proximity toolkit.

Nao communicates with a computer using a wifi connection. You can control it through high level commands (like "stand up" which will work from any starting position) or through low level commands, like actuating each individual motor.

For more general information, go to the official site

You can download the most recent version of the SDE here, but you'll need to request a username and password first (at the top of the page). It's called Choregraphe. Webots also exists on that page - it's a simulator for the robots and isn't required to run Nao.

Contents



Download and Installation

Start by going to the official Nao support site and click on "get your login" (if you don't have one) or log in. You may have to send them an email to get credentials, and if so, they will probably ask for your robot's serial number to prove you have one. That information is not posted here since this page is publicly accessible.

Once you are logged in, you will have access to the downloads. Navigate to Software > Choregraphe and download the one appropriate for your operating system.

If you plan to develop using C#, you also have to download NaoQi, which you can reference in your C# project. Start here and it asks you to log in. This requires a different username/password than before and to get it, you have to contact support (using the navigation bar on that page) and ask for one. This time, you'll definitely have to supply a serial number.

Now that you've got your username and password, login on the previous page and then navigate here. Go to the most recent update (we used 1.14.1) > SDK > NaoQi SDK > .NET > NaoQi for .Net 4 and download that. That will give you the .dll to reference in a C# file.

Tutorials and Examples

Using Choregraphe

Once you've got the files downloaded, start by opening up Choregraphe and using that to connect to your Nao.

- Put Nao in a safe, sitting position (see the render of the orange Nao in the image below, or the picture of the grey Nao above)

- Turn on Nao by holding the chest button for 1 second (but not much longer than that, because it will make him boot up in a different mode)

- Wait for him to boot completely - he says "Oo nag nook"

- Open Choregrpahe on your computer

- Press Nao's chest button for just one second - He will tell you his IP address

- In Choregraphe, press the green antenna button to connect - a window will pop up. If you see something on the list with a green nao head, click on that and then "connect to". Otherwise, enter the IP address Nao gave you and hit "connect to".

- If connected properly, you will see a feed of Nao's vision and a render of him in his current position on the right side of Choregraphe.

- See the folders on the left side? Under motions > animations, drag out "hello" onto the middle section. Now drag two motor on/off boxes to either side of it and connect them together by dragging the mouse between the start and end points of the program and between the boxes, like this:

- Click on the wrench icon on the second motor box. Change it to motors off.

- Run the program by hitting the green play button at the top.

Important: Note the gears icon in the upper right corner beside the batter indicator. Nao's motors are always either engaged or not engaged. When they're not, Nao can't move and is essentially limp. The first box turns the motors on so he'll be able to wave. When the motors are on, Nao gets hot and burns through electricity. Always keep the motors off when not actively running a program. The last box (the second motors box) will turn the motors back off (assuming you went into the settings using the wrench icon and switched it to off). Always start and end programs with those boxes. If a program does not end cleanly, the motors may not be turned off. This is a problem! Nao may overheat and his joints will wear down faster. If this is the case, the gears in that icon will be red. Just push this icon to turn the motors off.

Using Visual Studio (C#)

- Open up a new C# application (WPF, Winforms, console, or anything else).

- Add a new reference by right clicking on references in Solution Explorer. Select browse, and find the files you downloaded for NaoQi. Import naoqi-dotnet4

- Add this code to the main method:

String NAO_IP = "xxx.xxx.xxx.xxx";
try
{
     Aldebaran.Proxies.TextToSpeechProxy voice = new Aldebaran.Proxies.TextToSpeechProxy(NAO_IP, 9559);
     Aldebaran.Proxies.BehaviorManagerProxy beh = new Aldebaran.Proxies.BehaviorManagerProxy(NAO_IP, 9559);
     beh.preloadBehavior("SitDown");
     beh.runBehavior("SitDown");
     voice.say("I'm connected to visual studio");
}
catch (Exception e)
{
     Console.WriteLine("Connection could not be established:\n" + e.Message);
}

You're done! Run it and Nao should sit up and announce the fact that he's connected. Some notes:

- The behavior manager allows you to run all the "boxes" you string together in Choregraphe. You call them by name

- Behaviors must be preloaded before they can be used

- Remember to change the "xxx.xxx.xxx.xxx" to Nao's IP address. He'll announce his IP address when he's on when you touch his chest button.

Links

The official Nao downloads

The secret support site for Nao owners. It uses different login credentials you need to ask support for

Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Technologies/NaoRobot
Page last modified on February 18, 2013, at 05:13 PM