Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
Page 1 of 3 1 2 3
#4419679 - 05/08/18 09:57 PM EECH Hover Hold & Alt Hold Mods  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Hi Guys, I'm currently looking at correcting the problems with Hover Hold and Altitude Hold in the sim.

As you know, Hover Hold works most of the time, as long as your vertical velocity is low. If your velocity is higher, it tends to oscillate up and down more than necessary. Altitude Hold on the other hand is mostly useless, it doesn't work over anything but flat terrain. The goal of flying "Nap of the Earth" wasn't achieved by the original programmers. I think we can fix both subsystems.

I've dug through the code and found the code for both control subsystems. It's located here: \aphavoc\source\gunships\dynamics\common\co_force.c
Search in the file for "Auto hover calculations", it's about a third of the way through the file.

After digging through the Hover Hold section, I can see that it attempts to control the helicopter using mostly Proportional Control. The proportional code has two different ranges, one for higher velocity and another for low vertical velocity. Proportional Control is inherently unstable, it overshoots horribly and tends to oscillate and never settle. To correct this they've added in a section after the Proportional Control which adds in a damping component artificially, nudging the system with a slight acceleration opposite to the current velocity. When the vertical velocity is high the two sections are unbalanced, causing the system to oscillate. It will eventually settle, but you shouldn't have to wait so long. It should work better than this. There is also a short code section which levels out the helicopter by countering the Pitch and Roll with the cyclic. These motions are damped by gravity elsewhere in the dynamics system and are inherently stable. My original goal wasn't to fiddle with the Hover Hold, but now that I see how it's implemented I think we can improve it quite a bit.

I haven't looked at Altitude Hold in depth yet, that's my next task. It appears to look ahead of the helo one second and attempts to use the altitude ahead of the helo as part of the calculations. That probably helps some, but since it's most likely all Proportional Control, it doesn't work. I've watched the sim while flying over changing terrain and I've seen it oscillate up and down significantly. On one run I tried to lock Altitude Hold in at 300 ft. The terrain dropped away and the helo dropped all the way down until it slightly touched the ground, then swung upwards to almost 600 ft before coming back downwards again. It almost hit the ground again on round two as well. That much overshoot is what you get with 100% Proportional feedback control. Completely useless. We can fix it.

I've modeled the dynamics roughly in a spreadsheet and implemented a PID control loop (Proportional-Integration-Differentiation loop). I've optimized the coefficients to see what works, so I have a starting point for tuning the control loops. Once I get through digging through the Alt Hold section of the code, I'll look at ways to fix the control loops and see what I can do with it.
Thor

#4419681 - 05/08/18 10:13 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Jan 2016
Posts: 486
XIII Offline
Member
XIII  Offline
Member

Joined: Jan 2016
Posts: 486
Hello Javelin.
I am happy that you are trying to improve something in eech.
I do not know if you saw this thread, especially thealx post.they can be helpful for you.
Maybe if you finish improving the hover you will look at flight model.It would be great, good luck smile



http://SimHQ.com/forum/ubbthreads.php/topics/4388796/1



#4419724 - 05/09/18 03:14 AM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Hi XIII,
I've poked around in the code a little bit and I saw where all of the helos are based on one general purpose dynamics engine. All of the parameters for each helo type are ratio'd to the base model, which I believe is based on the Comanche. I haven't compared the parameters between types, though. It could be the ratios aren't ranged widely enough to give you a feel for the weight differences between each model. It also may not account for control differences between different styles of helicopters (single rotor vs coaxial rotors). I can take a look at it when I get some time after I finish fixing the Alt Hover code, that's what bugs me the most right now.
Javelin

#4419742 - 05/09/18 06:51 AM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Jan 2001
Posts: 1,922
Marc Offline
Member
Marc  Offline
Member

Joined: Jan 2001
Posts: 1,922
Corona, California
Thanks a bunch, looking forward seeing the result Thor, that sim deserves it

Marc..


HP-Compaq-8100-Elite-SFF-Intel-Core-i5-660-3-33GHz-8GB-250GB-Windows7, GTX1050 -X45+Rudder Pedals, Playseat Challenge
#4419772 - 05/09/18 12:47 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Dec 2010
Posts: 1,883
messyhead Offline
Member
messyhead  Offline
Member

Joined: Dec 2010
Posts: 1,883
Nice to have another modder around. Do you mind if I ask what your coding background is? I've learned C just from working on this sim, and not all that well. I get stuck at bits quite often, which is the reason my own Blackhawk project hasn't progressed much.

#4419814 - 05/09/18 03:55 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
My Background? I'm a Mechanical Engineer who has been writing code for personal projects on and off for 30 years. I've mostly programmed in Delphi but I have done a little bit with C here and there. The Electrical Engineer I work with helps me out out when I need it, he's a very strong C programmer. Most of the stuff I've programmed has been analytical graphical stuff, working at stock market projection, but I also worked on coding a 3D sim up from scratch in OpenGL which included a physics modeled helicopter. I was working up to a Mechwarrior-5 sim, but then Piranha Games took it on so I stopped. It was too much for one person anyway. I should have used someone else's 3D rendering engine instead of coding one up from scratch, but I had fun doing it. I had some really unique features in it, like a continuously variable level of detail module for rendering complex items (no one has ever done that before!) an octagonal skybox, procedural scenery placement, stuff like that. I ran out of steam when Piranha stepped in with Mechwarrior Online.

