Introduction: Artificial Intelligence for Your Robot.

Making your robot move and making it think are different tasks. In humans, fine movements are controlled by the cerebellum while actions and decision-making - by the big brain. If you are reading this, probably you already have a robot and can manage its hands, legs, or wheels. Now add the next tier.
I made this program many years bit by bit and now it contains many key elements of artificial intelligence. In fact, you may use it as a practical textbook on this specialty. A Help file is included in the distributive and you need not Internet connection so as to browse on a Web site. Read theory and look through various sample applications. Then, you can put them into practice. This is not an API. Rather, this is a complete development platform with embedded programming language. Nevertheless, if you want to extend it, this is also possible. Typical architecture would be to have your own driver to control step motors and link this program via TCP/IP. Nowadays, most applications for robotic control use GUI (Graphical User Interface). This system offers NLI (Natural Language Interface). Such a solution helps to make your machine more intelligent and pave the way to completely autonomous control. If you have no robotics hardware yet, there is a virtual environment. You may draw various objects on screen and manipulate them using virtual robotic arm.

Step 1: Download Distributive.

Download WinNB from https://nbsite.000webhostapp.com The size of the distributive is approximately 1 - 2 Mb. The program does not collect and send out any info about your PC. You can also download from CNet or another software collection. They check and approve each new version.

Home>Windows Software>Developer Tools>Interpreters & Compilers>Personal Knowledge Base NB

Download from CNet

Step 2: Install.

Install the program. This takes 2 minutes. Just run the downloaded file and answer questions. This program was tested under various versions of Windows and should run for sure under Windows 2000, Windows XP, and Windows 8. The latest versions of this operating system have enhanced protection of files and directories. You may not be able to write into some directories even if you are the administrator of the PC. If you are not sure with such issues, it is recommended that you accept the default destination and install into the root of disk C. The program has an embedded Help system which was also tested under aforementioned versions of Windows. If you have problems reading Help, write me via support email on my site and I will advice how to cope with this or provide another Help file.

Step 3: Run.

Run it. This is a multipurpose program which even has an internal database so you can maintain, say, a personal bibliography. At present, we will use its natural language interface. Click menu Browse\Command\Notebook. This will create 3 windows on screen. They will be used under various circumstances for input/output.

At the right, you will see the Description window which is generally assigned for output of analytical elements such as attribute-value pairs or answers which the system generates in response to your questions. At the left - the Text or Graphics window which receives an integral data such as a block of text or a picture. At the bottom-right part there is the Command window where you enter a query or an entire program. Also the Messages window at the bottom-left receives short system-level notifications. The paradigm of communication is simple. Type your command in the corresponding window. Put cursor in front of the sentence, and click GO in the Command dialog. Don't forget to put full stop at the end. This language has some degree of flexibility, but in general, it assumes grammatically correct sentences.

Step 4: Get Familiar.

Read Help and get an overall picture of what this program can do.
This language is a mixture of 3 paradigms. 1. Procedural. In the world of programming the key name would be Basic. 2. Declarative. The key name is Prolog. 3. Natural language. It can take a wide range of English sentences and associate definite semantics and pragmatics (actions) with them. In this manner you can write a lengthy description of something, then ask questions about it. Otherwise, you can write a program. This is an interpreter (although you can compile programs too). If you put several orders or formal functions one after another, the system will execute them as a normal algorithm. For declarative programming, you need to compile some rules and facts. Just write them one by one, put cursor in front of them, and click GO. The work of the interpreter stops at the end of the text or if it encounters the 'stop.' operator. Note that a compiled program goes into a knowledge base on disk so will be retained if you turn off the computer, then run the program again. When you try another example, usually it is needed to use the 'erase knowledge.' operator. It works in the single-step mode and does not require 'stop.' afterwards.

Step 5: Explore Sample Application.

Examine the Behavior sample application. To run it, select the text of the program in the Help window, copy it to clipboard, then paste into the Command editor, and follow instructions in comments.
This application implements a robot which operates in the virtual world of 2D objects.

The program consists of several sections.

First, we draw the environment.

#draw("line",0,5,160,5). % Floor.

#draw("line",0,95,160,95). % Ceiling.

#draw("rectangle","yellow",30,5,50,25).

#draw("ellipse","green",10,10,70,15).

#draw("rectangle","red",100,5,115,35).

Then - a robotic arm.

#draw("set_dot","black",0.5).

% Arm.

#draw("line",80,95,80,75).

#draw("line",80,75,60,75).

#draw("line",60,75,60,65).

% Hand.

#draw("line",45,65,75,65).

#draw("line",45,65,45,40).

#draw("line",75,65,75,40).

The next block implements a virtual machine.

block:"compile to" "goals".

_chng_operator if

_oper_ready.

_move1(@Dir) if

_dir(@Dir);

#cut();

_nsteps(@N);

_dec_nsteps(@N).

_squeeze if

_squeeze_dir("squeeze");

#cut();

_nsteps(@N);

_dec_nsteps(@N).

_expand if

_squeeze_dir("expand");

#cut();

_nsteps(@N);

_dec_nsteps(@N).

_chng_instruction if

_ready.

_gravitation1(@Type,@Num,@DY) if

_falls(@Type,@Num,@DY).

_ascent(@Type,@Num,@DY) if

_jumps(@Type,@Num,@DY).

#wait().

end block:"compile".

The next rules support elementary instructions of this machine.

remember: _nsteps(14);

_chng_squeeze("squeeze");

remember: _instruction_runs

so as to squeeze.

Operators are what is exposed to users. They are composed from instructions and other operators.

_user_output("Specify color of the box")

so as to take box.

move to @att1Attr @Obj;

remember: _operator("grip");

remember: _operator("move to i p")

so as to take @att1Attr @Obj.

The final section of the program is not for compilation. Here you work as an end user in the mode of interpreter.

%************Usage********************************.

%This is complex command integrating several actions.

take yellow box.

stop.

Step 6: Explore Robotics Sandbox.

Proceed to more complicated Robotics Sandbox. In this case, you don't need to copy the program from Help. The RSandbox directory contains 2 files: ROBO.SCP and ROBO_USE.SCP. SCP is an abbreviation for script. The first is for developers, the second - for end users.
This variant has the more complex environment.

Explore physics. The manipulator can take an object, then release it, and it will fall to the floor. Also Sandbox explains how to make a step from virtual into real robotics. For this purpose you break the program into 2 modules - the processor and the controller. The second implements low-level servocontrol. The first - machine intelligence. The two modules are linked via TCP/IP. Run two instances of WinNB on different or the same computer. Connect them. Use localhost as an IP address in the second case. Open ROBO.SCP in the first program. Uncomment (delete '%') the following line:

%remember: _use_controller.

Compile and run (turn on virtual machine) it. Now switch to the second instance. There is yet another file in the RSandbox directory - ROBO_CONTR.SCP. Open it in the Command window and compile. This module is passive and has no user section. Now you can issue commands in the first program and see how the robot in the other one reacts to them.

Step 7: Proceed to Hardware.

This is up to you. If you have a robot, why not try and control it using the already existing interface? For this purpose, you will need your own driver instead of the controller from the previous step. In case of any troubles with linking 2 programs, feel free to contact me via support email on my Web site.