Log in

View Full Version : USBServos Software not working?



Boeing 747 Flyer
06-29-2010, 02:13 PM
Hello everyone,

I have recently received my USBServos Card and connected to it a Servo, which I have previously tested with a Servo Tester and it works fine.

The Red LED on the card lights up, the computer recognises the USB connection (when I start USBServos Software it detects it as device "2132"), and finally I tested the Servo pins with a Multimeter and I definitely receive a 5V power supply.

The problem? Well, similar to another user on the forum, when I move the slider along the bottom, or manually enter a value, and click send, the servo does not seem to move at all. I have ensured the Pins and Wires are the correct way around.

I remember somebody posted a link to a site which tells you how to test these Cards, sadly the link does not seem to elaborate on the USBServos Card.

Any ideas?

Thanks alot,

Jack:p

P.S: I apologise for making a new thread, but this is a new issue and separate from my other threads.

fordgt40
06-29-2010, 02:39 PM
Jack

I think we have been expecting this post:) On your servo lead connector what is the sequence of signals? Is it positive(red), signal(yellow), ground(black) ? Presumably you have connected a 5volt supply to the USBServoscard

David

Boeing 747 Flyer
06-29-2010, 02:46 PM
Jack

I think we have been expecting this post:) On your servo lead connector what is the sequence of signals? Is it positive(red), signal(yellow), ground(black) ? Presumably you have connected a 5volt supply to the USBServoscard

David

Don't worry David, I know my difference between GND, 5V and DATA =).

The software and card seem to be communicating - The Red LED lights up only when I start the USBServos softwware, meaning there is a definitive link.

Yes, the 5V supply is conected (look at first post).

Strange huh?

fordgt40
06-29-2010, 02:48 PM
Jack

So what is the sequence of pin numbers and their associated signals on your servo lead to USBcard connector then?

David

Boeing 747 Flyer
06-29-2010, 02:55 PM
Yes, it is Red -> Orange -> Black, in accordance with the O/C manual.

It is connected the correct way around into Servo slot 1, I also tried 3 and 4 too.

737NUT
06-29-2010, 03:08 PM
I use IOCP Console with-in SIOC to test my servo's. Write a short script and load it. To me it is much easier to use. I have never used the servo software. Only SIOC.

Boeing 747 Flyer
06-29-2010, 03:18 PM
Okay, as you know I'm not all too experienced with the SIOC lago, but I'll load the following script:


var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 0, PosC 511, PosR 1023, Type 2 // Servo Motor
Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // Indicated Air Speed * 128
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
}

Then I open the IOCP Console, no need to start FSX?

Then, I activate the vars manually through clicks in the IOCP Console, right?

If I'm wrong, please don't attack me, just post a script that I could use. Thanks. In fact, 737NUT, could you jsut post the SIOC testing script you use?

fordgt40
06-29-2010, 03:50 PM
Jack

I was only eliminating the obvious first. By all means try a script but as 737Nut`s advice previously, make sure that the values are within the servo range, else you could burn it out. I assume that you are using iocards_test.exe as your testing programme and that the analogue inputs on the left of the graphics display are fluctuating in value?

David

Boeing 747 Flyer
06-29-2010, 04:11 PM
Jack

I was only eliminating the obvious first. By all means try a script but as 737Nut`s advice previously, make sure that the values are within the servo range, else you could burn it out. I assume that you are using iocards_test.exe as your testing programme and that the analogue inputs on the left of the graphics display are fluctuating in value?

David

Yes David, that is correct.

deering
06-29-2010, 04:19 PM
Jack,

how will you get the IAS value from FSUIPC if you don't start FSX?

Boeing 747 Flyer
06-29-2010, 04:25 PM
Jack,

how will you get the IAS value from FSUIPC if you don't start FSX?

You can't, I'm wodnering if there was a way to test the servo without starting FSX.

Regardless, I'd much rather get it working through the testing software first, for the primary reason I could burn the servo.

Also, for me to get SIOC working is a nightmare, I'm just keeping it simple to start with.

deering
06-29-2010, 04:37 PM
Jack, input via IOCP Console is simple enough.

An off topic question for you if I may. At the end of your last thread, Nico supplied a script to get you AP led working. Did you spend some time to work out why that version worked while the previous version didn't?

Boeing 747 Flyer
06-29-2010, 04:41 PM
Yes, a reduction of 4 to 3 variables (removing v1 and replacing with the pre-existing var 9000) worked.

Anyway, back on topic. The USBServos Software should work, so there is no need to use SIOC yet. That is the whole intnded purpose of USBServos Software.

As I said, setting up sioc.ini, mkaing SIOC work and ensuring the Servo doesn't burn out is too much for me. I will use USBServos first, that is the purpose of this thread.

fordgt40
06-29-2010, 04:43 PM
Jack

You are correct, it is much better to use the testing software IOCards_test.exe. On the basis that you have a separate 5 volt supply, the device is recognised, the connections are correct and the appropriate radio button is selected - then if the servo does not follow movement commands from the slider or numeric input. then perhaps the servo should be retested though would that involve changing the connections again? Incidentally, what servo are you using?

David

Boeing 747 Flyer
06-29-2010, 04:48 PM
Not sure of the model number right now, but can confirm it is an "Electonix" one, apparently very similar to the Hitec HS-55, but the wiring is identical to a JR one.

I will-triple-check the wire connections. It is because I had to swap the colouring around, so now they're all different colours, very dangerous & confusing, I'll probably revise the connections on Friday.

deering
06-29-2010, 04:52 PM
Yes, a reduction of 4 to 3 variables (removing v1 and replacing with the pre-existing var 9000) worked.
.
.


..but, you glossed over the question of why it worked and if you'd spent any time figuring it out.

iwik
06-30-2010, 03:02 AM
Jack,
you can check your board without fitting a servo and with no external P/S.
Do the following,
Place a 1000 ohm resistor in series with a LED.
Connect the Anode end of the combo to the center pin of say SERVO 1 connector and connect the cathode of the LED to Ground.
Run only the IOCards_test.exe.
Select servo 1 and adjust the slider,the led should glow bright at 1023 and dims as you go towards 0
Ive tried it on my one and it works ok.
This way you lessen the chance of destroying anything.
Hope this helps
Les

Boeing 747 Flyer
07-01-2010, 12:28 PM
Hiya Iwik,

I will definitely try that after I've connected a different Servo, ensuring it is in correct configurtion for the card.

Boeing 747 Flyer
07-02-2010, 10:45 AM
Okay guys, fantastic news. I have managed to sucessfully get the card working with USBServos Software. I have also found the values I want from the ASI, take a look:


FAR LEFT (ASI: 103Knots) - 250

FAR RIGHT (ASI: 375Knots) - 700

CENTRE (ASI: 225Knots) - 475

Assuming there is nothing wrong with those values, I am working on implementing it into a SIOC script. However, there are a few problems...

- First of all, I only want the ASI to "pick up" when the FSX ASI reaches 103Knots.

