PDA

View Full Version : Smooth A/T with Servocard



hercules
10-25-2009, 12:27 PM
Hello all,

i use an OC Servocard for PM MCP Autothrottle. It works fine, but for any reason the servos does some peaks and jumps during A/T operations. Its heaviest when i start with TOGA....then the levers makes uncontrolled movements some mm forward and backwards. When i watch the PM N1 gauges, i can also see this small peaks.

Is there a way to filtering this peaks?? I think about a SIOC timer to interpolate the movements, but have no idea how to program such timer.

It would be very kindly if somebody could help me a little:-)


Regards

Thomas
Sorry for my poor english:-)

kiek
10-27-2009, 09:51 AM
Hi Thomas,
Here the basic schema. You have two parameters for fine tuning.
- how often in time a value is read (now 10/sec)
- the percentage of the delta in inputvalue that is taken into account (1..100)



Var 0 value 0
{
// Set up an endless timer, calling a Control function every 100 ms
&Control = 0
&Control = TIMER 1 0 10 // 100 msec (Just experiment a little with this value)
}

Var 1 name Control Link SUBRUTINE
{
// Compute the delta change
L2 = &InputVal
L2 = L2 - &DampedVal // L2: delta
// take 10% of the delta (Just experiment a little with this percentage)
L1 = MUL L2 10
L1 = DIV L1 100 // L1: 10% of delta
L0 = &DampedVal + L1
&DampedVal = L0
}

var 2 name DampedVal value 0
{
&OutputVal = &DampedVal
}

Var 3 name InputVal Link In ...
Var 4 name OutputVal Link Out ...

hercules
10-27-2009, 01:33 PM
DoublePost...sorry

hercules
10-27-2009, 01:39 PM
Hi Nico,

thank you very much for your assistance in learn how less i know the SIOC Code;-)

I need a little more help, i have no idea how do add your code to my existing Servo Code. I reall dont want a plug and play solution, but a finger in the the correct direction:-)

Here is my Servo Code for the A/T. Will the TIMER work between the calculated value (normaly send to the servo var) and the Servo Var, in this way that the TIMER takes the calculated value, modify it and send it to the servo output Var?


THX

Thomas

Var 0024, Link FSUIPC_INOUT, Offset $310A, Length 2
Var 0025, Link FSUIPC_IN, Offset $088C, Length 2 // THROTTLE 1
{
IF V0024 > 7
{
L0 = V0025 / 40
L1 = L0 + 20
V0501 = 355 + L0
}
ELSE
{
V0501 = 0
}
}
Var 0500, Link USB_SERVOS, Output 1, PosL 233, PosC 335, PosR 608

Var 0030, Link FSUIPC_IN, Offset $0924, Length 2 // THROTTLE 2
{
IF V0024 > 7
{
L0 = V0030 / 40
L1 = L0 - 350
V0500 = 615 - L1
}
ELSE
{
V0500 = 0
}
}
Var 0501, Link USB_SERVOS, Output 2, PosL 300, PosC 535, PosR 770

Var 0082, Link FSUIPC_OUT, Offset $0932, Length 2 // Engine 2 Throttle lever, 4096 to +163
Var 6502, name Throttlepoti2, Link USB_ANALOGIC, Input 1, PosL 1, PosC 125, PosR 190 // Throttlepoti1
{
V0081 = &Throttlepoti2 * 125
V0082 = &Throttlepoti1 * 125
}
Var 6501, name Throttlepoti1, Link USB_ANALOGIC, Input 2, PosL 1, PosC 125, PosR 132 // Throttlepoti1
Var 0081, Link FSUIPC_OUT, Offset $089A, Length 2 // Engine 1 Throttle lever, 4096 to +163

kiek
10-27-2009, 05:54 PM
here it is:



Var 0 value 0
{
// Set up an endless timer, calling a Control function every 100 ms
&Control = 0
&Control = TIMER 1 0 10 // 100 msec (Just experiment a little with this value)
}

Var 1 name Control Link SUBRUTINE
{
// Compute the delta change
L2 = &InputVal1
L2 = L2 - &DampedVal1 // L2: delta
// take 10% of the delta (Just experiment a little with this percentage)
L1 = L2 * 10
L1 = DIV L1 100 // L1: 10% of delta
L0 = &DampedVal1 + L1
&DampedVal1 = L0

L2 = &InputVal2
L2 = L2 - &DampedVal2 // L2: delta
// take 10% of the delta (Just experiment a little with this percentage)
L1 = L2 * 10
L1 = DIV L1 100 // L1: 10% of delta
L0 = &DampedVal2 + L1
&DampedVal2 = L0
}


var 2 name DampedVal1 value 0
{
&OutputVal1 = &DampedVal1
}

Var 3 name InputVal1
Var 0024, Link FSUIPC_INOUT, Offset $310A, Length 2
Var 0025, Link FSUIPC_IN, Offset $088C, Length 2 // THROTTLE 1
{
IF V0024 > 7
{
L0 = V0025 / 40
L1 = L0 + 20
&InputVal1 = 355 + L0
}
ELSE
{
&InputVal1 = 0
}
}
Var 0501, Link USB_SERVOS, Output 2, PosL 300, PosC 535, PosR 770
Var 0081, name OutputVal1, Link FSUIPC_OUT, Offset $089A, Length 2 // Engine 1 Throttle lever, 4096 to +163
Var 6501, name Throttlepoti1, Link USB_ANALOGIC, Input 2, PosL 1, PosC 125, PosR 132 // Throttlepoti1

