PDA

View Full Version : Info on how USB works



Gunns
20th June 2004, 05:46 PM
Ok, <G>
Hopefully this is the right place,

I have compleated my simpit,

http://www.onpoi.net/ah/pics/users/thumbs/248_1082915486_2-8.jpg (http://www.onpoi.net/ah/picpopup.php?ImgId=5578)


http://www.onpoi.net/ah/pics/users/thumbs/248_1082915994_2-15.jpg (http://www.onpoi.net/ah/picpopup.php?ImgId=5580)

http://www.onpoi.net/ah/pics/users/thumbs/248_1082870884_2-1.jpg (http://www.onpoi.net/ah/picpopup.php?ImgId=5546)

Note, these are Ver 1.0 of the simpit <G>, I am up to Ver 1.5 <nose art, head and edge padding, adjustable seat, rebuilt seat pedastle, controller mounting brackets, and Bier Stine mount.> Ver 1.7 will include bier keg mounting, <I home brew> co2 cyl, and tap installation

Now I want to make it move <G>, not move a lot but just enough to give a physical sensation, I figure that my brain will do the rest. <much like the sensations generated when instrument flying under a hood>
Mechanically, the simpit will sit on a platform that will pitch, roll, yaw, and move forward and back <mabey even up and down a bit> aprox 10 to 15 inches in each direction. Actuators will be either Pnuematic or electrical solonoids depending on cost and capacity. Control of the actuators will be via using a "Phidgit" interface board that gives 8 digital inputs, outputs, and 8 analog inputs. The interface board connects to the computer via USB connection and is programable.

The question is how do I get the inputs to the controler board? Idealy the program <AHII> woud have control breakouts <like force feed back> but I cant realisticly expect massive re programing for 1 user. Therefor I want to piggyback off of the commands sent out by the JS <pitch and roll>, Throttle <forward and back>, and Pedals <yaw>. And altho I have My A+ and Net+ training, the training came before USB was incorpated in tio the exam.

Soooo.... if I have a TSR program running in the background controlling the "Phidgit" Board will it also recive inputs accross the USB "buss"? And what do I need to do to capture the inputs for use.


Lastly if any one is intrested I can put up the drawings that I have done during the devlopment of the movment platform <warning rough and un cultured MS Paint drawings> <G>.


Gunns

Bob Church
22nd June 2004, 04:29 AM
I&#39;m not sure, but I don&#39;t think getting at the USB directly is really what you want to do. I&#39;ve not tried this, all caveats apply, but I&#39;d think you can probably just use DirectInput calls to collect the data. To actually get the USB data you&#39;d need custom drivers, DInput would give you an API you can use without needing to delve into the kernel.

The only problem I can see offhand is that AH might have exclusive access to the stick it&#39;s using. I&#39;m not sure, I don&#39;t deal with DirectInput at the API level much. I think that you can get the data anyway but you have to keep reacquiring the stick and I doubt that&#39;s going to be helpful.

If that turns out to be the case, I&#39;d try building a mirror device in CMS. Just a dummy Control Manager Device that contains copies of the same axes that AH is seeing from the stick. Just copy them to CMS axes:

CMS.A1 = JS1.A1;
CMS.A2 = JS1.A2;

etc. Then up in the GUI, assign the CMS axes to Control Manager Device 2 or whatever the first free CM device is. In the above, JS1.A1 and A2 would end up, for example, on Control Manager Device 1, while CMS.A1 and A2 would end up on Control Manager Device 2, but would generate the same values. That would let AH keep exclusive access to CM Device 1 and your &#39;pit control could get the data from CM Device 2. It might also be helpful in that you could adjust the response and things for the &#39;pit independently of those for the stick. If, for example, you only needed 20% of full scale to the &#39;pit controllers to get the motion you wanted for 100% stick travel, you could scale the mirrored stick values down for the pit but leave the AH values intact so you didn&#39;t lose control response. It might also let you generate signals that resulted in more realistic motion by working the data for the pit over a bit. Pedals, for example, induce a bit of roll. It would be an easy thing to take some fraction of the pedal value and add it to the aileron value that went to the &#39;pit to generate a bogus roll response when the pedals moved.

I believe JNOV is doing something similar with his HUD program really, letting CMS generate values that his program then interprets. You might want to look back at the posts he made about that. The data flow is going to be pretty much the same. Anyway, the cockpit looks great! Good luck getting it all working!

- Bob

The StickWorks
http://www.stickworks.com

JNOV
22nd June 2004, 05:30 AM
Gunns:

You can use Direct Input as Bob suggests to read your HOTAS inputs (e.g., the axis values and button presses of any CM devices you define in your map) while in Aces High. You can also use Direct Input to read the keyboard or mouse. I have written a program (for another purpose) that runs in the background and does this (for any sim, not just AH), and it&#39;s really quite simple. If you are interested, drop me a line and I&#39;ll send it to you with some explanation of how it works.

If you know how to "talk" to your controller board (does it have a USB interface?), you could probably modify my background application to do so. I&#39;ve got it scanning the HOTAS inputs about 25 times per second right now, and the overhead that causes is not perceivable on my system. Thus, if you need a higher input rate, you could probably bump it up a bit.

By the way, in the latest patch for IL-2 FB, Oleg and crew added the ability to get detailed flight-envelope data using a UDP interface. I can&#39;t remember what it&#39;s called--direct link or something like that. Anyway, I&#39;m pretty sure they designed it for pit builders (although perhaps more for instrument read-outs than motion control, but I like your idea better :) ).

- JNOV

Gunns
26th June 2004, 10:05 PM
thanks all, that sounds like the solution I want. I just want to cause the mobliser to move in response to the JS,ect, but I am still waiting for my board. the board is a USB controled device and needs to be programed. More info when the board gets here.

Gunns

Typhoontony
27th June 2004, 03:14 AM
Hi Gunns
I have an article somewhere by a fellow who built a simpit and he used pneumatic actuaters for movement. I forget what type of interface he used for control. I will see if I still have the article and send it to you. I believe it was in PC Pilot or PC Aviator some time ago. I will check my files (mags are stashed everywhere & anywhere) and see if I can locate it. On another note judging from the picture it would seem that at the moment your simpit resembles a construction site and you could benefit from a set of HOTAS covers as described Here (http://www.ch-hangar.com/forum/index.php?showtopic=696) :)