Not a member yet? Why not Sign up today
Create an account  

  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Naval AI with terrain & friendly avoidance, evasive maneuvers [2017-11-05]

#11
So I take it plain helicopters just suck. Does the gunship AI not do attack runs, or is it even with your mods to make it work the Shadowcat is THAT bad a design (it still sucks with Draba's AI too)? I think more and more I want to stick with the quadcopters.

(2017-01-12, 09:55 PM)Richard Dastardly Wrote: Is AttackAngle the relative bearing of the target to attempt to stay at? I'm just giving this a go - I've set it up so it should make attack runs between 2500m & 2000m & AttackAngle of 80, but it's just turning nose on to target & then turning almost fully away at about 1500m. All PID controllers on the boat including in the script are set up as PD, so it's not an integer windup issue unless your script is sneaking something in ( I haven't deconstructed it much ). I think there is definitely something amiss in the steering given every sec or so it has a large judder like it's flapping the rudders. If it was constant I'd say it was the yaw pid, but it's irregularity & the lack of integral controller is a bit of a head-scratcher. I much prefer PID forms where you set Kp/Ki/Kd individually, especially for discrete systems like this ( dt here is fixed & guaranteed ).

Best I can tell (of course ZA can tell you for sure how his script works) it does work properly, but I don't have any PID other than what's in the script. My issues with steering seem to be of my own making, and they seem worse lately, but then I have made many changes to the ship I have been working on at the moment (it was a wonderfully effective 17k ship, other than the total lack of torpedo def...which required a big refit...and then I decided to totally ripoff Eagle's corvette superstructure to boot). Especially the fact that I have some ACB controlled foils for speed I'm sure fights against the script. My other ships other than the spinblock rudder ones work perfectly with it. All my ships run with it.
Reply

#12
Only other PID block I had was naval ai for yaw, and that was only minimal damping to stop tail waggle - turning it off didn't change anything.
Poke my boat! mostly pre-2.0 learning & catalogue thread - Update: Heavy & light tanks 07/04/18 for 2.1. 6 ships made 2.0 aware. If it's not AotE I can't do it regularily - sea -> post processing -> eyestrain.
Reply

#13
(2017-01-12, 10:33 PM)Richard Dastardly Wrote: Only other PID block I had was naval ai for yaw, and that was only minimal damping to stop tail waggle - turning it off didn't change anything.

And you set these?

MinDistance = 2000
MaxDistance = 2500

AttackRuns = true

Actually I don't know where 1500 would come from either, since it isn't any default.
Reply

#14
It's all set properly. I'll read the code properly at some point & see if I can work it out.
Poke my boat! mostly pre-2.0 learning & catalogue thread - Update: Heavy & light tanks 07/04/18 for 2.1. 6 ships made 2.0 aware. If it's not AotE I can't do it regularily - sea -> post processing -> eyestrain.
Reply

#15
(2017-01-12, 09:55 PM)Richard Dastardly Wrote: Is AttackAngle the relative bearing of the target to attempt to stay at? I'm just giving this a go - I've set it up so it should make attack runs between 2500m & 2000m & AttackAngle of 80, but it's just turning nose on to target & then turning almost fully away at about 1500m. All PID controllers on the boat including in the script are set up as PD, so it's not an integer windup issue unless your script is sneaking something in ( I haven't deconstructed it much ). I think there is definitely something amiss in the steering given every sec or so it has a large judder like it's flapping the rudders. If it was constant I'd say it was the yaw pid, but it's irregularity & the lack of integral controller is a bit of a head-scratcher. I much prefer PID forms where you set Kp/Ki/Kd individually, especially for discrete systems like this ( dt here is fixed & guaranteed ).

All the angles (Attack, Escape, Closing) are relative to the target bearing, yes. So if you want to properly close with the target, ClosingAngle should be <90. If you want to properly escape from the target, EscapeAngle should be >90.

The default evasion settings may be quite extreme (the first number in each table is the max magnitude of the angle variance). Try setting them all to nil to disable. It will only move in straight lines in that case, which probably isn't a good idea in combat though.

I noticed some oddity with my torpedo bomber (which uses AttackRuns = true), so the ForceAttackTime setting might be broken. I'll have to investigate when I have more time.
Reply

#16
(2017-01-13, 03:32 AM)ZerothAngel Wrote:
(2017-01-12, 09:55 PM)Richard Dastardly Wrote: Is AttackAngle the relative bearing of the target to attempt to stay at? I'm just giving this a go - I've set it up so it should make attack runs between 2500m & 2000m & AttackAngle of 80, but it's just turning nose on to target & then turning almost fully away at about 1500m. All PID controllers on the boat including in the script are set up as PD, so it's not an integer windup issue unless your script is sneaking something in ( I haven't deconstructed it much ). I think there is definitely something amiss in the steering given every sec or so it has a large judder like it's flapping the rudders. If it was constant I'd say it was the yaw pid, but it's irregularity & the lack of integral controller is a bit of a head-scratcher. I much prefer PID forms where you set Kp/Ki/Kd individually, especially for discrete systems like this ( dt here is fixed & guaranteed ).

All the angles (Attack, Escape, Closing) are relative to the target bearing, yes. So if you want to properly close with the target, ClosingAngle should be <90. If you want to properly escape from the target, EscapeAngle should be >90.

The default evasion settings may be quite extreme (the first number in each table is the max magnitude of the angle variance). Try setting them all to nil to disable. It will only move in straight lines in that case, which probably isn't a good idea in combat though.

I noticed some oddity with my torpedo bomber (which uses AttackRuns = true), so the ForceAttackTime setting might be broken. I'll have to investigate when I have more time.

Hmmmm...I updated all the scripts on the quads, and I test them before I put them away (since I just can't seem to get out of vehicle designer and back to campaign much as I want to). They all were working fine for me the other day.

So I finished updating my corvette, I made a lot of improvements, most of which helped with stability. There is the wiggle a bit that Richard mentioned, it didn't seem to be there before (I still have the old version so I'll compare) mostly I see it in since the turret barrel will shake.

This is also a small ship, has the same deathwish with default terrain evasion. Applying the same amount of tweaking as the sub seemed to do the trick.

Propellers in roll mode don't seem to be working at all. Aren't they supposed to be used to stabilize the ship? Also it seems the bow thrusters spin all the time when the ship is moving under AI, turning or not. Attached if you want to take a look.


Attached Files
.blueprint   Cerberus Class Corvette F2.blueprint (Size: 162.14 KB / Downloads: 27)
Reply

#17
(2017-01-13, 06:23 AM)Krougal Wrote: ...

I didn't try testing out the avoidance yet, but I guess my YawPID defaults are only good for 1 rudder. With 2 or more, the gain seems to be too much, thus the oscillation. I had luck using the following:
Code:
YawPIDConfig = {
   Kp = .05,
   Ti = 0,
   Td = .3,
}

Also, my naval-ai and warship scripts don't have any stabilization at all. I recommend setting up and using a G.P. PID since that's easier to tune.

My other combo scripts do have stabilization, but that's because they include an altitude/depth script (i.e. stabilization via jets, hydrofoils, or dediblades).

Actually, I noticed your ship has hydrofoils too. So the submarine combo script would work as well. Just be sure to set the idle/combat depths to something reasonable (like maybe -.8 or -.75 for your ship), otherwise it will try to dive. Wink

If you go that route, I don't recommend using roll props. I don't think it would interact well since both systems (hydrofoil stabilization + G.P. PID) would be operating independently.

Edit: Your roll props might be too close to the center to have any strong effect.
Reply

#18
(2017-01-13, 06:51 AM)ZerothAngel Wrote:
(2017-01-13, 06:23 AM)Krougal Wrote: ...

I didn't try testing out the avoidance yet, but I guess my YawPID defaults are only good for 1 rudder. With 2 or more, the gain seems to be too much, thus the oscillation. I had luck using the following:
Code:
YawPIDConfig = {
   Kp = .05,
   Ti = 2,
   Td = .3,
}

Also, my naval-ai and warship scripts don't have any stabilization at all. I recommend setting up and using a G.P. PID since that's easier to tune.

My other combo scripts do have stabilization, but that's because they include an altitude/depth script (i.e. stabilization via jets, hydrofoils, or dediblades).

Actually, I noticed your ship has hydrofoils too. So the submarine combo script would work as well. Just be sure to set the idle/combat depths to something reasonable (like maybe -.8 or -.75 for your ship), otherwise it will try to dive. Wink

If you go that route, I don't recommend using roll props. I don't think it would interact well since both systems (hydrofoil stabilization + G.P. PID) would be operating independently.

Edit: Your roll props might be too close to the center to have any strong effect.

Thanks! I'll give the PID a try. I'm pretty sure I only had a single rudder before so that would make sense. Not even sure it really benefits from the extra being it's small and light, I actually had like 4 bow thrusters each side originally too. I imagine there is a cap on turning rate?

I guess I've been working on the sub an inordinate amount of time lately, I got confused and imagined the ship AI had other than Yaw stabilization too. Had actually crossed my mind to throw the sub script on it, but the foils are meant to lift the nose out of the water (they're also backwards). I'll give moving the rolls out...if I can get them to work at all lol.

EDIT: So moving the props out a block plus adding 1 more each side, and the PID did the trick. I was actually using ACB controlled foils for stabilization at one point I think, actually cheap and effective...I learned a lot of tricks from the "simple destroyer kit". The Yaw was even worse, with or without the 2nd rudder...but I probably just need to do a little tuning tomorrow, it's really minor on this ship. Stopping the roll has helped gun and sensor accuracy a lot, even though this version has an overall cheaper suite I think.
Reply

#19
(2017-01-13, 03:32 AM)ZerothAngel Wrote: All the angles (Attack, Escape, Closing) are relative to the target bearing, yes. So if you want to properly close with the target, ClosingAngle should be <90. If you want to properly escape from the target, EscapeAngle should be >90.

The default evasion settings may be quite extreme (the first number in each table is the max magnitude of the angle variance). Try setting them all to nil to disable. It will only move in straight lines in that case, which probably isn't a good idea in combat though.

Most of the time it's not really evading anyway - just twitching off course like there's a beginner helmsman. I'll throw some debugging into the script sometime ( an external console would be a remarkably useful mod... ) and see what decisions it's making.
Poke my boat! mostly pre-2.0 learning & catalogue thread - Update: Heavy & light tanks 07/04/18 for 2.1. 6 ships made 2.0 aware. If it's not AotE I can't do it regularily - sea -> post processing -> eyestrain.
Reply

#20
(2017-01-13, 07:09 AM)Krougal Wrote: EDIT: So moving the props out a block plus adding 1 more each side, and the PID did the trick. I was actually using ACB controlled foils for stabilization at one point I think, actually cheap and effective...I learned a lot of tricks from the "simple destroyer kit". The Yaw was even worse, with or without the 2nd rudder...but I probably just need to do a little tuning tomorrow, it's really minor on this ship. Stopping the roll has helped gun and sensor accuracy a lot, even though this version has an overall cheaper suite I think.

On one of my warships, I have roll props and a set of hydrofoils towards the bow. G.P. PIDs actually works well for both, one set to roll and the other set to pitch hydrofoil. PID control just seems better for most things (if you take the time to tune it) vs. the "bang-bang" approach of ACBs (and you'll often need 2-3 ACBs to do the job of 1 PID...)

As posted, your ship seemed pretty nimble. From testing, it was able to do a 90 degree heading change in 8 seconds/170 meters.

If you're interested in measuring turning speed, turning radius, and/or help in tuning the yaw PID, I have a script for that (not normally listed on my index page). It simply changes course every minute or so (due north, east, south, west) and alternates the throttle between 50% & 100%. The results are outputted to the HUD and logged to the Lua box. Since it takes full control, it has to be the only combat AI script running, of course.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)