- Secondly, don't want the ASI to exceed 375Knots (700 Value), whilst it is capable of doing up to 400 Knots, I do not want to overstress the Servo. I take it this is where I implement the limiting factors into my SIOC scripts, but what if I exceed 375Knots? Does the ASI just "die"?

Thanks alot,

Jack (getting there!):D

fordgt40
07-02-2010, 10:53 AM
Jack

What was the reason why the servo did not work?

"I take it this is where I implement the limiting factors into my SIOC scripts" - yes, 737NUT gave you a snippet of SIOC code to achieve this in the previous thread

David

Boeing 747 Flyer
07-02-2010, 11:19 AM
Jack

What was the reason why the servo did not work?

"I take it this is where I implement the limiting factors into my SIOC scripts" - yes, 737NUT gave you a snippet of SIOC code to achieve this in the previous thread

David

I am aware of the fact that he gave me the limiting factors. I asked what would happen if I exceeded 375Knots.

The Servo did not work because of dodgy contacts, everything else was okay. This was the reason the fault bypassed th multimeter test (because the Servo contacts are okay with that, just dodgy with the card). I made an entire new servo to USBServos adapter and all is okay.

Anyway, back on track, how would I get the Servo to "pick up" at 103Knots (ie only detect an output at that speed)?

fordgt40
07-02-2010, 12:48 PM
Jack

"I am aware of the fact that he gave me the limiting factors. I asked what would happen if I exceeded 375Knots" - nothing, the gauge will stop at the limiting value you have given!!!!!!!!

Use the sioc code to test the asi starter value ie 103knots and only move if it is greater.

David

Boeing 747 Flyer
07-02-2010, 01:25 PM
This is my script at the moment:


var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 250, PosC 475, PosR 700, Type 2 // Servo Motor
Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // Indicated Air Speed * 128
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
}


As you can see, it is without limiting factor commands. I tried adding one, but the script didn't compile.

Apart from limiting commands, is there anything OTHER than them I need to add?

fordgt40
07-02-2010, 01:33 PM
Jack

What was your code that would not compile?

Yes, there is more code ammendment required - for example you will need to establish whether the multiplier 1.5 or indeed the + value of 213 is correct

David

Boeing 747 Flyer
07-02-2010, 01:55 PM
This was the script:


V0000
$servo4=320
var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 250, PosC 475, PosR 700, Type 2 // Servo Motor
Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // Indicated Air Speed * 128
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
}

Furthermore, how would I know if the 1.5 Multiplier or the 213 value is correct? What would I have to amend (almost there now, surely!).

fordgt40
07-02-2010, 03:26 PM
Jack

Have you bothered to really comprehend the manuals or follow the examples on Nico`s site, I think not. You have a variable V0000 that is generally only used for setting initial start up values, but it has no curly brackets to contain code. There is also a line "&servo4 = 320" that is not attached to anything! Even if it was syntactically correct it still would not achieve what you want. To have a limiting function, you need to insert some code to check the value of L0 and reset it to the max allowable before sending it to the gauge. Logically, if A is greater than 1000 then a = 1000 (not sioc syntax but this is the logic you need to code) Also you may need to set a lower limit to be on the safe side

Re your second question after you have inserted limiting code, check out the gauge movement by trial and error to see how the gauge resonds to varying asi speeds and adjust the multiplying factor (1.5) and start position addition (213) as necessary. Previous posts have given you the logic behind this

Sorry Jack, but given your level of understanding there is a long way to go yet and I do not propose to join you on the journey

This forum has provided a lot of help, but not apparently matched by your willingness to get to grips with SIOC. As they say in The "Dragons Den" - sorry but I`m out!

David

Boeing 747 Flyer
07-02-2010, 04:11 PM
I understood why the script was incorrect before I posted it. I only posted it because you asked to see it, and I was wondering why you wanted to see a script that was so clearly wrong

I struggle with SIOC. So What? What happened to the little bit of ol' encouragement;). I enjoy learning new things, and post my questions in a simple-as-possible format in the hope for a nice simple answer. I have thanked you for your help so far, and you can if you wish help me further or not.


but not apparently matched by your willingness to get to grips with SIOC

Wow! I really am surprised to hear that, after I constantly try to come across as enthusiastic to learn this complex language. I thought I had proven to everyone that I really wanted to learn SIOC, sadly not eh?;)

ANYWAY

You second paragraph in that post was fantsatic, it answered my question quickly. If I cut the last bit out of your post I have a perfect answer, which is exactly what I look for. I asked how would I do this, you answered Trial and Error. Perfect, simple answer!:D

NOW

I do not want this thread to be filled with moans, groans and criticisms!:p I created this thread to gain help, and I have clearly received help in some cases (paragraph 2 on your post for example), which I cannot thank people enough for.

I will try the Trial and Error method, an rectify my mistake (which I knew about remember!;). I may not suceed, but I can at least understand why it doesn't compile.

Thank you,

Jack:p

fordgt40
07-02-2010, 04:31 PM
Jack

You misunderstand
The reason I asked to see your coding was twofold:-

1) If it was close then I was happy to correct it for you
2) It would show me what progress you had made in learning SIOC

David

Boeing 747 Flyer
07-02-2010, 04:36 PM
Okay, fair enough.

Before you made your psot asking to see the code, I tried curly brackets (I know these are required), and it didn't compile. So I thought I may aswell give you that one, as they both didn't compile.

iwik
07-02-2010, 07:55 PM
Hi Jack,
This forum is one which encourages learning.Dont get David wrong,he like most of us will help when ever possible.Sioc is a form of programming language
that assumes a certain level of basic programming.A lot of people have played around with the basic language and hence have some basic logic skills.Whic they can apply to SIOC proframming.What alot of us have done is to take for example your master card and connected some switches and pots and used other peoples examples to get results.Then they modify it bit by bit till they get it to work for them.Its is trial and error but much is learnt this way. If the basics are learnt then its amazing what satisfaction is gained.Others wont get frustrated trying to teach you what can easily do yourself.
Ive had basic programming experience but found SIOC quite daunting as there are quite a few differences but the logic skills aquired allowed me to do the basic maths before requiring asistance.
SIOC has certain rules like using the Curly Brackets that must be learnt an dthe best way is by looking at heaps of examples, Nico's site is excellent for this.
Time is what you need to spend to familarise yourself with Sioc.
Hope this helps and please dont be discouraged we all have gone thru this pain.
Hope this helps and good luck with the learning process.
Regards
Les

Boeing 747 Flyer
07-03-2010, 03:33 AM
Well, curly brackets do not seem to work, it just says command outside of place when I apply curly brackets over the code.

I keep getting rather frustrated at the fact that SIOC does not work for me, even AFTER consulting the manuals especially regarding the curly brackets.

If someone could show me what the scurly brackets should look like, I will be extremely interested, because I belive I've tried every combination under the sun.

I learn not through reading manuals, or being told how to do something, I learn by seeing (in this case) a complete example of SIOC script for my Servo, which I would then analyze and understand what each entry means.

I keep getting told what each little fragment of script means, but I think I need to look at the bigger picture. For example, I was told that I would have to insert a L0 entry into the script. I know what this is, but I can't understand what I would need to define with it.

