Robotnačka in Imagine, Tutorial

This tutorial assumes no previous knowledge of programming, robotics, hardware, or Imagine.

Robotnačka is a robot that lives on a paper or whiteboard.

And if you give it a pen, it can move and draw:

At the end of this tutorial, we give you detailed instructions for getting your computer ready for Robotnačka. For now, we assume it already is.

Start Imagine by clicking on Imagine shortcut (why shortcut?).

What you see now is the Imagine Logo environment. It is a full programming language with many features. Even very complex professional applications can be programmed in it, but it is very easy to start using it also for a complete beginner.

Before we start with the robot, we will play a very little bit with the turtle on the screen. It is now ready and listening for your commands (why I do not see any turtle?).

Now try to type the following into the command line:

repeat 5 [fd 50 rt 360/5]

fd N - moves the turtle forward by N steps
rt α - turns the turtle right by α degrees
repeat N [ commands ] - repeats the commands N-times.

Can you try to draw other interesting pictures on your own?

I know you are already curious about the robot, but one more thing:

Robotnacka is able to learn complex commands. For example, to draw a little house, the turtle can first draw a square and then the roof:
 repeat 4 [rt 90 fd 70]
 rt 30 fd 70 rt 120 fd 70
We might want to draw many houses, so we will teach the turtle what house is. You can type these lines into the command line:

to house
  repeat 4 [rt 90 fd 70]
  rt 30 fd 70 rt 120 fd 70
end

Now when we clear the graphics screen with cs command, and say house, guess what will happen?

If we want to draw houses of different sizes, we can add the house procedure an argument:

to house :size
  repeat 4 [rt 90 fd :size]
  rt 30 fd :size rt 120 fd :size
end
And now we can say "cs house 30" or "cs house 100". If you want to edit the house procedure again, click F4 key and you will see the turtle's memory. Go into the list of procedures and double click house. When finished with changes, click OK (use the keys F11 - F12 to open and close the editor if your computer mouse is far from your keyboard).

But now we want to see the robot working!

Insert a pen and turn it on! You should hear a lot of short beeps, and when the robot is happy, it will start making a short beep every 10 seconds.

If you have connected to your robot from your computer before (which you probably did, if you followed the instructions at the end of this tutorial), you can load the robot.imt program:

  load "robot.imt
This will connect to the robot, and the robot should beep to indicate that, if it was not connected already. All previous turtles you created will be erased, and a new robotic turtle will appear on the screen. Everything looks the same as before, but from now on, the robot is connected to the turtle and follows its movements! Remember, however, that robot's pen is now up. If you want to start drawing, you need to say pd (penDown). To stop drawing, say pu (penUp).

Note that robot.imt created a special object robotPort. This is the robot.ocx component, which allows you to achieve more than drawing straight lines and making turns at the spot. Look inside the Basic Robot Component Tutorial to read more.

Before you start creating your own applications, we recommend you to try the SpiralWorld, and FreeHand projects, and if you have a Joystick connected to your computer, try the Joystick project as well. You will find links to these projects from the Robotnacka software project page and they are included on the CD you got with Robotnacka.

Finally, we want to make a note that everything mentioned here will work with the robots in virtual robotics laboratory too. All you need to do is a) be connected to Internet, b) follow the installation instructions bellow, skipping the points 6-9. In point 10, specify the IP-address of the laboratory instead of the name of virtual serial port. The IP-address is currently 147.175.125.30.

Preparing your computer for Robotnačka

  1. If you already have a good version of Imagine installed, follow to point 4 below.
  2. Install a good version of Imagine. It is either located on a CD you received with Robotnacka, or you can get it from Infovek, if you are at some school in Slovakia, or ask us about other possibilities.
  3. If your version of Imagine does not come with installation program, simply copy the Imagine directory somewhere to your local or network drive.
  4. You need to copy the Robotnacka Imagine Software Package to the directory where you installed Imagine (if you got Imagine from us, it is already there).
  5. Now run register.bat from this directory to register the robot.ocx and cv4logo.ocx in your system (you need to have administrator priviledges on your computer to do this! if you do not - ask your system administrator to do it for you). ActiveX components robot.cx
  6. You need to have a BT USB device, which will communicate with your robot and plugs to the USB port of your computer. An example of such a device is BT Dongle from MSI. You need to install the software for your USB BT device according to the manual that comes with it.
  7. Now comes the tricky part - we need to add a virtual serial port for communicating with robot. It is done differently with each BT device, for example for MSI BT Dongle, you need to right-click the tray icon, and choose "Advanced configuration", go to tab "Client Applications", and click "Add COM port". After the port is added, click Properties... and specify that the communication will NOT be encrypted (uncheck the box).
  8. Please note the port number (for example COM5) that is assigned to your connection!
  9. Now open Windows Explorer (Win-E) and go to the Bluetooth places (depicted by Blue icon). Turn on the robot, and search for devices. You should see a device "turtleX" where X is some digit appearing. Doubleclick it (to inquire the services), and when you see the virtual serial port service shown, double-click it too (connect to the port). You will need to type in the PIN-code that you received with your robot. Now the robot should beep and a message should appear saying that the connection is established. You will not need to do this again unless you use the BT to connect to other devices.
  10. Now run the robotnacka_test.exe program from the Imagine directory, specify the port, and optionally calibrate the robot according to the instructions. This program will also create a configuration file for robot.imt so that it will automatically connect to the correct port. The robot will draw a simple picture (you do not need to have the pen inserted).
  11. If all steps went fine, installation is completed, and you are ready to start Imagine. If not, please write to us.