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.

Servo position feedback

In my previous article I wrote I modified the servos to get the position feedback. I’m going to give you some information on how to do it.

Before you start, you should be aware that modifying your servos will break the warranty so if you do it, do it at your own risk. This operation requires a lot of patience and you must be thorough when you do it not to make short circuits which may burn irremediably your servos.

The full procedure is well described in the following links :

On my configuration, I connected two wires as shown in the first link. I think this hack is better than the second one because first of all, if you make your measurements on another card (which I do), you won’t have to find a way to get the cards ground together. Secondly, it makes a real measurement of the volt directly at the source of the potentiometer. And finally it may be better for electromagnetic immunity.

I also managed to use the seal to pass both cables (original cable + feedback). To do so, I just used a cutter to give the seal some more room to allow the bigger height caused by the new wires.Servo seal and cablesIn the picture you can see what it finally gives… It looks good ! If you see well, you may have noticed that there’s 6 wires ! Yes indeed, but there’s the red one which is not connected but let there for spare purposes and for esthetism too.

The cable composed of white, red and black wire is the 3002 cable from Phidgets. I connected the black one on the Ground signal (same signal as the black wire from the original cable) and the white one to the servo’s wiper. I soldered the wires as close as possible from the potentiometer to avoid losses and perturbations.

The final results are very satisficing and quite comparable to those obtained by this guy : http://www.youtube.com/watch?v=ygX7sQM2gq0.

Hope this will help people !

EDIT :

Here is another helpful publication : http://learn.adafruit.com/analog-feedback-servosMoreover, Adafruit is selling servos with embedded feedback position ! No more need to hack your servo to reach the holy grail !