I will try and obtain from somewhere a complete SIOC script for an ASI Servo, and then analyzw what each entry means.

fordgt40
07-03-2010, 05:46 AM
Jack

One last try!

Curly brackets are { }

Please follow the advice you have previously received from Nico, Iwik and others to try some simple coding exercises first using Nico`s site.

There is no "big" picture with SIOC, only a series of little ones

SIOC is not working for you because you are not trying and succeeding with very simple exercises - just jumping into trying to solve a medium complexity issue without understanding the basics

You will not learn by only looking at examples, firstly, you need to understand the following:-

The various commands and what they do
The proper syntax to use the commands
The declaration of variables and associated syntax
The use of "internal" variables
The use of boolean/logical variables
Programme flow - SIOC is unusual insofaras it is an "event" driven language. Nothing happens until a variable changes value - then the code attached to that variable (within curly brackets) is exexcuted. Also any variables within that code, if changed, will prompt the running of their own associated code

Edit to add
Programme flow with the use of IF and ELSE etc

All this and more is within the manuals and Nico`s site. If you persist as per your last post, then you will have a very long journey - even if you find some ASI code, then how will you adapt it for your own use with the knowledge level currently being evidenced?

You ask for advice, please follow it

David

Boeing 747 Flyer
07-03-2010, 02:50 PM
Hiya David,

I know what curly brackets are and how to use them, but they don't seem to work.

I have gotten this far, I've managed to create a semi-useable script but things like the V000 will not compile because they are unfinished/incomplete.


Var 0000
{
&servo4=250
}
var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 250, PosC 475, PosR 700, Type 2 // Servo Motor
Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // Indicated Air Speed * 128
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
}


Getting there?

P.S: Before you ask, I have read what you have said and I udnerstand this post re-glosses over previously posted information.

deering
07-03-2010, 03:24 PM
See, computer are dumb. They need data in the formats they been programmed to handle. They can't take leaps of imagination to interpret what someone's personal way of writing things might mean. And SIOC is particularly rigid in its requirements. Do you see any difference between the statements you have written that don't compile as compared to those that do?

Find that, then you'll still have some learning to do about "event driven".

iwik
07-03-2010, 03:26 PM
Jack,
&servo4=250 should read &servo4 = 250
Les

deering
07-03-2010, 03:34 PM
Ah well, another spoonful.

Boeing 747 Flyer
07-03-2010, 03:40 PM
Ah well, another spoonful.
:roll:

Also, thanks Iwik for the advice. I now get the error "= is expected" but I will try and figure this out. One little step at a time.

I completely udnerstand how SIOC is event driven. Thankfully, this is one thing that IS well documented within SIOC and clearly labelled in the presentation in the form of a diagram. EG: No change in Var = No information supplied

Boeing 747 Flyer
07-03-2010, 05:14 PM
Ah well, another spoonful.

:roll:

EDIT:

Thank god, progress. The following script *seems* to be okay and compiles well, it is a long way off I know but here's what I've got so far:


Var 0000
{
&servo4 = 250
}
var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 198, PosC 446, PosR 693, Type 2 // Servo Motor
Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // Indicated Air Speed * 128
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
}


Next major step is setting up the SIOC.ini file to handle the Servo3 for ASI and USBServos Card.

deering
07-03-2010, 06:08 PM
.
I completely [understand] how SIOC is event driven.....

Good to hear.

What's the event that's going to cause:

&servo4 = 250

to be executed?

fordgt40
07-03-2010, 06:25 PM
Ho Hum:roll:
You can take a horse to water and it will not drink
You can hold its nose and it will not drink
You can hold its nose, dunk its head under water and it will still not drink
Ho Hum:roll:

737NUT
07-03-2010, 07:03 PM
Good to hear.

What's the event that's going to cause:

&servo4 = 250

to be executed?

SIOC runs V0000 at start up one time only so whatever is under that V0000 gets done.

737NUT
07-03-2010, 07:05 PM
:roll:

EDIT:

Thank god, progress. The following script *seems* to be okay and compiles well, it is a long way off I know but here's what I've got so far:


Var 0000
{
&servo4 = 250
}
var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 198, PosC 446, PosR 693, Type 2 // Servo Motor
Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // Indicated Air Speed * 128
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
}


Next major step is setting up the SIOC.ini file to handle the Servo3 for ASI and USBServos Card.

Good job, question. Are you using Notepad or the SIOC config software to make your code?

737NUT
07-03-2010, 07:09 PM
You also have another issue to deal with. Is the gauge linear? Boeing Airspeed gauges are not! That complicates your program tremendously as you have different scales for the servo to follow the true airspeed. I sent you an example by email how to that. I'll send you another for the limits. What gauge are you using?
Rob

deering
07-03-2010, 07:12 PM
SIOC runs V0000 at start up one time only so whatever is under that V0000 gets done.

I hoped that Jack would have thought that through ...and come up with a different answer.

737NUT
07-03-2010, 07:27 PM
Here you go, i attached a config file for you based on the info you gave me.
Rob

Boeing 747 Flyer
07-04-2010, 05:01 AM
You also have another issue to deal with. Is the gauge linear? Boeing Airspeed gauges are not! That complicates your program tremendously as you have different scales for the servo to follow the true airspeed. I sent you an example by email how to that. I'll send you another for the limits. What gauge are you using?
Rob
If you're referring to the real-life gague, it IS linear (ie the separation between speed integers is always the same). The gague is some ex-military instrument, ranging from 50Knots to 500Knots. Thanks alot for your efforts in producing the SIOC script, I will try it ASAP once I've had a go at configuring SIOC.ini

And Dave and Deering... Could you gloss over your recent comments once more and check that they're necessary? DO they really add to the thread?Do they assist me, or potential readers of the thread?


Good to hear.

What's the event that's going to cause:

&servo4 = 250

to be executed?

According to the SIOC manual, it will be the associated Variable (no var change = NO action), in this case V0000.

EDIT: As usual, Opencockpits have a dead link (regarding sioc.ini config tool)

fordgt40
07-04-2010, 05:48 AM
Jack

If you read the manual for the USBServos card you will notice on page 6, that it explains how to edit sioc.ini accordingly:roll:

I will let other "brave" readers of this thread to draw their own conclusions re "unnecessary comments"

David

Boeing 747 Flyer
07-04-2010, 06:24 AM
I will let other "brave" readers of this thread to draw their own conclusions re "unnecessary comments"

David
"Ho Hum
You can take a horse to water and it will not drink
You can hold its nose and it will not drink
You can hold its nose, dunk its head under water and it will still not drink
Ho Hum"

I rest my case.

If anyone's interested, SIOC.ini (not working):


