Problems with <Command> Class and probably with a variable's precision.

Hello Guys. That's my first post in the forum.

I'm working on a RTT software to control a SPT (Stationary Plasma Thruster) and my guiding professor indicates Orocos to build it. I'm realling liking the program but I'm having some problems with a Command.

My command does a Voltage Ramp from 0 to the Maximum Voltage (500V and 800V). My program works at 1KHz frequency (PeriodicActivity at 0.001).

My solution is to create a variable 'incrementVoltage' and add the value to the other variable "voltageOut" on every execution of my updateHook() function.

I used this example: http://www.orocos.org/stable/documentation/rtt/v1.10.x/doc-xml/orocos-co...

I created a function to test if I'm at the diagnosis.

updateHook() {
if (inDiagnosis() ) {
incrementValue()
}
}

My command function is beginDiagnosis(double time). It changes the inDiagnosis() answer to true and calculates the increment with: increment (it's a double) = 800Volts/(time*1000).

The function endDiagnosis() test if the value is on 800Volts and sets inDiagnosis() to false if reach it.

So, the problem is:

When I use <time = 1 second>. The value reaches 800.8 Volts, With increment 0.800000. WRONG.

When I use <time = 10 second>. The value reaches 800 Volts, With increment 0.080000. OK.

When I use <time = 7 second>. The value reaches 800 Volts, With increment 0.114286. OK.

When I use <time = 6 second>. The value reaches 800.133333 Volts, With increment 0.133333. WRONG.

ALL my variables are double type.
In some cases, my program does ONE increment more and I can't discover the reason.

Anyone ever passed through this?
I put the frequency at 100Hz and still doesn't work.
All variables are Attribute<double>.

Thanks.