var 4 name DampedVal2 value 0
{
&OutputVal2 = &DampedVal2
}
Var 5 name InputVal2
Var 0030, Link FSUIPC_IN, Offset $0924, Length 2 // THROTTLE 2
{
IF V0024 > 7
{
L0 = V0030 / 40
L1 = L0 - 350
&InputVal2 = 615 - L1
}
ELSE
{
&InputVal2 = 0
}
}
Var 0500, Link USB_SERVOS, Output 1, PosL 233, PosC 335, PosR 608
Var 0082, name OutputVal2, Link FSUIPC_OUT, Offset $0932, Length 2 // Engine 2 Throttle lever, 4096 to +163
Var 6502, name Throttlepoti2, Link USB_ANALOGIC, Input 1, PosL 1, PosC 125, PosR 190 // Throttlepoti1
{
V0081 = &Throttlepoti2 * 125
V0082 = &Throttlepoti1 * 125
}

hercules
10-28-2009, 06:31 PM
Nico,

thanks a lot for the great service! Unfortunately the code doesnt work. The Levers immediately moving full in both directions (one in upper and one in lower direction).
After some seconds one Servo begins to stuttering. I tried to change the values that you recommanded to play around with, but seems to have no effect.

I dont want to steal your time.

Regards

Thomas

kiek
10-29-2009, 03:47 AM
Hi Thomas,

I have no experience with programming servos's. Hope somebody else will jump in to correct that part of the code.

regards,
Nico

hercules
10-29-2009, 05:57 PM
Hi Nico,

to program a servo is basicaly easy. The Servo has a pot or the positioning which use values from 1 (full left) to about 1000 (full right). In Sioc you can just send the value to the Servo Var for the needed positon. I think is not so far from motor controling.

Thanks again for your support and i will see how i can use your suggested code.

Regards

Thomas

kiek
10-29-2009, 06:46 PM
Hi,

That sounds simple indeed.

I have looked at it again, and I found two mistakes I made. I had connected the outputvals to FSUIPC offsets instead of to the servo's...
Try this file:




Var 0 value 0
{
// Set up an endless timer, calling a Control function every 100 ms
&Control = 0
&Control = TIMER 1 0 10 // 100 msec (Just experiment a little with this value)
}

Var 1 name Control Link SUBRUTINE
{
// Compute the delta change
L2 = &InputVal1
L2 = L2 - &DampedVal1 // L2: delta
// take 10% of the delta (Just experiment a little with this percentage)
L1 = L2 * 10
L1 = DIV L1 100 // L1: 10% of delta
L0 = &DampedVal1 + L1
&DampedVal1 = L0
L2 = &InputVal2
L2 = L2 - &DampedVal2 // L2: delta
// take 10% of the delta (Just experiment a little with this percentage)
L1 = L2 * 10
L1 = DIV L1 100 // L1: 10% of delta
L0 = &DampedVal2 + L1
&DampedVal2 = L0
}


var 2 name DampedVal1 value 0
{
&OutputVal1 = &DampedVal1
}

Var 3 name InputVal1
Var 0024, Link FSUIPC_INOUT, Offset $310A, Length 2
Var 0025, Link FSUIPC_IN, Offset $088C, Length 2 // THROTTLE 1
{
IF V0024 > 7
{
L0 = V0025 / 40
L1 = L0 + 20
&InputVal1 = 355 + L0
}
ELSE
{
&InputVal1 = 0
}
}
Var 0501, name OutputVal1, Link USB_SERVOS, Output 2, PosL 300, PosC 535, PosR 770
Var 0081, Link FSUIPC_OUT, Offset $089A, Length 2 // Engine 1 Throttle lever, 4096 to +163
Var 6501, name Throttlepoti1, Link USB_ANALOGIC, Input 2, PosL 1, PosC 125, PosR 132 // Throttlepoti1
var 4 name DampedVal2 value 0
{
&OutputVal2 = &DampedVal2
}
Var 5 name InputVal2
Var 0030, Link FSUIPC_IN, Offset $0924, Length 2 // THROTTLE 2
{
IF V0024 > 7
{
L0 = V0030 / 40
L1 = L0 - 350
&InputVal2 = 615 - L1
}
ELSE
{
&InputVal2 = 0
}
}
Var 0500, name OutputVal2, Link USB_SERVOS, Output 1, PosL 233, PosC 335, PosR 608
Var 0082, Link FSUIPC_OUT, Offset $0932, Length 2 // Engine 2 Throttle lever, 4096 to +163
Var 6502, name Throttlepoti2, Link USB_ANALOGIC, Input 1, PosL 1, PosC 125, PosR 190 // Throttlepoti1
{
V0081 = &Throttlepoti2 * 125
V0082 = &Throttlepoti1 * 125
}

Hessel Oosten
10-30-2009, 06:15 AM
Although I cannot help in detail, there's a lot of information on the internet about:

** slowing servo ** (Google)

Hessel

hercules
11-05-2009, 03:55 PM
Hey Nico,
it works basicaly and makes the levers much more smoother during the flight, but during SIOC initalization the lever makes a very fast Jump (each in other direction). I played with the values, and when i set the timer to 1 its much better, but not good.

Thanks aganin for sharing your knowlegde:-)

Regards

Thomas