[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=20
CONFIG_FILE=ServoT.ssi

[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No

[MASTERS]

[USBSERVOS]
USBSERVOS=1,77

[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=50

[IOCP CLIENTS MODULES]
IOCPini_delay=3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099

[SOUND MODULE]
Sound_disable=Yes
Volume=100

And ServoT.ssi file, the one I'm using for FSX -> ASI interfacing:


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, name Intialization // Set servo positions
{
&Servo4 = 367
}

Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 367, PosC 637, PosR 907, Type 2 // ASI gauge

Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
IF L0 < 50
{
&Servo4 = 367
}
IF L0 > 350
{
&Servo4 = 907
}
}


Best regards,

Jack

deering
07-04-2010, 09:14 AM
..and Deering... Could you gloss over your recent comments once more and check that they're necessary? DO they really add to the thread?Do they assist me, or potential readers of the thread?



According to the SIOC manual, it will be the associated Variable (no var change = NO action), in this case V0000.....


Jack, with my comments and questions, I've been trying to help you learn SIOC. Others reading them and thinking them through, might be helped. So one more step along the path. When will &servo4 be set to 250 in your script?

Jim

Boeing 747 Flyer
07-04-2010, 10:14 AM
When will &servo4 be set to 250 in your script?

Jim

As I said, when Var0000 event occurs, which runs at startup.

deering
07-04-2010, 10:24 AM
Jack,

As you have the script, there is no event to cause the commands to be run.

Jim.

Boeing 747 Flyer
07-04-2010, 11:05 AM
Oh well, I'll see how it goes.

Just need to set up SIOC.ini at the moment, look at prev post.

737NUT
07-04-2010, 12:01 PM
Jack,

As you have the script, there is no event to cause the commands to be run.

Jim.
Every time the IAS changes the script below it will run! I don't get your comments?? Please explain as i'm curious as to how all my scripts run fine this way.

kiek
07-04-2010, 12:37 PM
Hi Jack,


As I said, when Var0000 event occurs, which runs at startup.

There is no Value 0000 "event" in your SIOC script! You have to add an Attribute value, e.g. Value 0
This is described in my howto about initialisation constructs http://www.lekseecon.nl/howto.html#init . You must have missed it.

Another thing that you do not handle is the scaling of the IAS value. In FSUIPC the IAS value is times 128. So you have to divide by 128 first before doing any other mathematics...

Nico

Boeing 747 Flyer
07-04-2010, 01:46 PM
Okay Nico, I MAY try that, but this doesn't explain why Rob's scripts seem to work okay for him without that?

deering
07-04-2010, 02:05 PM
Every time the IAS changes the script below it will run! I don't get your comments?? Please explain as i'm curious as to how all my scripts run fine this way.

Rob, I should have written "command" and not "commands". The exchange with Jack was about initialization and Var 0000. Nico has pointed him in the right direction now.

Jim

kiek
07-04-2010, 02:09 PM
Okay Nico, I MAY try that
No, you MUST do that otherwise that init statement ( &servo4 = 250 ) is not executed at start up. BTW: Missing that statement may not be a problem at all because right after programm start the servo will be controlled by the IAS value from the FSUIPC offset, so you MAY even get rid of the Var 0000 completely.
But IF you need an init statement in Var 0, then you MUST give Var 0 an Attribute value.



but this doesn't explain why Rob's scripts seem to work okay for him without that?
I am not aware of Rob's script (was not that sent to you be email?), but it might be because of the reason I explained above.

I'm only explaining SIOC theory here.

Nico

Boeing 747 Flyer
07-04-2010, 02:22 PM
Okay, I will try and implement a value then.

Rob may have sent me a script but I have received nothing by email, not sure what happened there (he DID send some by PM though).

737NUT
07-04-2010, 02:59 PM
Here is a copy of my multiple servo set-up, also you will notice i don't have overlimits in my code because of this. A decent servo will NOT burn out if is driven to the stops. It is designed to go from stop to stop. If they did then allot of RC planes would crash. What they won't take well is binding/overloading from excessive workload or bad signal interpretation. I burnt up a couple of cheap servo's awile back but NEVER a good one. Jut my .02 :)


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : sioc.txt
// * Date : 7/4/2010



Var 0000, Value 0
{
&VSI = 612
&EngN1servo = 345
&Eng3N1servo = 346
&eng3N2servo = 345
&Eng2N2servo = 345
&egt1servo = 340
&servo1 = 100
&servo4 = 22
&servo5 = 335
&servo3 = 850
&servo6 = 335
&servo2 = 945
}

Var 0010, Link FSUIPC_IN, Offset $02C8, Length 4, Type 1 // Vertical Speed
{
L0 = V0010 * 0.7895 // FSUIPC conversion, L0=VS
L0 = ABS L0 // L0 not signed
L2 = L0
IF L0 <= 1000 // First sector
{
L1 = L2 * 0.15 // (150 steps/1000 values) = 0.15
}
ELSE // Is a greater value
{
L2 = L0 - 1000 // L2 only have values for next sector
IF L0 <= 2000 // Second sector
{
L1 = L2 * 0.1 // (100 steps / 1000 values) = 0.1
L1 = L1 + 125 // Add steps of others sectors
}
ELSE
{
L2 = L0 - 2000 // L2 only have values for next sector
IF L0 <= 4000 // 3. Sector
{
L1 = L2 * 0.08 // ( 160 / 2000) =0.08
L1 = L1 + 225 // Add steps of others sectors 150+100
}
ELSE
{
L2 = L0 - 4000 // L2 only next sector (Value-1000-1000-200
IF L0 <= 6000 // 4. Sector
{
L1 = L2 * 0.05 // ( 100 / 2000) =0.05
L1 = L1 + 410 // Add steps of others sectors 150+100+160
}
ELSE // Out of range
{
L1 = 510 // Max. position
}
}
}
}
IF V0010 < 0 // if vs is negative
{
&VSI = 612 + L1 // subctract from center
}
ELSE
{
&VSI = 612 - L1 // else add to center
}
}

Var 0001, name VSI, Link USB_SERVOS, Output 1, PosL 170, PosC 612, PosR 1023, Type 2 // vsiservo

Var 0002, name EngN1servo, Link USB_SERVOS, Output 2, PosL 345, PosC 647, PosR 950, Type 2 // N1 Servo

Var 0003, name egt1servo, Link USB_SERVOS, Output 3, PosL 1, PosC 550, PosR 1023, Type 2 // EGT Gauge

Var 0004, name eng3N2servo, Link USB_SERVOS, Output 4, PosL 345, PosC 647, PosR 950, Type 2

Var 0005, name Eng3N1servo, Link USB_SERVOS, Output 5, PosL 345, PosC 647, PosR 950, Type 2

Var 0006, name Eng2N2servo, Link USB_SERVOS, Output 6, PosL 345, PosC 647, PosR 950, Type 2

Var 0007, name eng3N2, Link FSUIPC_INOUT, Offset $09C6, Length 2 // N2 rpm for eng 3
{
L0 = &eng3N2 * 0.00606
L1 = L0 * 5.5
L2 = 345 + L1
&eng3N2servo = L2
}

Var 0011, name eng1N1, Link FSUIPC_IN, Offset $0898, Length 2
{
L0 = &eng1N1 * 0.00606
L1 = L0 * 5.5
L2 = 345 + L1
&EngN1servo = L2
CALL &ConfigWarn1
}

Var 0012, name Eng1Egt, Link FSUIPC_IN, Offset $08BE, Length 2 // Eng 1 EGT
{
L0 = &Eng1Egt * 0.05249023 // 16384=860C
L1 = L0 * 0.522727
L2 = L1 + 310
&egt1servo = L2
}

Var 0013, name relay1, Link USB_RELAYS, Output 1 // AP Power

Var 0014, name APMaster, Link FSUIPC_INOUT, Offset $0278, Length 2 // Status of AP master switch
{
IF &APMaster = 1
{
&relay1 = 1
}
ELSE
{
&relay1 = 0
}
}

Var 0015, name Eng1N2, Link FSUIPC_INOUT, Offset $0896, Length 2
{
L0 = &Eng1N2 * 0.00606
L1 = L0 * 5.5
L2 = 345 + L1
&Eng2N2servo = L2
}

Var 0016, name No2N1, Link FSUIPC_INOUT, Offset $0930, Length 2
{
L0 = &No2N1 * 0.00606
L1 = L0 * 5.5
L2 = 345 + L1
}

Var 0017, name eng3N1, Link FSUIPC_INOUT, Offset $09C8, Length 2
{
L0 = &eng3N1 * 0.00606
L1 = L0 * 5.5
L2 = 345 + L1
&Eng3N1servo = L2
}

Var 0018, name LeFlapyellow, Link USB_RELAYS, Output 2 // Leading Edge Flaps in transit

Var 0019, name LeFlapGrn, Link USB_RELAYS, Output 3 // Leading Edge Flaps Extended

Var 0020, name Eng1RevInd, Link USB_RELAYS, Output 4 // Reverser operating Engine 1

Var 0021, name Warning, Link USB_RELAYS, Output 5 // Config Warning light

Var 0022, name Eng3RevInd, Link USB_RELAYS, Output 6 // Reverser operating Eng #3

Var 0023, name Eng3StartValve, Link USB_RELAYS, Output 7

Var 0025, name eng3inrev, Link FSUIPC_INOUT, Offset $227C, Length 4 // Reverse thrust position
{
IF &eng3inrev = -5
{
&Eng3RevInd = 1
}
ELSE
{
&Eng3RevInd = 0
}
}

Var 0024, name LEFlapPos, Link FSUIPC_INOUT, Offset $30E8, Length 2
{
IF &LEFlapPos < 8200
{
&LeFlapyellow = 1
}
ELSE
{
&LeFlapyellow = 0
}
IF &LEFlapPos > 8500
{
&LeFlapGrn = 1
}
ELSE
{
&LeFlapGrn = 0
}
IF &LEFlapPos = 0
{
&LeFlapyellow = 0
}
}

Var 0026, name StartValve3, Link FSUIPC_INOUT, Offset $09C2, Length 2

Var 0027, name FlapsPos, Link FSUIPC_INOUT, Offset $0BDC, Length 2

Var 0028, name AConGnd, Link FSUIPC_INOUT, Offset $0366, Length 2

Var 0029, name ElevTrinInd, Link FSUIPC_INOUT, Offset $0BC2, Length 2
{
CALL &ConfigWarn1
}

Var 0030, name GearLvr, Link FSUIPC_INOUT, Offset $0BE8, Length 4
{
CALL &ConfigWarn1
}

Var 0031, name eng1inRev, Link FSUIPC_INOUT, Offset $207C, Length 4
{
IF &eng1inRev = -5
{
&Eng1RevInd = 1
}
ELSE
{
&Eng1RevInd = 0
}
}

Var 0032, name ConfigWarn1, Link SUBRUTINE
{
IF &AConGnd = 1
{
IF &GearLvr = 0
{
&Warning = 1
}
}
IF &AConGnd = 1
{
IF &eng1N1 > 7000
{
IF &FlapsPos < 5500
{
&Warning = 1
}
}
ELSE
{
&Warning = 0
}
}
IF &AConGnd = 1
{
IF &eng1N1 > 7000
{
IF &ElevTrinInd < 2000
{
&Warning = 1
}
}
ELSE
{
&Warning = 0
}
}
}

Var 0033, name servo1, Link USB_SERVOS, Device 1, Output 1, PosL 1, PosC 550, PosR 1023, Type 2 // Eng2EGT gauge

Var 0034, name servo2, Link USB_SERVOS, Device 1, Output 2, PosL 1, PosC 511, PosR 1023, Type 2 // eng1EPR

Var 0035, name servo3, Link USB_SERVOS, Device 1, Output 3, PosL 250, PosC 640, PosR 940, Type 2 // Eng1 FuelFlow

Var 0036, name servo4, Link USB_SERVOS, Device 1, Output 4, PosL 1, PosC 550, PosR 1023, Type 2 // Eng3EGT Gauge

Var 0037, name servo5, Link USB_SERVOS, Device 1, Output 5, PosL 335, PosC 635, PosR 930, Type 2 // Eng2N2 Gauge

Var 0038, name servo6, Link USB_SERVOS, Device 1, Output 6, PosL 335, PosC 635, PosR 930, Type 2 // Eng2N1 gauge

Var 0039, name Eng2Egt, Link FSUIPC_INOUT, Offset $0956, Length 2
{
L0 = &Eng2Egt * 0.05249023 // 16384=860C
L1 = L0 * 0.522727
L2 = L1 + 275
&servo1 = L2
}

Var 0040, name Eng3Egt, Link FSUIPC_INOUT, Offset $09EE, Length 2
{
L0 = &Eng3Egt * 0.05249023 // 16384=860C
L1 = L0 * 0.522727
L2 = L1 + 335
&servo4 = L2
}

Var 0041, name Eng2N2, Link FSUIPC_INOUT, Offset $092E, Length 2
{
L0 = &Eng2N2 * 0.00606
L1 = L0 * 5.5
L2 = 335 + L1
&servo5 = L2
}

Var 0042, name Eng2N1, Link FSUIPC_INOUT, Offset $0930, Length 2
{
L0 = &Eng2N1 * 0.00606
L1 = L0 * 5.5
L2 = 335 + L1
&servo6 = L2
}

Var 0043, name Eng1EPR, Link FSUIPC_INOUT, Offset $0898, Length 2
{
L0 = &Eng1EPR * 0.0001355
L1 = L0 * 415.625
L2 = 1325.625 - L1
L0 = L2
IF L2 > 910
{
L0 = 910
}
&servo2 = L0
}

Var 0044, name warning, static, Link IOCP, Offset 2, Value 0
{
IF &warning = 1
{
&Warning = 1
}
}

Var 0045, name FuelFLow, Link FSUIPC_INOUT, Offset $0918, Length 8, Numbers 1, Type 1
{
L0 = &FuelFLow / 10
L1 = 0.1279069 * L0
L2 = 939.83 - L1
&servo3 = L2
}

Var 0046, name radioalt, Link FSUIPC_INOUT, Offset $31E4, Length 4 // Radio Altimeter in meters
{
L0 = &radioalt / 65536
L0 = L0 * 3.2808399
L2 = TRUNC L0
L0 = L2
&RAtemp = L2
CALL V0103
IF L0 <= 490
{
L0 = L2 * -0.98 // 455 steps/500 ft
L1 = L0 + 945
}
C0 = L0 > 500
C1 = L0 < 1000
IF C0 AND C1
{
L0 = L2 * -0.134
L1 = L0 + 560
}
C0 = L0 > 1001
C1 = L0 < 1500
IF C0 AND C1
{
L0 = L2 * -0.07
L1 = L0 + 495
}
C0 = L0 > 1502
C1 = L0 < 2600
IF C0 AND C1
{
L0 = L2 * -0.04
L1 = L0 + 445
}
IF L0 > 2605
{
&servo2 = 325
}
}

Var 0047, name DH, Link FSUIPC_INOUT, Offset $3428, Length 8, Numbers 1 // Deceision Height
{
L0 = &DH / 3.045
&DHTemp = TRUNC L0
}

Var 0100, name DHTemp

Var 0101, name RAtemp

Var 0102

Var 0103, Link SUBRUTINE // DH Alert logic
{
L0 = &DHTemp - 25
L1 = &DHTemp + 25
C0 = L0 < &RAtemp
C1 = &RAtemp < L1
IF C0 AND C1
{
&Eng3RevInd = 1
}
ELSE
{
&Eng3RevInd = 0
}
}

kiek
07-04-2010, 03:22 PM
Hi Rob,
Thanks for your example. It will show Jack how to use Var 0.

Just a tip: in your script you are using (at several places) a Var definition linked to a FSUIPC_INOUT offset. However, in your program you only use the IN part (never the OUT part). It would be better to replace all these FSUIPC_INOUT's by FSUIPC_IN's. This will better express what you are doing and it will result in a simpler execution by SIOC, costing less cpu cycles.

best regards,
Nico

Boeing 747 Flyer
07-04-2010, 03:58 PM
Okay lads, hows about this: (ServoT.ssi)


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo4 = 367
}

Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 367, PosC 637, PosR 907, Type 2 // ASI gauge

Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
IF L0 < 50
{
&Servo4 = 367
}
IF L0 > 350
{
&Servo4 = 907
}
}

