Exploration status, things done and to come

Time has passed since my last post… I explored many subjects that are really fascinating to me !

Prolog, Golog and FSA planner project

For example, I integrated the swiProlog engine in DeMIMOI models so that I now can run some Prolog scripts inside my models. This could be interesting to implement logic based reasoning.
And on top of this, I discovered the Golog framework from which the FSAPlanner is derived. This upper level Prolog extension allows for an even crazier reasoning. This is called « planning with loops » in the litterature.
I tried using the planner on my robot arm but with very limited success… It’s not easy to get familiar with the language features and syntax, and even worse for me who have not that much experience with Prolog.

Steering Behaviors

I also made a DeMIMOI model that integrates Steering Behaviors from Craig Reynolds. This is a very interesting concept that allows an entity to move through its environment based on strategies such as seeking, fleeing, wandering, arriving, etc. A set of parameters such as speed, weight, steer force allow to customize the obtained behavior.
While I was programming my own implementation, I was vastly inspired by this source code from Rahul Sindhu. Though I separated the graphics stuff from the math underneath the steering behaviors and also changed the math from 2D vectors to any vector dimension. The latter is a key point because I may need to get a behavior in 3D space or even in 5D for example on my robot arm, with one dimension for each arm joint.

Control Theory models

Then I went back to DeMIMOI models, and focused on implementing some math and signal processing functions such as filters, PID controlers, summers/subractors blocks and so on.
I managed to get a model that is able to drive the AL5C arm by providing commands in sensor units. This allows to drive the arm without having to deal with servomotor driving commands and its correspondance in the feedback (i.e. potentiometer) data range, so no calibration needed.
In parallel I also went back on the DeMIMOI memory model I talked about on a previous post to add what we would call « short term memory ». It simply stores data in the PC RAM, i.e. for a short period of time.
Then I used this model and the math models to build a sample application that makes the robotic arm move the same way I show it manually. I mean, I manually move the arm, and while I’m doing this, the system stores each servomotor position thanks to the potentiometer feedback. Once I finished the desired movement, I ask the robot arm to play the recorded movement.
The model I built for this purpose is as follows :

This diadram shows the DeMIMOI models structure to manage a record/play movement. It shows a structure based on PID's, the same structure is used for each arm joint.

This diagram shows the DeMIMOI models structure to manage a record/play movement. It shows a structure based on PID’s, the same structure is used for each arm joint.

As usual, this picture is extracted from the model itself which is able to produce the Graphviz code of its own architecture.
The potentiometers positions are stored in the DeMIMOI_Memory while I move the arm. Then, the memory pointer is restarted so that it points to the first record. The stored positions are then fed to the control model based on PID controlers which in turn feed the robotic arm servomotors.
The reason for cascading two PIDs is to implement some kind of small stepping process to reach the desired position. The first PIDs (PID1, 3, 5, 7 and 9) are pure proportionnal. The other PIDs are pure integral. The diagram shows the structure configured for playing. For recording, I only update the first two models on the left (AL5C arm sensors and DeMIMOI_Memory0).

The obtained behavior is pretty good and the movements precision is quite impressive ! Well there’s some offsets that I think come from this : the potentiometer data precision is poorer than the servomotor commands. It introduces offsets and errors because of this difference I think.

Current project

So, now I have a robotic arm that is able to move quite precisely using the servomotors feedback units. This way, if I manage to build a behavior model that is able to move the arm to pick up an object, I’ll have a building block this will allow me to reach new possibilities !
My next goal is to build such a model, a model that is able to calculate the position of an object thanks to the webcams information. This part will be the subject of my next post, as I prefer making a specific post for that (pretty big) subject.

Some news on my DeMIMOI library

First of all, I wish everyone coming to this blog a happy new year ! Should this year be healthy and make your projects come true !

It’s been a while now since I published the code of my DeMIMOI core library. I had some time to make some improvements and add some more features to make it even more attractive to me, so possibly for anyone willing to give it a try too.

I thought well when I hoped this platform would help me easily build systems and make a bigger one by connecting smaller ones. I successfully managed to use the library with neural networks (special thanks to Accord.Net and AForge.Net). For example I made DeMIMOI models of a NARX (Nonlinear AutoRegressive eXogenous) neural network and a ARX regression model (AutoRegressive eXogenous).
These models can mimic almost any dynamic system mostly because they have a backward link that make their outputs at time t-1 one of their inputs.
Using the DeMIMOI library this backward link is easy to model and to code since it’s just a connection between an input and an output that, in code, is translated by a myModel.Outputs[0][0].ConnectTo(myModel.Inputs[0][0]) for example. The data flow is then automatically managed by the DeMIMOI core.

