View Full Version : Unable to Script x axis
Rickie Lee
16th February 2010, 02:59 AM
Hi All:
Just purchased a CH Flight Sim Yoke, trying to use the CMS programming power to get around the inability of Blazing Angels 2 to use a yoke (or stick). Here is what i started with but it will not compile, help!
Thanks
script // Y Axix Pitch-Up
IF
(js1.A2 > 128) // if yoke is pulled back past neutral
then
(cms1.a2 = kbup) // then plane will pitch up
else
if
(js1.a2 < 128) // if yoke is pushed in past neutral
then
(cms1.a2 = kbdown) // then plane will pitch down
endif
endif
endscript
the error i get is: " Error 196: JS button id expected but A2 found"
Bob Church
16th February 2010, 09:28 AM
Hi Rickie,:
>> Just purchased a CH Flight Sim Yoke, trying to use the CMS programming power to get around the inability of Blazing Angels 2 to use a yoke (or stick). Here is what i started with but it will not compile, help <<!
I think the basic problem is the way you're making the comparison statements. You need to put square brackets around them or they don't work, a little shortcomiing ot the CMS compliler. Try this and see if you fare any better....
script // Y Axix Pitch-Up
if([ js1.A2 > 128 ]) // if yoke is pulled back past neutral
then
(cms1.a2 = kbup) // then plane will pitch up
else
if([ js1.a2 < 128 ]) then // if yoke is pushed in past neutral
( cms1.a2 = kbdown ) // then plane will pitch down
endif
endif
endscript
Give that a try and see if it helps.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
16th February 2010, 04:38 PM
Bob:
Thanks you very much for the prompt reply. Just started in the past months on flight sims and have gone thru Logitech then Saitek and now with CH Products. This forum, in comparison to the MANY others I have tried is outstanding, and it appears mainly due to you Bob, thanks a million. I will try the script shortly. In the light of day, after resting, I think I maybe should of asked a more basic question. The CH Control Mgr seems very good and relatively easy for button programming, thanks in no small part to your Dummies Manual which I keep handy, but I seem to be missing how to do the Axix (s) programming in GUI? What I am trying to work around is the older type flight sims ( Blazing Angels 2, Secret Waepons Over Normandy, etc) which do not recognise X axis / y axis etc or in fact any controllers outside the keyboard or mouse. Since I can't figure out how to GUI the axis, I am trying to use programming to get around the issue, am I taking the right path? The sims I have like Microsoft Flight Simulator X, Wings of Prey etc seem to have seemlessly picked up my new CH Flight Sim Yoke, unlike the older sims. Is there a listing somewhere of flight sims that I can keep adding to my collection that are better at using Yokes? Thanks Bob. You have already made my decision easy in the future to stay with CH products!!
Bob Church
16th February 2010, 06:35 PM
Hi Rickie,
Thank you for the kind comments, they're much appreciated. I'm not exactly clear on the the problem you're trying to get around. You can program any axis is send the usual types of character commands, e.g. "+ + + + + +..." going one way and "- - - - - - ..." going the other, or "1 2 3 4 5 6 7 8 9 0" going one way and "0 9 8 7 6 5 4 3 2 1" going the other. The usual pair of character functions. If that will do what you want, it's just a matter of selecting the axis, unchecking the "DX Mode" box, and then selecting "Up/Down" (for the "+ + + + ..." type of situation or "Position" for the ""1 2 3 4 5 ..." for the other.
Will either of those do the trick? Otherwise some sort of script will undoubtedly take care of it, a little more elaborate explanation of what it needs to do would be helpful. Let me know and we can work something out. Whether it's better or worse than a yoke is kind of a matter of taste more than anything. Yokes take a lot more movement to get the full range of movement so they're a little slower to respond, at least insofar as you have to turn it further for the same response that you'd get with a stick. It really just depends on how you like it. The "Gain" block, the little box with the green curve in it can help there sometimes. Set it so that the curve is more vertical toward center, flatter at the endpoiints. It will respond more quickly that way, although over a short overall range of movement.
Edit: Just to keep things on the up-and-up, Ghost is to blame for the Dummies Guide. I wrote the incomprehensible Users Guide that you access by clicking the little yellow book. :)
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
531_Ghost
16th February 2010, 07:16 PM
Oh sure Bob, throw me under the bus :) What you've stated in the first paragraph of your reply Bob, works. This is the same way I've programmed my TQ axes for prop pitch and mixture for IL2 1946. Un-check DX. Check Up/Down. Now, you've got to remember how many "steps" (key presses in the game) typically 11. In the Inc Key type the charecter to increase and in the Dec Key, type the charecter to decrease.
One thing to remember, if those keys have a modifier, you'll have to type the modifier in the Inc or Dec Key boxes too. For instance if Increase_Pitch is CTL = then in the Inc Key box you'd type CTL =
Clear as mud, Rickie?
Rickie Lee
17th February 2010, 04:29 AM
You guys amaze me with your quick and helpful reponses. The specific problem I'm having is trying to use the sim "Blazing Angels 2". I cannot get the game to work with either a stick or a yoke. The sim has an onboard mapper that works great for keystrokes but for sticks or yokes (X and Y axis) it only works with a certain upgrade from ubisoft which is not available to Steam Clients (me for one). So what I am tryingto do is fake it out with CMS. The game is looking for the keyboard arrow keys to direct pitch and turns, rudder is by A and D. I get all I need thru CH controller BUT not the x and y (which makes the game unplayable, at least by me. Can't fly with my fingers or by mouse.) Am having the same type problem with Secret Weapons Over Normandy also, it is looking for ther old style w and s for pitch and a and d for roll. Can't get stick or yoke in x and y again. Any suggestions guys??
531_Ghost
17th February 2010, 03:44 PM
Well, you could:
// CMS Script File
//
// Game Title:
// Written By:
// Date:
//
script
cms.b1 = [js1.a2 < 50]; // w
cms.b2 = [js1.a2 > 150]; // s
cms.b3 = [js1.a1 < 50]; // a
cms.b4 = [js1.a1 > 150]; // d
endScript
Increase the dead zone to around 10. Your values may vary.
Bob Church
18th February 2010, 12:16 AM
Hi Rickie,
I'm not sure what you mean by the "old-style" wasd keys. I don't think they've ever really changed. The USB boards start with different "raw" values, but the system maps them into the same character set that's always been used as far as I know. You don't want to use upper-case unless the sim specifically rquests it. Usually, even if the key chart lists it as "A", it really want "a" and the Control Manager can tell the difference. It will bracket the "a" with a shift press before and a shift release after tje cjaracter jas been sent.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
531_Ghost
18th February 2010, 12:50 AM
... after tje cjaracter jas been sent.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
:eek:
Bob Church
18th February 2010, 12:58 AM
Hi Ghost,
Sorry 'bout that....
BTW, I have to change my email address. I sent two notificatiions to you, but the "home" one bounced. If you want to email it to me:
stickworks(at)verizon(dot)net
I'll add it to the address book. The last one I seem to have is from something.rr.com and it bounces straightaway.
Thanks!
- Bob
The StickWorks
http://www.stickworks.com
531_Ghost
18th February 2010, 01:23 AM
I was just thinkin' you may have been in South Centeral a wee bit to long, or, perhaps the border has moved north! E-mail sent. I got the one at work, thanks.
Rickie Lee
21st February 2010, 01:03 AM
HELP !!!!!!!!!!!!! no axis control still in x or y. The game is Blazing Angels 2 by Demonware, I purchased thru Steam. Ch Control Mgr does work wonderfully for ALL buttons, but doesn't work for ANY axis x, y, or throttle. The plane flies great using the game defaults of
Pitch up = (up arrow) which works great on the keyboard
so I tried 1. KBUP on y axis INC, then I tried GHOST's script, then I tried Bob's script help = no go, my Flight sim yoke has NO impact on the plane:
Pitch Down = (down arrow) tried KBDOWN and scripts etc, no impact on plane,
Turn left = (left arrow) tried KBLEFT and scripts etc, no impact
Turn right = (right arrow) tried KBRIGHT etc no impact
Roll right = (d) same story
Roll left = (a) same story.
Just for chagrines I used my two yoke toggles in CH Control Mgr and the plane works great ( buttons 11 and 12 for pitch, buttons 3 and 4 for turn) but just like using the keyboard arrows etc I can't control the plane well enuf to fight.
My refresh rate in windows is high, my system is high (Intel Dual Core T9800 2.93 Ghz, 6 mb cache, 1066 Mhz FSB, Nvidia GTX 260 graphics card with 4 GB DDr3 memory at 1333 MHz) I am using the newest version of CH Control Mgr, 4.51, Windows 7
I am honestly studying very hard your help documentation, your CM guide, all the forum posts I can find BUT I CANNOT get the axis (s) to work...
PLEASE help this poor dumb child before I dedeemow (sp?) to the big A1 Skyraider in the sky !!
531_Ghost
21st February 2010, 01:10 AM
Did you try the script I posted and assign the cms buttons accordingly?
Rickie Lee
21st February 2010, 01:55 AM
Ghost:
Good evening and thanks for the reply, I pasted the script and compiled. But in all honesty am still unsure of the assigning buttons to match the scripting. ??
531_Ghost
21st February 2010, 04:24 AM
Go to CMS Controls and assign accordingly...
1492
531_Ghost
21st February 2010, 04:34 AM
And I know you're talkin' 'bout a Yoke. However X and Y axes are X and Y axes. Although, I could hook up my Eclipse and do the same thing ;)
Rickie Lee
21st February 2010, 11:32 PM
Hi Ghost:
Thanks for helping.
So in CMS controls I map an axis as a button ( as in your reply above) instead of an axis?
Do I understand correctly then that for any axis (s) or button (s) that I program in the script file I must change the CMS button / axis assignment BUT for all axis and buttons that are not covered in the script file I just need assign in the GUI screen and not the CMS screen?
Also, your script in the comments section has w, s, a, d. The game is calling for left arrow, right arrow, up arrow and down arrow. Does that make a difference for the script needed or just comments changing needed?
Thanks Ghost
531_Ghost
22nd February 2010, 01:43 PM
No, not the axis button, the CMS button the bigger set of CMS (128) buttons not the smaller set, (64) axis buttons. Well then, on the CMS buttons you'd assign them to: w = KBUP s = KBDOWNN a = KBLEFT d = KBRIGHT That script presses the CMS button when the axis reaches that point in the axis. It will releasr that button when the axis is no longer in that range. You'll want to increase the dead zone on both the X and Y axis so when you download the map you won't be pressing those buttons inadvertantly. Otherwise you'll get some strange behavior goin' on. It's all in the Dummies Guide and Help File.
Rickie Lee
23rd February 2010, 09:22 PM
Thanks Ghost, am trying now.
Rickie Lee
25th February 2010, 02:19 AM
Progress !!
I finally have plane movement with my yoke (using your script Ghost )
cms.b1 = [js1.a2 < 50]; // w
cms.b2 = [js1.a2 > 150]; // s
cms.b3 = [js1.a1 < 50]; // a
cms.b4 = [js1.a1 > 150]; // d
The only remaining issue is that the y axis, (no matter what I do in the gain section of CH Control Mgr) has very little pitch up or down for the first 1/2 of yoke travel (at least) then I get massive movement unexpectedly
towards the end of the yoke travel (again no matter what gain settings I use in GUI. I'm guessing it could be added to the script to gain better control but unsure what to try. Any suggestions?
I've tried modifying the 50 and 150 numbers and tried changing gain and sensitivity numbers but doesn't seem to effect the issue?
Bob Church
25th February 2010, 02:31 AM
Hi Rickie,
That would be normal. You've set it up so that the yoke is just four buttons. It's centered, when the raw data value crosses 50 or 150, depending on the the direction, it sends the characters. It is possible to give it a bit of analog control. If you set up the CMS script so that the axis values from the ailerons or elevators control a timer, then the WASD will send repeating characters and the rate will be controlled by the yoke position. It's not as good as real analog, you can get maybe 5 or 10 rates out of it, but it would give you a bit more control over how fast you pitched/rolled. If you're interested, I can show you how to set the script up.
OTOH, maybe your just tired of fussing with it and would rather just leave it alone. :)
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
25th February 2010, 03:05 AM
Thanks Bob:
Never tired when I have help!
Yes, please show me the way!
bump?
Rickie Lee
26th February 2010, 10:44 PM
Bob:
I would like your help Bob with a script to set up the analog like action in the x and y axis.
Thanks Bob
Bob Church
27th February 2010, 10:18 AM
Hi Rickie,
Sorry to be so long in replying. I wrote the basic script a couple of years back, it took awhile to get it all together and modified for what you need to do, and things have been a little busy. Anyway, here you go...
After you calibrate the X/Y on the yoke, the center value is 128, the minumum value is 0, and the maximum value is 255 (more or less a count or two perhaps). Anyway, the little script:
script
cms.b1 = [js1.a2 < 50]; // w
cms.b2 = [js1.a2 > 150]; // s
cms.b3 = [js1.a1 < 50]; // a
cms.b4 = [js1.a1 > 150]; // d
endScript
essentially turns the joystick into a 4-way hat switch. JS1.A1 is the yoke aileron axis, JS1.A2 is the yoke elevator axis. The script watches those two axes and so long as they're producing values between 50 and 150 it does nothing at all. If the X axis goes below 50, it will logically "press" Button 3 on the CMS Controls page (CMS.B3). If it goes above 150, then it presses Button 4 on the CMS Controls page. The JPG and things that Ghost posted showed how you assign the the characters to those. The Y axis works the same way, but puts the output on Button 1 and Button 2 on the CMS Controls page (cms.b1 and cms.b2).
The button is held down so long as the value is there and the way Ghost shows it programmed they'll autorepeat so long as the "button" is down. The "massive movement" you mention is happening because the axis has moved across one of those trigger points ( 50 to 150 ) and is just holding the wasd key down. The key (button) itself only reports when it's pressed and when it's released, and the sim will check it once per frame, e.g. at the sims current frame rate. You're effectively "tapping" the up or down, left or right keys at the current sime frame rate so long as the button is held down.
It creates a situation where the actual key count doesn't really come into play. It's a matter of the ON time verses the OFF time and that's measured in by the frame count rather than in time units. The sim sees the button get pressed when it goes down, the button stays down through subsequent frames getting incremented or decremented once per frame, and things move very quickly. At 100 FPS, it will run through the entire axis range, full up to full down in 2.5 seconds or so and so the "massive movement".
The frame rate can't be controlled by the CM, and it wanders around anyway, so that timing is not at all constant. Anybody that's flown with a frame rate counter running knows the rate can go from 100 or more looking at blue sky to 10 or 20 looking at ground clutter or a 20-plane dogfight. The only control we can use is to turn press and release the button with the ON and OFF times based somehow on the controller position. In the end, the best values will ultimately need to be found by trial and error, but controlling the time itself is fairly easy.
What needs to happen is that, once you cross the "deadzone" limit (the 50 and 150 values in your current script), it needs to be set up so the timer starts generating brief ON pulses that can generally be of a fixed time, separated by an OFF time that's controlled by the axis value, and that needs to be measured relative to the edge of the deadzone. IOW, with a deadzone of 16 either way, your trigger values end up being 112 and 144 (128 +/- 16) and the rate needs to be determined by the difference between the lowTriggerValue (it ends up controlling that, too) and 0, since it will always produce a minimum of 0. It's a matter of sensing where the axis is, scaling it somehow it needs to be scaled down to some much smaller value than the 255. Then it needs to have 1 added to that since it goes to 0 and that just sticks the key down, essentially what you've got now.
The script to do that looks something like this (actually, exactly like this, but you'll need to tweak the values to match the sim and your system):
script
// First set up some constants for the timers so it's not
// necessary to rewrite the whole script each time.
//
%define xOnTime 1
%define xOffTime 10
%define yOnTime 1
%define yOffTime 10
%define loTriggerValue 112
%define hiTriggerValue 144
// Now set up 4 timers that generate pulses based on the
// stick position. Each one sets a constant ON time and an
// OFF time that depends on the stick position. That's used
// that to time the "tapping" of the buttons that drive the
// wasd keys (cms.b1..cms.b4).
//
timer( INTERVAL, d1, yOnTime, ((( loTriggerValue - ( loTriggerValue - js1.a2 )) / yOffTime )) + 1 ) = [ js1.a2 < loTriggerValue ];
cms.b1 = d1; // send the w on cms.b1 (lo side -> forward)
timer( INTERVAL, d2, yOnTime, ((( loTriggerValue - ( js1.a2 - hiTriggerValue )) / yOffTime )) + 1 ) = [ js1.a2 > hiTriggerValue ];
cms.b2 = d2; // send the s on cms.b2 (hi side -> back)
timer( INTERVAL, d3, xOnTime, ((( loTriggerValue - ( loTriggerValue - js1.a1 )) / xOffTime )) + 1 ) = [ js1.a1 < loTriggerValue ];
cms.b3 = d3; // send the a on cms.b3 (lo side -> left)
timer( INTERVAL, d4, xOnTime, ((( loTriggerValue - ( js1.a1 - hiTriggerValue )) / xOffTime )) + 1 ) = [ js1.a1 > hiTriggerValue ];
cms.b4 = d4; // send the d on cms.b4 (hi side -> right)
endScript
You'd need to merge that with any other scripting you're using, except for the current cms.b1 through cms.b4 logic that Ghost showed. The last 8 lines (timers and cms buttons) can just replace the current cms.b1..b4 code of Ghosts script, the %define statements should go at the top right after the "script" statement. It should end up putting the characters in the same place they go now, so you shouldn't need to make any reassignments, just changing the CMS file (in the same folder and with the same name as the map file itself, e.g. MyMap.map and MyMap.cms. If you open MyMap.map, it will pick up MyMap.cms automatically just as if you'd entered it through the editor. I'd create a new map, add your controllers and the CMS Controls, then save it under whatever name you want to use. You can import a file in the CM editor or you can just cut and paste the script from this post with it or NotePad, whatever you use.
At the very top of the file is a set of %define statements. Those let you just change the value at the %define rather than digging through the whole script each time while you're getting things lined up.
%define xOnTime 1
%define xOffTime 10
%define yOnTime 1
%define yOffTime 10
%define loTriggerValue 112
%define hiTriggerValue 144
The "xOnTime" sets the ON time for the x axis and can normally be left set to "1" but you might want to go to two or three, but things will slow down pretty rapidly and so long as 1 will cover one full frame at the lowest frame rate, all should be okay. The key will get seen being pressed and then released, it won't "stick". The "1" is 1 character time, usually 50 milliseconds, and is set on the Program Settings tab. All the timers use that for counting since it's also the rate at which the CMS sends characters and so should be at least 1 frame time at the slowest frame time you encounter. If it's not, a press or a release can be missed and the key will be missed or will stick until you hit it again.
"xOffTime" is really just a constant that's used to generate a value proportional to the difference between the trigger value and the current actual value of the yoke axis. It sets the OFF time by picking up the difference and dividing it by the xOffTime constant. With the stick centered, nothing will be sent, it returns a high value equal to loTriggerValue and a low value of 0. The high value is produced at the trigger point, so it effectively inserts additional delays between the xOnTime pulses that are high (and so generate a lot of OFF time) at the edge of the trigger values and a 0 for OFF time when the axis is at its endpoints. A 1 is added at the end of the calculations, so you would normally end up with 1 ON, 1 OFF, 1 ON, 1 OFF.... or about half speed. Since you've got lots more speed than you want, that's probably a help but it can go to full on with a little additional logic.
"yOnTime" and "yOffTime" set the same values for the Y axis.
"loTriggerValue" and "hiTriggerValue" set the limits of the center zone where the stick generates no characters at all. It's the 50 and 150 in your current script. I've narrowed it to cover 112 to 144 (128 +/-16), but it starts slowly so you shouldn't see any "massive response" when you cross the trigger value. It will start with the longest time between the pulses, gradually drop until the ON time and OFF time are both 1.
Anyway, it worked here with the values shown, but that was on a PIII with the framerate of my text editor running under Windows 98. All the %define values have to be experimentally determined to match the sim and your system. The values I used are an ON time of 1 and an OFF time that varies from 1 to 12 or so, giving a range of about 8% ON to about 50% ON as you move from center to endpoint. There's no way to really predict what you'll need, I've found that going past 5 or 10 is usually too slow, but again, it just depends on your sim and system. You should be able to make the necessary adjustments using just the %define statements, the rest of the script will adjust to them.
So, nothing to do now but swap the script and fiddle with the %defines. See how it goes. It may help, it may not, but it's about the only way to handle the situation. Let me know how it goes!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
531_Ghost
27th February 2010, 05:40 PM
WOAH! Now there's a way to skin a cat! Thanks Bob!
Bob Church
27th February 2010, 09:34 PM
Hi Ghost,
You're welcome! It may or may not work for you, but with the machines beingl much faster to handle the processing, the higher frame rates it generates, and the multicores generally having some excess power available to smooth things out in the kernel, it may be becoming more useable. Anyway, it's worth a try, you can always go back to the switch.
Did you try it out?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
531_Ghost
27th February 2010, 11:00 PM
Assigned it to my mini-joystick for Lock-On Bob. Smoooooooothe as buttah!
Bob Church
27th February 2010, 11:52 PM
Hi Ghost,
Awright! :) I don't have anything really fast enough to try it with so it was a little theoretical, I'm glad to hear it runs okay with the better hardware! It ends up generating a crude form of pulse-width modulation, maybe I should look at add a PWM function that took the calculation out of it and responded to the axis directly. It would give finer control that way and not require all that calculating in the script.
Anyway, thanks for letting me know! I was hoping you had and it's good to hear it works!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
28th February 2010, 01:30 AM
Bob:
Thanks very very much, am going to play with it now. I really appreciate the obvious thoughtful help you've provided. Thanks also Ghost, you both make this forum the most responsive I've ever found.
To be honest, of all the flight sims I have, this sim, which doesn't seem to support controllers (Blazing Angels 2), is the one I've wanted most to work due to fantastic graphics and great story line. I have
switched from Logitech to Saitek to now CH in hopes of being able to fly it, now I am so relieved to know there is a way. I wil get back and update all on my progress..
Thanks again !!
Rickie Lee
Vietnam A1 Skyraider "Sandy" , downed pilot Search and Rescue for 3 years, 1971 thru 1974, after being shot down the 4th time they forced me to leave,
if you have ever seen the movie "Flight of the Intruder", at the end when the A1 Skyraiders flew in to provide close air support , that was my life...
Rickie Lee
28th February 2010, 04:12 AM
Bob:
Right out of the box your script completely eliminated ANY nonlinear or unexpected movement. The controls are slow with not enuf total travel in either x or y.
So as I think I understand you notes, I've been playing with the define values. Changing the OffTime values doesn't seem to make alot of difference, but when I change the
OnTime Values WOW. So far, I have pretty decent control at 3 for OnTime and 12 for OffTime. It sounded like the type of system makes a significant difference in how these
values are used, for whatever it is worth my system (Alienware M17x, Dual Core T9800 2.93 Ghz with a Nvidia Gtx 260 graphics cards running at 1333 Mhz with
4GB dual channel DDR3 memory. It looks like I will be able to get where I need to be with your help, it is REALLY and TRULY appreciated.
One question I still don't understand, why is it that the keyboard controls cause a smooth and wide range of plane attitude movement(s) but
stick or yoke cause much less smoothness and seemingly less total movement??
Thank again and will keep u posted!!
Added next day:
Am having "after game" problems with this script. When I end the sim my computer goes nuts. Cursor flying around, can't control anything. I read
all the info here I could find and tried everything I read, offmap, direct map, etc, even rebooted. Still the jumping cursor. The only thing that stopped it was
commenting out the cms script and recompiling. Any suggestions?
Thanks
Bob Church
1st March 2010, 04:19 AM
Hi Rickie,
>> Thanks very very much, am going to play with it now. I really appreciate the obvious thoughtful help you've provided. Thanks also Ghost, you both make this forum the most responsive I've ever found. <<
You're certainly welcome, Rickie! A lot of people have contributed to making this place what it is, but I certainly agree with you about the forum being about as responsive (and generally civil) as any I've been involved with and I've been on a lot of them in the 20 years or so that I've been online. I'm glad you're enjoying the place!
>> To be honest, of all the flight sims I have, this sim, which doesn't seem to support controllers (Blazing Angels 2), is the one I've wanted most to work due to fantastic graphics and great story line. I have switched from Logitech to Saitek to now CH in hopes of being able to fly it, now I am so relieved to know there is a way. I will get back and update all on my progress.. <<
It is odd that it doesn't support the stick. Games, especially flight sims, you'd think would support the sticks these days. By chance, does it carry the "Games for Windows" logo?
>> Right out of the box your script completely eliminated ANY nonlinear or unexpected movement. The controls are slow with not enuf total travel in either x or y.
Great! Thank you for letting me know. It brings some new insight into what's going on, some more questions too, so I'm going to ramble on again. Sorry about that.... :)
First, the lack of 100% movement is unexpected. The character rate might jitter a bit, but the characters keep coming and you'd expect it to go to 100% eventually. It leads me to ask whether the control deflection decays back to center when you tap the keyboard key one time and let it set for awhile, or does the deflection need to be manually corrected to get back to the neutral position with a press for the opposite direction?
>> So as I think I understand you notes, I've been playing with the define values. Changing the OffTime values doesn't seem to make alot of difference, but when I change the OnTime Values WOW. So far, I have pretty decent control at 3 for OnTime and 12 for OffTime. It sounded like the type of system makes a significant difference in how these values are used, for whatever it is worth my system (Alienware M17x, Dual Core T9800 2.93 Ghz with a Nvidia Gtx 260 graphics cards running at 1333 Mhz with 4GB dual channel DDR3 memory. It looks like I will be able to get where I need to be with your help, it is REALLY and TRULY appreciated. <<
I think you mentioned that earlier, it was one of the reasons I thought it might be workable on your system if you wanted to play with it a little. It also may actually be where sort of where your problems begin in this case, though. Too much gun. :)
When I talked to Ghost yesterday, I mentioned that the script create a crude form of pulse-width modulation. Simply stated, it tries to turn the button on for a percentage of a fixed cycle time, OFF for the remainder. The script doesn't really shoot for a percentage, it's just sort of slices the range up into a number of zones that determine the ON time.
It's crude in a couple of ways. Most obviously, it doesn't really have much resolution, it's going to jump around 8% on each step. The only way to get even 1% resolution into it would be to increase the overall cycle time to 100 or more, but that takes way too long. Fortunately, resolution isn't particularly important used it's used for an X/Y controller like that.
The second bit that's not really great is the way it varies the duty cycle. If you've got it all the way out to the stop, you're seeing 1 ON cycle and 1 OFF cycle and the overall cycle time is only 2, giving you a 50% duty cycle but the overall cycle time is very short. At the slower speeds near center, the duty cycle is decreased by increasing the time beween ON times, the overall cycle time gets much longer as a result.
Which brings us back to a question I asked earlier. If you add 1 click of UP with the keyboard and let it sit, does it fall back to center on it's own or does the control hold the offset?
From your description, I'm guessing that it does decay, that the lag provides a little better control when you use the keyboard, more a filtering effect than anything, and if it does decay I'd also venture a guess that the same sort of delayed response is active when you increase the value. This is where the "too much gun" part comes into play. You don't mention, probably can't really tell in any case, what the framerate is, but judging from the specifications I'd guess it's ticking through frames so rapidly that the filtering delay is ineffective. Any manual keystroke generates a pulse wide enough for the sim to count out the delay and hit the maximum value, and the keyboard won't drop the key if you hold it down like the script does, so you end up with 100% duty cycle and full deflection on any single press. The first press on the real keyboard is usually longer to keep it from beginning to autorepeat too quickly so it's a longer-than-normal ON time too.
That would explain most of what you're seeing with the controls, I think. The filtering stops it from generating purely ON and purely OFF pulses. A single click from the script is shorter, and the original script could only hit a 50% duty cycle anyway, so it would rise to about half value and then sawtooth up and down across that value. When you increase the ON time to 3, that must give it enough time for the delay to run out and so the control surface moves further. It's still going to sawtooth, but at 3 ON and 12 OFF you've got about a 75% duty cycle. Closer to 100%, but still not fully ON, which would explain why it can't give you full range. The keyboard can do 100%, the script can't. More resolution would help, if we could get it out to 1%, it would hit 99% after the filtering, but the existing script would take about 5 seconds to process that and again, it's just too slow.
I'm going to revisit the thing a little because I think it might be possible to improve it. I think I can get a finer clock, maybe 10 milliseconds, if I set it up right. With the finer clock, the maximum duty cycle possible will go up, and perhaps I can arrange it to actually vary the duty cycle without needing to change overall cycle time, which should help smooth things out a bit too since it shouldn't get erratic with the stabler cycle time. Do let me know about that if you can determine it.
>> One question I still don't understand, why is it that the keyboard controls cause a smooth and wide range of plane attitude movement(s) but
stick or yoke cause much less smoothness and seemingly less total movement?? <<
I think it's pretty much due to the way the script is doing it and the fact that the real keyboard gets some priority in handling the characters it sends and that the single-key time is bit longer and it's width stabler than the script will generate, but also whatever you're watching the the characters runs on it's own clock, just as the CM and the sim do, and things are happening pretty rapidly. The sim may not necessarily generate the same number of frames each time since the clocks aren't really synchronized. I think you've got more than enough machine to handle it if we can get the duty cycle to move more smoothly and over a wider range.
>> Am having "after game" problems with this script. When I end the sim my computer goes nuts. Cursor flying around, can't control anything. I read all the info here I could find and tried everything I read, offmap, direct map, etc, even rebooted. Still the jumping cursor. The only thing that stopped it was commenting out the cms script and recompiling. Any suggestions? <<
If it's just "after game", then it's most likely a stuck key. I've never seen a stuck key ride through a restart, so I'm assuming you restarted then loaded the map and ran the sim before you saw the problem, it wasn't just coming out of startup.
Looking back at the script, I can see how it might happen with the increased ON time, it will take some testing here. You should be able to clear it by typing "wasd" on the real keyboard. If it's hitting icons based on the first character, that character alone should stop it. If typing "wasd" does clear it, it's essentially proof positive that the key is stuck. I'll need to look and see how to work around it. Let me know if that works.
Anyway, a little debugging and a little refining to do yet I guess. In the meantime, it's good to know that it is basically functioning. Thanks again for letting me know!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
1st March 2010, 05:14 AM
Bob:
Terrific reply on your part here. I will try to do it justice in answering your questions:
1. No Windows Logo, it seems it is a pi--ing contest between Steam (my provider) and Ubisoft (the games author). The steam version doesn't support controllers,
the Ubisoft version has a patch that fixes that but Steam clients cannot get the patch.
2.As far as the keyboard deflection issue, the planes attitude uses the arrow buttons, weather you press the arrow once the plane moves "one time worth" nd then continues
on forever where you now have it aimed. If you press and hold the little bugger will spin on a dime and continue smoothly doing the spin as long as you hold the arrow down,
the keyboard controls seem to always hold the deflection and do not wander back.
3. The jumping bug occurred after reboot Before I restarted CH controller, but isn't doing it right now, really strange.
Bob; I really really appreciate the time you are spending with me. You hve been the deciding factor in my stopping switching from Logitech to Saitek to etc, you can bet I
will be trading in my Cyborg-x (only 2 weeks old), my Logitech Stick (only 3 weeks old) and stay with my CH Yoke aand will add here shortly the CH Button thingie and rudder pedals.
Bob Church
1st March 2010, 08:21 AM
Hi Rickie,
>> Terrific reply on your part here. I will try to do it justice in answering your questions: <<
>> 1. No Windows Logo, it seems it is a pi--ing contest between Steam (my provider) and Ubisoft (the games author). The steam version doesn't support controllers, the Ubisoft version has a patch that fixes that but Steam clients cannot get the patch. <<
It seems odd that Ubisoft would be against the controller support. Probably they're looking for an advantage over Steam in providing the online stuff.
>> 2.As far as the keyboard deflection issue, the planes attitude uses the arrow buttons, weather you press the arrow once the plane moves "one time worth" and then continues on forever where you now have it aimed. If you press and hold the little bugger will spin on a dime and continue smoothly doing the spin as long as you hold the arrow down, the keyboard controls seem to always hold the deflection and do not wander back. <<
Okay. After thinking about it some more, if they've made any attempt at modelling the mass and inertia of the aircraft in an anywhere near-realistic fashion, it's probably going to respond with the same "averaging" tendency anyway. It just wouldn't decay automatically. I think probably the only way to get it to to respond fully will be to get the duty cycle out near 100% in that case. There's a more finely-grained timer available that I can set up to give more resolution. It's a little more difficult to do, the timers will have to be changed to short sequences, but I think they might also provide a hook that can be used to force the keys to unstick if that's what's happening to you.
>> 3. The jumping bug occurred after reboot Before I restarted CH controller, but isn't doing it right now, really strange. <<
It really is. A Windows restart reloads the drivers but they don't actually run the script code at all until you start the map and they start with the key buffer empty. If you have CMStart running at startup so it comes up running, that might cause it. I think I'll let it pass for the moment and see where we are after the rework. The problem may be easier to deal with or disappear completely with the new coding.
>> I really really appreciate the time you are spending with me. You hve been the deciding factor in my stopping switching from Logitech to Saitek to etc, you can bet I will be trading in my Cyborg-x (only 2 weeks old), my Logitech Stick (only 3 weeks old) and stay with my CH Yoke aand will add here shortly the CH Button thingie and rudder pedals. <<
Again, you're really more than welcome, Rickie. Thank you for helping test the technique! Reading about the capabilities that are out there these days, it's seemed for awhile like it should really be workable with enough computer under it, so it's a useful excercise for me too. Like Ghost said, another way to skin a cat. :) If RL doesn't get in the way too much, I think we can get something workable up and running pretty quickly.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
1st March 2010, 07:17 PM
Thanks Bob:
Looking fwd to more !!
531_Ghost
2nd March 2010, 02:34 PM
:::::<<<<<>>>>>??????? <-- Written with my mini-joystick, Buttah! ;)
Rickie Lee
5th March 2010, 06:29 AM
Bumpnig (patiently)
Rickie Lee
8th March 2010, 07:35 PM
Bob:
Any info I can provide for you on our project?
Bob Church
8th March 2010, 10:48 PM
Hi Rickie,
Somehow I suspected you were still interested. :) Sorry it's taken so long to reply, I couldn't get to it until this weekend. It's together and starting to work, the characters do seem to run more smoothly and it goes to 100%, but the logic isn't quite right yet and I need to fiddle with the settings and get a feel for how they interract. Maybe this week sometime depending on what else turns up.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
17th March 2010, 01:58 AM
BoB:
Any update on the new script ??
Rickie Lee
25th March 2010, 11:30 PM
Bob:
Should I give up on Ch Yoke for my game??
Rickie Lee
29th March 2010, 12:59 AM
Bob:
I sincerely hope I have not offended you. If I did it was not intended. I have not heard from you on the x y axis thing in weeks,
if the project you volunterred to help me with is too much that is OK,
but your lack of response is confusing me.
531_Ghost
30th March 2010, 03:47 PM
Rickie Lee, I don't think you've offended anybody, including Bob. He may be out of the "office". Trust me, if ANYBODY can help you, he's the guy that can.
Rickie Lee
30th March 2010, 11:18 PM
Ghost:
Thanks for the response. I too think alot of Bob's expertise!!
Rickie Lee
18th April 2010, 01:20 AM
Bob:
Any news on the script you were working on?
Bob Church
18th April 2010, 02:11 AM
Hi Rickie,
No, I've been kind of out of touch. I'll get to it again and see what I can do.
Sorry for the delays, life has just been a little complicated lately.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Rickie Lee
18th April 2010, 11:09 PM
Bob:
Thanks, hope all is well or will be well for you !!
Bob Church
19th April 2010, 03:02 AM
Hi Rickie,
Thanks! I hope so too. :)
Best regards,
- Bob
The StickWorks.com
http://www.stickworks.com
Rickie Lee
7th May 2010, 11:26 PM
CANCEL THIS THREAD
Due to how much time and effort I was evidently inappropriately asking for I REBOUGHT the game Blazing Angels twice direct from Ubisoft instead of Steam.
Now I can program all my CH stuff in game
Powered by vBulletin® Version 4.1.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.