And SIOC.ini:


[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=20
CONFIG_FILE=ServoT.ssi

[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No

USBSERVOS=1,77

[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=50

[IOCP CLIENTS MODULES]
IOCPini_delay=3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099

[SOUND MODULE]
Sound_disable=Yes
Volume=100

I know the SIOC.ini is wrong though.

737NUT
07-04-2010, 04:12 PM
Hi Rob,
Thanks for your example. It will show Jack how to use Var 0.

Just a tip: in your script you are using (at several places) a Var definition linked to a FSUIPC_INOUT offset. However, in your program you only use the IN part (never the OUT part). It would be better to replace all these FSUIPC_INOUT's by FSUIPC_IN's. This will better express what you are doing and it will result in a simpler execution by SIOC, costing less cpu cycles).

best regards,
Nico

Thanks! I will make the changes as cycle time will become important when i bring all my scripts together. :)

kiek
07-04-2010, 05:44 PM
Although semantically the same, this is better code:



Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
IF L0 < 50
{
&Servo4 = 367
}
ELSE
{
IF L0 > 350
{
&Servo4 = 907
}
}
}

FSUIPC_IN because you are only reading from the offset (not writing to the offset)

IF L0 < 50 there is no need to test whether it is also > 350 (because it is not) so you better use an IF ELSE statement to save cpu time