I went through the Altitude Hold code last night. It expends a lot of energy calculating the helo's position one second in the future, but they made a mistake in the physics. The acceleration term (1/2)at^2 was implemented incorrectly, they forgot to multiply by 1/2. This throws the projection off by a bit, but that wasn't the worst of it. The control is purely proportional like I thought, using a coefficient of 5.0 which is pretty high. This time they didn't damp it at all, the altitude is left to cycle up and down at will. I modeled the controls roughly in a spreadsheet and found a solution with a proportional coefficient of 1.0, and a damping coefficient of 2.5. It takes a lot of damping to keep the helo from overshooting and potentially hitting the ground during fast nap of the earth flying. I also found that throttle control isn't enough, you need to pitch the nose up and down in order to maneuver severely enough to follow the terrain closely. Over 30 to 50 knots I kicked in a bit of Pitch control to help it maneuver. Hopefully EECH will respond similar to my model and it won't take much tweaking to get it working smoothly.

After flying for a bit last night, I suspect the Auto Pilot is directly adjusting the helo's altitude, I don't think they used control inputs to adjust the flight path at all. It moves too cleanly and the control inputs don't quite match a physics based solution. I'll take a look just for my own satisfaction when I get some time. Since it's working just fine I don't intend on changing it, I'm just curious.

Taking on an entire helicopter like the Blackhawk is pretty adventurous! To customize it all the way will take some work, there are bits and pieces of code to rework all over the place. The 3D models shouldn't be too difficult, just a lot of hours to create and texture. There might even be 3D models out there you could use to jump off from. Are you going for clickable cockpits? That's a chore I wouldn't want to take on. I'm not sold on clickable cockpits. It means you can't just jump into a new helicopter type and fly it right away. I haven't got the time to learn a dozen different cockpits, I'd rather have a simpler basic control set that works for all of the helo types so I can fly anything in the sim without a steep learning curve every time.
Javelin

#4419819 - 05/09/18 04:13 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Jan 2016
Posts: 486
XIII Offline
Member
XIII  Offline
Member

Joined: Jan 2016
Posts: 486
Flight model and everything associated with it is the weakest part of the eech from the beginning.
any improvements will be everyone's dream.The more that you are a specialist.

#4419826 - 05/09/18 04:50 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Uhmm... I just took a look into the Blackhawk project and Wow, you guys are really taking it to the next level! It looks like a ton of work you're doing, getting all the instrument displays working.

The flight model is more my thing, I enjoy messing with the physics. I'll take a look under the hood when I get time and see what I can do. The Apache feels sluggish to me, and the Comanche behaves oddly when I'm near a hillside. Something's not quite right.

#4419830 - 05/09/18 05:06 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Jan 2016
Posts: 486
XIII Offline
Member
XIII  Offline
Member

Joined: Jan 2016
Posts: 486
not only blackhawk, mi24 also wink

#4419905 - 05/09/18 10:57 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Nice! Adding completely new helos is really cool.

I looked through the dynamics code though, and almost all of the parameters are the same for every helicopter type. The only parameters that got updated were the the helicopter weight, fuel weight, and max torque. The developer got lazy and didn't bother to fill in all the parameters even though the code is set up to handle it. Basically, every helo uses the Comanche parameters even though they might be heavier or lighter and handle differently. I think all we have to do is find the correct numbers and enter them into the tables, recompile, then things will start feeling like they should. It will unbalance the multiplayer portion of the game, but I don't think any of us really care about that. It's supposed to be a sim and real life is unbalanced.

Does anyone know if there is a reference online like "Jane's All The World's Aircraft" or have access to the data we need?
Javelin

#4420006 - 05/10/18 11:25 AM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Dec 2010
Posts: 1,883
messyhead Offline
Member
messyhead  Offline
Member

Joined: Dec 2010
Posts: 1,883
Originally Posted by Javelin
Uhmm... I just took a look into the Blackhawk project and Wow, you guys are really taking it to the next level! It looks like a ton of work you're doing, getting all the instrument displays working.

The flight model is more my thing, I enjoy messing with the physics. I'll take a look under the hood when I get time and see what I can do. The Apache feels sluggish to me, and the Comanche behaves oddly when I'm near a hillside. Something's not quite right.



Yeah, it has been a lot of work, and taken a long time so far. The 3D part I find easy-ish, but the coding is the tough part. Most of the code can be re-used for the instruments. But I'm not at the point of having to try and get some unique instruments working, and it's proving tricky. Sockzien is also doing a model,. based on the newer digital cockpit version of the Blackhawk. But I like the "old fashioned" ones, and based it on the special forces model, as it's the only real world model capable of laser targetting and firing Hellfires. The current in game AI model cheats.

#4420064 - 05/10/18 04:28 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Dec 2012
Posts: 1,382
thealx Offline
Member
thealx  Offline
Member

