Enhancing the PID with feedforward speed and acc profiles

1- The basic control position for servo motor Ac with TI Dsp f28335 is:

1- standard control position with 4 pid

Is a model with Id /Iq.
You can read all teory at

It is the original speed control with a fourth pid for position control.
And a second qep2 module to have the real position count.


2- The problem is that motor spins abruptly. Motor damages. Ever have overshoot at end profile. I add a little low pass filter to init more smoothly ( not a fast 0 to 1). Now motor does not damage. (see clear blue line)

2-step pulse with a low pass filter-1

3- The same before in matlab figure. All are real time measures. The PID works bad. Impossible to get better adjusting parameters.

3-step pulse with a low pass filter-matlab figure


4- People use S-curve instead of 0-1 transitions for comanded position control motor.
Now for motor position control I generate 3 profiles on Pc at real time. I send by usb. I inject them on the three pid loops.



5- If I only use the position profile (newpi_iq.Kff = 0 ; newpi_spd.Kff= 0), I have a delay between comanded position and real position ( blue lines)

3- s_curve for position



6- If I use the three profiles (newpi_iq.Kff = 1.8 ; newpi_spd.Kff= 0.58), the delay between commanded and real position is minimal.

0-s-curve for position+ feedfordward speed and acc


7- With short cicles, at a rate of 60 pieces for minute

1- idem 0 shorter

How to use a reflective memory in Tbi 1.0 Robot?

But first, what is a reflective memory?.
I add the definition than shows in GE Intelligent Plattforms:

Reflective Memory networks are Real Time Local Area Networks in which each computer always has an up-to-date local copy of the shared memory set. These specialty networks are specifically designed to provide highly deterministic data communications. They deliver the tightly timed performance necessary for a variety of distributed simulation and industrial control applications. Reflective Memory networks have benefited from advances in general-purpose data networks, but they remain an entirely independent technology, driven by different requirements and catering to applications where determinism, implementation simplicity, and a lack of software overhead are key factors.


Look the following picture than shows how to implement a reflective model memory using Usb transfers


I use a network variable server from Ni

I use labwindows Cvi 9.0 network variable server (is the same that use labview), There are two banks of 4kB of memory identicals.
One stays in the 28f335 Ti dsp and the other stays on PC
They are 2K for inputs and 2k for outputs
The inputs are
variables inputs







variables inputs-2















and the outputs are

variables outputs

For inputs, for example when a limit switch is pushed, this variable in ON, and 4ms after, the reflective variable on the Pc also will On.
And less on 1ms more the matlab program can read this variable.

For outputs, for example to activate a electrical valve, the program activate the variable on Pc, and 4 ms after, the reflective variable on dsp will On, and 1ms later the control loop on dsp activate this output.

For the variables than are 32 bits works equal.
All this process is transparent for user. The delays are over 4 to 5ms.
The user only read or write one variable on the Pc with a very simple instruction. (A function on tbi.dll, that is a .net library).

On the next post I will explain more how to do this

New links about robotics

I have put my web some the reciprocal linking directories about robotics – IT Resources

UGA internet guides
UGA media is the European publisher of internet guides, business portals,
travel guides and reference cd-roms.



Is Tbi 1.0 a little clone of “hall”: 2001 A Space Odyssey?

Perhaps not, but it’s based at the same idea, one big computer and low-cost peripherals.
Look the following pyramid diagram


Observe that the computational speed is high on the computer (where the program is executed) and decreases lineally when arrives to servo motor
2.2GHz on cpu -> 480MHz on usb -> 150Mhz on dsp ->10kHz on Isr loop motor control.

I want to show some lines of the handbook “ez_usb_r___technical_reference_manual__trm__14.pdf” from a Cypress Usb manual,

than describe how a host-centric model with a big inteligence, and peripherals as simple as possible is the better option to decrease the total cost.

There is an excellent reason for this host-centric model. The USB architects were keenly aware of cost, and the best way to
make low-cost peripherals is to put most of the ‘smarts’ into the host side, the PC. If USB had been defined as peer-to-peer,
every USB device would have required more intelligence, raising cost.


This is the reason why in Tbi 1.0 robot, the program resides and it is executed at real time on the Pc, and not in the peripherals.

On the following  posts I will try to explain how to do this.

You can download the full code at


My first Post: Allow me introduce myself

My name is Marcelino Fort. I  was born 3-october-1961 in Barcelona.


Now I live in Terrassa. A city near Barcelona in Spain.

I am married with my wife Olga , and we have a son Daniel of 10 years old.


I studied electrical engineering on

I finished my studies on 1998 and presented my degree thesis on March-2001

My jobs ever are been related to the electrical, mechanical or electronics  engineering.


On the following  posts I will try to explain the reason of my interest about robotics.

Now I present to you the electomechanical arm of my degree thesis on March-2001


and the title

Titulo Ingenieria Marcelino Fort

401 -
Newsletter Powered By :