Nico

deering
07-04-2010, 10:54 PM
Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
IF L0 < 50
{
&Servo4 = 367
}
ELSE
{
IF L0 > 350
{
&Servo4 = 907
}
}
}


I don't have a servo card, so I may not be understanding this well; but, I assume that the intention is to produce a result such that: 366 < &Servo4 < 908.
The above code doesn't do that. Consider: &IAS=120; L0=80; &Servo4 = 293.

Maybe:



Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
IF &Servo4 < 367
{
&Servo4 = 367
}
ELSE
{
IF &Servo4 > 907
{
&Servo4 = 907
}
}
}

or



Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from SIm
{
&Servo4 = &IAS / 1.5
&Servo4 = LIMIT 367,907,213
}

I don't know why it's necessary to do this, though. The limits are already defined:


Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 367, PosC 637, PosR 907

SIOC ought to impose them.

Jim

kiek
07-05-2010, 03:09 AM
Hi Jim,



Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213
IF L0 < 50
{
&Servo4 = 367
}
ELSE
{
IF L0 > 350
{
&Servo4 = 907
}
}
}

I had no intention to write correct code for his application. I was only showing some SIOC constructs.
Note: Your example code (above) is not right i'm afraid, because you already write a too low value (293) to &servo4 before you test the limits in the next statement....

Nico

Boeing 747 Flyer
07-05-2010, 03:34 AM
Okay, I'll remove the limits then as they seem to be causing some questions to be raised. Hows about this (limits removed):


Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo4 = 367
}

Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 367, PosC 637, PosR 907, Type 2 // ASI gauge

Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 1.5
&Servo4 = L0 + 213


Combined with this SIOC.ini:


[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=20
CONFIG_FILE=ServoT.ssi

[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No

USBSERVOS=1,77

[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=50

[IOCP CLIENTS MODULES]
IOCPini_delay=3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099

[SOUND MODULE]
Sound_disable=Yes
Volume=100

Will it let the ASI Servo work? If there are any problems, please highlight them (even if it's just that I've put a line or a space in the wrong position).

Thank you very much,

Jack

kiek
07-05-2010, 05:19 AM
Hi Jack,
Like I wrote earlier in this thread, the FSUIPC definition for offset 0x0B2C reads:

IAS: Indicated Air Speed, as knots * 128

I do not see your algorithm taking care of that.... Should you not divide by 128 get IAS in knots first?
And why do you divide by 1.5? What's the reasoning behind that?

Nico

Boeing 747 Flyer
07-05-2010, 05:44 AM
Hi Nico,

Yes I understand dividing by 128, it makes perfect sense. Not really sure why it's /1.5 I will change it now. Anything else I need to take care of? Is the SIOC.ini okay?

Also, should I change 213 to 205 as that's my "0" value, although my phyiscal ASI only starts at 50Knots.

fordgt40
07-05-2010, 06:33 AM
Jack

The reason why it is 1.5 is that was the figure in the "sample" sioc text I gave you a while back. I also said in a previous post

" Yes, there is more code ammendment required - for example you will need to establish whether the multiplier 1.5 or indeed the + value of 213 is correct"

David

Boeing 747 Flyer
07-05-2010, 08:32 AM
Thanks David, all is corrected. Interestingly, I actually noticed that the /1.5 was wrong after looking at the SDK manual, but forgot to correct!

So, before I finally boot up FSX and test, are there any errors in the following SIOC script:


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo4 = 205
}

Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 205, PosC 468, PosR 730, Type 2 // ASI gauge

Var 9003, name IAS, Link FSUIPC_INOUT, Offset $02BC, Length 4 // IAS from SIm
{
L0 = &IAS / 128
&Servo4 = L0 + 213
IF L0 < 50
{
&Servo4 = 205
}
IF L0 > 350
{
&Servo4 = 730
}
}

And SIOC.ini:


[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=20
CONFIG_FILE=ServoT.ssi

[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No

USBSERVOS=1,77

[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=50

[IOCP CLIENTS MODULES]
IOCPini_delay=3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099

[SOUND MODULE]
Sound_disable=Yes
Volume=100

Any mistakes feel free to point 'em out!

kiek
07-05-2010, 08:38 AM
change
L0 = &IAS / 128

into
L0 = DIV &IAS 128


and why did you rolled back my IF ELSE construction ?????????????????????


I am not sure this is ok:
USBSERVOS=1,77

should it not be
USBSERVOS=0,77
?
While:
In your script I see that you are using Device 0 for your Servo (if you do not specift Device it's defaulted to 0)

deering
07-05-2010, 08:43 AM
Hi Jim,

I had no intention to write correct code for his application. I was only showing some SIOC constructs.
Note: Your example code (above) is not right i'm afraid, because you already write a too low value (293) to &servo4 before you test the limits in the next statement....

Nico
Nico, that code is not mine. My example was to illustrate why it's not right.

Thanks.
Jim

Boeing 747 Flyer
07-05-2010, 10:03 AM
Okay Nico, how's about this:


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo4 = 205
}

Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 205, PosC 468, PosR 730, Type 2 // ASI gauge

Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from Sim
{
L0 = DIV &IAS 128
&Servo4 = L0 + 205
IF L0 < 50
{
&Servo4 = 205
}
ELSE
{
IF L0 > 350
{
&Servo4 = 730
}
}
}

And SIOC.ini:


[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=20
CONFIG_FILE=ServoT.ssi

[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No

USBSERVOS=0,77

[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=50

[IOCP CLIENTS MODULES]
IOCPini_delay=3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099

[SOUND MODULE]
Sound_disable=Yes
Volume=100

Is that correct?

Also, where is the Device number "not specified"? I have specified it as Servo4 have I not?

Anything else I need to look for?

Boeing 747 Flyer
07-05-2010, 05:06 PM
FANTASTIC NEWS!!!!!!

After almost a month of questioning, failing, stressing and sweating... The ASI is finally working with FSX and FSUIPC (with SIOC)!!!!!!

Now, there is still a fair bit of SCALING work to do (sometimes it is off by 5Knots, sometimes by 50Knots), however I have managed to get it working with FSX nonetheless.

The problem was, was that I had defined "Output 1" instead of "Output 3" in my SIOC script.

THANK YOU VERY MUCH TO EVERYONE WHO HELPED!!!!!!!!!

737NUT
07-05-2010, 05:28 PM
FANTASTIC NEWS!!!!!!

After almost a month of questioning, failing, stressing and sweating... The ASI is finally working with FSX and FSUIPC (with SIOC)!!!!!!

Now, there is still a fair bit of SCALING work to do (sometimes it is off by 5Knots, sometimes by 50Knots), however I have managed to get it working with FSX nonetheless.

The problem was, was that I had defined "Output 1" instead of "Output 3" in my SIOC script.

THANK YOU VERY MUCH TO EVERYONE WHO HELPED!!!!!!!!!

Great! Is off by the same amount in the same location on the guage or does it vary?

kiek
07-05-2010, 05:51 PM
Also, where is the Device number "not specified"? I have specified it as Servo4 have I not?


Well,


Var 9000, name Servo4, Link USB_SERVOS, Output 1, PosL 205, PosC 468, PosR 730, Type 2

is the same as:


Var 9000, name Servo4, Link USB_SERVOS, Device 0, Output 1, PosL 205, PosC 468, PosR 730, Type 2

Suppose you wanted to define the Servo as Device 1, you had to write


Var 9000, name Servo4, Link USB_SERVOS, Device 1, Output 1, PosL 205, PosC 468, PosR 730, Type 2

and in sioc.ini:
USBSERVOS=1,77

Nico

Boeing 747 Flyer
07-06-2010, 12:13 PM
Hi Nico,

I did not need to specify the device, it works without that.

@737NUT: It varys but there is a small pattern. At around 50Knots it is off by 5, and at 200Knots it is displaying 150Knots.

kiek
07-06-2010, 12:25 PM
I did not need to specify the device, it works without that.
I know...!
That's what I tried to explain: if you leave out Device 0 it will assume Device 0 (being the default value).

fordgt40
07-06-2010, 12:31 PM
Jack

"It varys but there is a small pattern. At around 50Knots it is off by 5, and at 200Knots it is displaying 150Knots. "

I suggest that you use IOCPConsole, within the SIOC screen to see what is happening to the ASI and Servo values respectively. You can also use the log function to record what is happening. This will help you determine whether you need to reintroduce a scaling factor and/or vary your servo start and finish points

David

737NUT
07-06-2010, 01:18 PM
Every gauge i have built has needed a scaling factor with some needing multiple scaling factors. You need to verify that the servo goes to the same spot EVERY time you command it to. Put 555 in IOCP to command the servo to that position, then another number. It should go to the same spot each time. If not, get a better servo. Here is a link on how to do the scaling calcs the right way. Works perfect!
http://www.baron58.com/Servo_Calc.htm

Boeing 747 Flyer
07-06-2010, 01:30 PM
Every gauge i have built has needed a scaling factor with some needing multiple scaling factors. You need to verify that the servo goes to the same spot EVERY time you command it to. Put 555 in IOCP to command the servo to that position, then another number. It should go to the same spot each time. If not, get a better servo. Here is a link on how to do the scaling calcs the right way. Works perfect!
http://www.baron58.com/Servo_Calc.htm

I did, during extensive testing using the USBServos Software, notice small error margins. I accepted these, and also accepted that I would allow a leighway of 10. EG: "70Knots" = 553, sometimes "70Knots" = 560, a small error margin. It's only off by a few Knots any so not that much of a deal. Regardless, I'm happy that I've gotten it to work with SIOC and surely over time I willget it fully up to speed.

I will do further testing to see if it returns.

Also David, thanks for the advice. I will use IOCPConsole with the Log to test, but I'm not overly confident on this. Could you explain a tiny little bit more in-depth what I must do?

737NUT
07-06-2010, 02:50 PM
Really no need to log as there is not a software issue, just a mechanical or scaling issue.

fordgt40
07-06-2010, 03:06 PM
Jack

737NUT says not to bother

David

Boeing 747 Flyer
07-06-2010, 03:44 PM
Okay, well focusing on that Servo calc...

I got these values:


210 = a 50 + b

735 = a 350 + b

I used his equation exactly and substituted in my own correct values. Now... This is where it gets hard. How the heck do you get values a & b?

Also, what's strange is, is that when the Aircraft is >100Knots, the ASI gauge speed is too fast, at 116Knots it is perfect, and >116 Knots it is too slow. The gauge is linear, but it seems the Servo isn't *quite* so.

However, there's definitely progress being made!

737NUT
07-06-2010, 04:20 PM
Algebra,
Servo range is 735 - 210 = 525 Gauge range is 350-50 = 300 525/300= 1.75 A=1.75 210= 1.75x50+122 735=1.75x350+122
A=1.75
B=122

Boeing 747 Flyer
07-06-2010, 04:49 PM
Okay, it'll probably be wrong (because it's me), but I've had a go at making a new SIOC script based on that Scaling principle...

Take a look:


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo3 = 210
}

Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from Sim
{
L0 = DIV &IAS 128
L1 = L0 * 1.75 // Calculate Servo Slope
L2 = 122 - L1 // Calculate Servo Intercept

V9000 = L2
}
Var 9000, name Servo3, Link USB_SERVOS, Output 3, PosL 210, PosC 473, PosR 735, Type 2 // ASI gauge

As I said, I've probably gone wrong, so please tell me where.

737NUT
07-06-2010, 05:10 PM
Looks ok, try it and see what happens. Like i said also, you need to ck the servo and its repeatability on going to the same commanded spot every time. :)

fordgt40
07-06-2010, 05:31 PM
737NUT

I am probably having a senior moment!

With the code above at an asi of 100knots then L1 will equal 175
L2 will then equal 122 - 175 which is -53
The value of -53 is then sent to the servo

Is this correct?

Like Jack says "I've probably gone wrong"

David

737NUT
07-06-2010, 06:23 PM
Should be L2= L1 + 122 sorry, got in to big a hurry. Kids were bugging me to go swimming. LOL

Boeing 747 Flyer
07-07-2010, 01:03 PM
Oh well, that is corrected now. Still one small mistake for me is actually pretty impressive!;)

I wil lgive the Servo a clean as that might explain why it is "sticking" at some points.

Just out of interest, 737NUT, which EXACT servo do you use? Someone mentioned the Hitec HS-55 and Servocity, but what do you use?

Jack

PS: Just to confirm, with changes applied, is this now correct:

Are we sure it is L1 PLUS 122, or L1 MINUS 122?


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo3 = 210
}

Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from Sim
{
L0 = DIV &IAS 128
L1 = L0 * 1.75 // Calculate Servo Slope
L2 = L1 + 122 // Calculate Servo Intercept

V9000 = L2
}
Var 9000, name Servo3, Link USB_SERVOS, Output 3, PosL 210, PosC 473, PosR 735, Type 2 // ASI gauge

737NUT
07-07-2010, 02:04 PM
I use either Hitec or futaba digitals. I tried the cheap servo's and they would burn out in little use. Spend a little extra now and save money and heartache in the long run! :)

fordgt40
07-07-2010, 03:11 PM
Jack

Post deleted, as earlier enquiry was to 737NUT and not general

David

Boeing 747 Flyer
07-07-2010, 04:03 PM
I use either Hitec or futaba digitals. I tried the cheap servo's and they would burn out in little use. Spend a little extra now and save money and heartache in the long run! :)
Hmmm... My Etronix Servo isn't *perfectly* accurate (just did 10 Tests in a row going from min to max deflection, biggest error margin was 9 servo values, avarage was only 1 or two away from the correct value), however, it is wonderful at not burning. I have constantly thrashed it past the limits and it never fails to work!

Furthermore, I've had my SIOC script slightly (after avaraging the results out from that 10-test run), here's the final result:


// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : ASIgauge.txt
// * Date : 7/3/2010



Var 0000, Value 0, name Intialization // Set servo positions
{
&Servo3 = 197
}

Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from Sim
{
L0 = DIV &IAS 128
L1 = L0 * 1.653 // Calculate Servo Slope
L2 = L1 + 114.35 // Calculate Servo Intercept

V9000 = L2
}
Var 9000, name Servo3, Link USB_SERVOS, Output 3, PosL 197, PosC 445, PosR 693, Type 2 // ASI gauge

EDIT: And, as usual, it doesn't work. SIOC is completely messed up, after starting it turns the Servo to position "55", despite 197 being defined in the script. It also doesn't move in time with the Sim.

I managed to achieve *limited* sucess with the script. At low speeds, my real life ASI is showing way too fast. At high speeds, it is the opposite, showing speeds way to slow. Pretty much the same problem as last time, and I can't figure out why, because that script looks okay?

Boeing 747 Flyer
07-08-2010, 12:42 PM
Heya 737NUT,

Could you tell me which is your favourite Servo out of all of your Digital Dutabas and Hitecs?

I just want one that is reliable and powerful, and that will work well with USBServos Software & Card.

Thanks in advance,

Jack

kiek
07-08-2010, 03:04 PM
EDIT: And, as usual, it doesn't work. SIOC is completely messed up, after starting it turns the Servo to position "55", despite 197 being defined in the script.
Like I told you before: You may delete Var 0000 completely... It has no use. The init value of 197 will immediately be overwritten by the value of the IAS FSUIPC offset.

Tip (just syntax): write

&Servo3 = L2
or even better:

&Servo3 = L1 + 114.35

Nico

Boeing 747 Flyer
07-08-2010, 03:49 PM
Hi Nico,

I have deleted Var0000.

Still, what is the use of defining the Left, Mid and Right points of the Servo? SIOC doesn't seem to use them. For example, it thinks 0 IAS means position 0 on the servo, despite me defining 197 in this following line:


Var 9000, name Servo3, Link USB_SERVOS, Output 3, PosL 210, PosC 473, PosR 735, Type 2 // ASI gauge

kiek
07-08-2010, 04:15 PM
I know nothing about Servo's.

Note that yesterday I have add a SIOC presentation (from Opencockpits) to the SIOC page of my website (http://www.lekseecon.nl/sioc.html). I recommend to print this colourful file, take a break (or even a holiday) and study this document over and over again (from over to cover) ;-)

Have a good Summer!

Nico

Boeing 747 Flyer
07-08-2010, 05:55 PM
Thanks Nico, I will have a peek at that presentation!

Strangely, my Servo is consistently off by 15Knots. I may try offsetting the SIOC script by 15Knots to compensate for this.

737NUT
07-09-2010, 09:49 AM
Here is what i will be using from now on, it's their new design and pot life is increased tremendously!
http://www.servocity.com/html/hs-5045hb_servo.html

Until you get a good servo in there it will be impossible to code correctly! The servo must go to the same spot every time.

Boeing 747 Flyer
07-09-2010, 06:13 PM
Hello everyone,

I have some good news.

I have managed to find the fault behind the mysterious Servo problem. It was actually one of the gears that was to blame! It had come loose of the Servo arm and was waivering about trying to obey the SIOC rules. A quick re-application of the gear seems to have fixed the problem.

After further testing with FSX, the biggest error margin was about 7Knots, usually only about 3-5Knots, and other times SPOT ON. I can live with these small errors, especially because in real life ASIs do vibrate about and aren't always 100% accurate.

So, after long, long last, I can declare this project a sucess and move on to the next gauge... The VSI!

Thanks for everyone who contributed, I wish you a happy summer,

Until the VSI...

Bye! (thread can be closed!)

fordgt40
07-09-2010, 07:14 PM
Ahhhh the VSI :(

Brace Brace Brace :)

Seriously, well done!

David