fred64 Posted December 29, 2008 Report Share Posted December 29, 2008 Hi, I am a quite experienced C# programmer but I am new to FSUIPC and FSUIPC.NET. I am trying to simulate torque on an helicopter caused by the increase in collective. so basically I : 1. read the body yaw offset (30B8) 2. read the collective (thrust) offset (3AE8) 3. make my calculations and set the modified offset to body yaw offset (30B8) I then process the group at the beginning of the next tick (I use 20 ticks per second) this works well except that I loose the inputs from the pedals that do not work anymore. It seems to me that FS possibly alters the body yaw offset in the meanwhile (between the ticks) and that the changes he makes get lost with my process(). I tried other ways - setting the body yaw accelleration , but it doesn't make any effect even on very high values - setting the rudder trim: the effect works but too slow for my purpose - setting the rudder value (0BBA), not tried yet but then I have to add the actual rudder input from the user... my preferred way would be to modify the body yaw velocity or accelleration without touching the controls, working along the modifications done by FS instead of replacing them. Thank you for your help Fred Link to comment Share on other sites More sharing options...
Paul Henty Posted December 29, 2008 Report Share Posted December 29, 2008 Hi Fred, this works well except that I loose the inputs from the pedals that do not work anymore. It seems to me that FS possibly alters the body yaw offset in the meanwhile (between the ticks) and that the changes he makes get lost with my process(). Exactly: you keep resetting the yaw back to where it was when you last called Process() 50ms ago, the only difference being your torque adjustment. To make this method work you need to read the value each tick (not take the value from the last tick), make the adjustment and write the new value. Try making another yaw offset that is write-only and add it to a new group all of its own. (Keep the one in the exsiting group to read). Then each cycle you need to do this: 1. Process your original read group. 2. read the body yaw offset (30B8) 3. make your calculations and set the modified NEW WRITE-ONLY offset to body yaw offset (30B8) 4. Process the new write-only group to write the new yaw value I'm not sure how well this will work, but now you're only losing pilot inputs that happen between steps 1 and 4, which presumably is not very much time. The other drawback is that you now have two process() calls per tick so that's going to slow you down a bit. setting the rudder value (0BBA), not tried yet but then I have to add the actual rudder input from the user... This sounds like a better plan to me. The rudder pedals can be disconnected from the sim at offset 310A. Then each tick you just need to: 1. Read the position of the pedals at 332C 2. Make an adjustment for the torque effect 3. write the new value to 0BBA Again you have two processes (step 1 and 3) - use different offset groups for each step. I imagine this method to be smoother because you're not interfering with the results of the flight modal like the first method. You're just adjusting the inputs to the flight modal. Paul Link to comment Share on other sites More sharing options...
fred64 Posted December 30, 2008 Author Report Share Posted December 30, 2008 Hi Phenty thank you very much for your answer. Processing twice per tick with a read only offset doesn't seem to work. I tried also this as a test, I am setting the old value into the new value Set 30B8 offset (oYaw) Set 30B8 offset (oYawRO write only) Tick { Process() A = oYaw YawRO =A Process("write") oYawRO } give an erratic behaviour Yaw increases very quickly, while it should stay the same as before. It seems that the double process within a tick creates problems, I don't know if this could be a bug. Thank you Fred Link to comment Share on other sites More sharing options...
Andydigital Posted December 30, 2008 Report Share Posted December 30, 2008 Have you tried "Heliforce" by Simon Robbins, I've not used it for a while but from what I remember it was very good and maybe what you are looking for. Link to comment Share on other sites More sharing options...
fred64 Posted December 30, 2008 Author Report Share Posted December 30, 2008 Yes I heliforce tried it and it is good. Is uses pedals input to simulate yaw. What I am trying to do is a different project, where I will be using several variables to simulate an helicopter flight behaviour better than what FS does, also including other factors not included in Heliforce. I also thought of contacting him (we corresponded already) to see if he was interested but I believe he is very busy with a commercial project (dodosim) Thank you for your suggestion anyway Fred Link to comment Share on other sites More sharing options...
Paul Henty Posted December 30, 2008 Report Share Posted December 30, 2008 Hi Fred, Processing twice per tick with a read only offset doesn't seem to work. I tried also this as a test, I am setting the old value into the new value. give an erratic behaviour Yaw increases very quickly, while it should stay the same as before. Fred I also tried this and I didn't find the same problem. Here is my code: Offset oYaw = new Offset(0x30B8); Offset oYawWO = new Offset("WO",0x30B8,true); private void timer1_Tick(object sender, EventArgs e) { double yaw; FSUIPCConnection.Process(); yaw = oYaw.Value; oYawWO.Value = yaw; FSUIPCConnection.Process("WO"); } I believe this is the same as your test, but you didn't post your real code. Running this has no effect on the sim at all, as expected. If I change the yaw velocity between the read and write then it does affect the yaw. If you post your real code in here or send it via PM I'll have a look at it and see if I can see what's wrong. I'm pretty sure it's possible to do what you want with this method though. Paul Link to comment Share on other sites More sharing options...
fred64 Posted January 2, 2009 Author Report Share Posted January 2, 2009 Paul, you are right I did not test properly. I was actually calling a refresh method outside the main loop and there was a bug there, next time I'll also post my code. Thanks for your help.. I love this software it is so easy ! Happy New Year Fred Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now