I also started to put a database manager in a DeMIMOI model which can currently connect to a Mongo database. So I can save and retrieve data to build models or to act as some kind of a memory… Well it’s still in development now but the main features are already up ! I mean at least reading data from a pre-existing database. One step at a time right ?

To give you a better idea of what I’m talking about and what I’m doing, I’ll show you a picture of the system I’m currently working on.

First of all, let me just explain the background.

While coding the DeMIMOI ARX and NARX models, I wanted to build models that can learn the behavior of the servomotors of my AL5C robotic arm.
On a previous attempt last year, I had the arm moving freely and randomly while an application was recording at each time step the angle values from the potentiometers of each servo (thank you so much Phidgets !).

The results have been stored in a database that I can read using my DeMIMOI memory manager. Those data can then be sent to the ARX and NARX models, and also be used by the learner models to fit them to the servo behavior.

For this purpose, I coded the system which is described by the following diagram :

DeMIMOI NARX and ARX learning Lynxmotion AL5C servoBy the way, this image has been created using the GraphViz code that is automatically generated by the DeMIMOI collection that holds all the blocks of the system.
That’s a feature I’m quite proud of since it allows me to quickly check if what I coded is what I expected the system to be !

On the left of the diagram is the memory manager that reads the servo values from a Mongo database. The data produced is then fed to the ARX model and its teacher. They don’t need extra data processing, as opposed to the NARX model.

Indeed, the NARX model is made of a neural network that needs normalized data. That’s why you can see that the data coming from the memory block is also fed to a normalizer block that converts the raw data to a [-1, 1] range before being sent to the NARX and its teacher. Then the data coming out of the NARX model is denormalized to revert it back to its original data space.

On the ARX and NARX models you can clearly see the backward link that connects the output to the input. This link makes the network seamlessly recurrent. And again, in term of coding, it’s nothing harder than creating the link !

You also may have noticed the three probes that display some data values. This was for me to quickly check what are the model ouputs (simulated) compared to the real output (measured on the real system). On that run, the ARX is better than the NARX, but I currently didn’t push any analyze further to explain this…

My next work will now be focused on analyzing the results deeper, maybe working on the so called BPTT neural network (ouch ! it hurts !) or maybe even trying to make some kind of automated learning shell that would be able to test multiple models and parameters and then select the best one…
I know ! It seams like there’s going to be a huuuuge mountain to climb… I fight this feeling by telling me that I already climb quite a big part that it would be even worse to stop now !

I’ll let you know of my progress in a while. And do not hesitate to say hi or comment on this ! I’d be curious to know what it feels like for someone external !

Delayed Multiple Input Multiple Output Interface library

On my last post, I talked about the « connectionist theory base models ».
I started coding a C# library that could help me in my AI projects in a sense that I keep on spending time putting « small » systems together to make a bigger and smarter one. It’s been some time that I thought it must exist some way to ease things up…

The initial idea is based on a feeling I have around a lot of systems I have to deal with at school, at work, in my everyday life, in programming… : modularity.

They all have common characteristics, but one among them is a major one : the all have either input(s) or output(s) or a combination of the two.
They all have a function which make them useful and working.
You can easily think of such systems like :

  • Your coffee machine
    • Function : make coffee
    • Input : coffee, water and energy
    • Output : drinkable coffee
  • Your DVD player
    • Function : read a DVD and generate appropriate video signals out of it
    • Input : DVD and energy
    • Output : TV compatible video signals

They have a second similarity : they may need to know what happened in the past. Some of the actions of a system may depend on what it did before or on what were the previous inputs.

Another important characteristic is that those systems can be and most of the time are connected to another system. In the previous example of the DVD player, what would be the goal of a DVD player if it could not be connected to a TV ?

These are the major point I kept in mind to start coding the library.
Finally after some iterations and some diverse structure trials I finally came to a satisfying system that allows to mimic all the points I talked about combined with an ease of use in term of programming.

If you are interested in the details or want to try/use this C# library, I published it on GitHub : https://github.com/remyzerems/DeMIMOI
I called it DeMIMOI which stands for Delayed Multiple Input Multiple Output Interface, in reference to the control theory denomination.

At this time I did not use the library in an AI context but I already tried the DeMIMOI library for signal filtering for example. The use case is provided as a sample in the GitHub repository.

I’m pretty sure this is going to help in my experimentations since I’ll be able to build and test reasonably small parts of a system and then simply connect it to a bigger system to include this new module.

The other interesting part is that I’m more on the connectionism theory regarding AI, so I think it will help me make connection based systems easily.