Joined: Dec 2012
Posts: 1,382
Please notice that completely different code used for different flight modes ("flight_model" parameter of EECH.ini). By default - each helicopter has it's own functions, but for future improvements sake - they was combined in common functions that used only for flight_model=2. Different DYN files used as well (default folder is \common\data\dyn, new - \common\data\dynamics). I believe it will be fair to leave default FM as is, as some people still like it. Different question is fixing issues - it will be helpful anyway. But as long as you are talking about physics improvements, you may need to stick to the fm=2 as it was made for such purposes. That is just recommendation, it's your decision anyway.

#4420101 - 05/10/18 07:05 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Thanks thealx, I haven't dug deep enough to really have a good handle on things yet. I wasn't aware there were two different Flight Models in the code.
How do you switch between the two different flight models?

I did notice one thing yesterday... I didn't see any code for modeling the rear horizontal and vertical stabilizers anywhere.

#4420105 - 05/10/18 07:12 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Jan 2016
Posts: 486
XIII Offline
Member
XIII  Offline
Member

Joined: Jan 2016
Posts: 486
Originally Posted by Javelin

How do you switch between the two different flight models?


in eech.ini you have flag.

#4420178 - 05/11/18 04:21 AM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Right! I need to look in there and see what else I'm missing out on...

OK, I was already using FM2, but there are some other interesting settings in there.

Last edited by Javelin; 05/11/18 04:43 AM.
#4420196 - 05/11/18 11:13 AM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Dec 2012
Posts: 1,382
thealx Offline
Member
thealx  Offline
Member

Joined: Dec 2012
Posts: 1,382
Originally Posted by Javelin
I did notice one thing yesterday... I didn't see any code for modeling the rear horizontal and vertical stabilizers anywhere.

animate_helicopter_controls ( entity *en )

#4420274 - 05/11/18 06:49 PM Re: EECH Hover Hold & Alt Hold Mods [Re: thealx]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Originally Posted by thealx
animate_helicopter_controls ( entity *en )


That would be the keyframe animation code. I was looking through the physics code, which doesn't seem to have a section for calculating the forces on the airframe from the horizontal and vertical stabilizers.

The horizontal stabilizer tends to level the helicopter out at higher speeds, the vertical stabilizer straightens out the helicopter and reduces the need for the tail rotor at higher speeds. It also affects the helo when you try to fly directly sideways, it tends to swing the tail in behind, opposite to the direction of motion. The older Huey Cobra's had an large tail fin, making it quite difficult to fly directly sideways without using a lot of pedal action.

Last edited by Javelin; 05/11/18 07:06 PM.
#4420278 - 05/11/18 07:17 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Jan 2016
Posts: 486
XIII Offline
Member
XIII  Offline
Member

Joined: Jan 2016
Posts: 486
Javelin-I am a total amateur, but it's great to read your posts cheers

#4420284 - 05/11/18 07:39 PM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Dec 2012
Posts: 1,382
thealx Offline
Member
thealx  Offline
Member

Joined: Dec 2012
Posts: 1,382
There is no such calculations, as I'm aware. Even animation of stabilizers and rotor blades was implemented several years ago, but no one had any plans to improve flight model deeply. Originally game wasn't designed as serious simulator, and devs was focused on gameplay mostly - don't expect too much. You can find option in the eech.ini that show all forces applied to the helicopter, and makes it easier to understand how simple dynamics scripts are.

#4420313 - 05/12/18 12:05 AM Re: EECH Hover Hold & Alt Hold Mods [Re: Javelin]  
Joined: Apr 2018
Posts: 300
Javelin Offline
Member
Javelin  Offline
Member

Joined: Apr 2018
Posts: 300
Idaho Falls, Idaho USA
Hi guys, I did some sideways flight testing today, it seems to want to behave properly. It doesn't feel snappy like the sim I programmed a number of years ago though, it feels a bit sluggish and mushy. Somewhere in the physics code there is an artificial restorative force of some kind I need to find. I think I can add in something a bit more realistic for the stabilizers once I figure out where the restorative force is hidden away. The developers did a great job on modeling all the characteristics of the two rotors from what I can see, they just didn't have the knowledge to take on things like feedback control or the stabilizers properly.

My next step is to set up Watcom and figure out how to compile this beast, then I can get to work fixing the Hover code.

Page 1 of 3 1 2 3

Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

If you shop on Amazon use this Amazon link to support SimHQ
.
Social


Recent Topics
CD WOFF
by Britisheh. 03/28/24 08:05 PM
Carnival Cruise Ship Fire....... Again
by F4UDash4. 03/26/24 05:58 PM
Baltimore Bridge Collapse
by F4UDash4. 03/26/24 05:51 PM
The Oldest WWII Veterans
by F4UDash4. 03/24/24 09:21 PM
They got fired after this.
by Wigean. 03/20/24 08:19 PM
Grown ups joke time
by NoFlyBoy. 03/18/24 10:34 PM
Anyone Heard from Nimits?
by F4UDash4. 03/18/24 10:01 PM
RIP Gemini/Apollo astronaut Tom Stafford
by semmern. 03/18/24 02:14 PM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0