Profile image

v1.10 demonstrator is up & question

9,445 vcharng  4.1 years ago

Hi everyone, my tech demo aircraft has been uploaded.

This post will be updated later to include the various technical details (codes etc) of the plane, but for now I just want to ask if there are people who are interested in solving one of the bugs in my build.

The "Pilot's Neck" is the function in question.
I built a device that rotates a camera to more or less follow the selected target, just like how real fighter pilots always keep their eyes on the target during a dogfight.
However, the "neck" has some very notable flaws, and I couldn't fix them.
Notably:
- the horizontal rotator doesn't follow the target accurately. It seems that the roll-compensator (to compensate aircraft roll's effect on target tracking) is not effective enough for 0~90 deg and over-reacting in 90~180 deg
- The whole system fails to track the target when the aircraft is in extreme attitude (such as rolled past 90 degrees)

Are there any professionals who can take a look at it, and suggest some changes? I will update this post with all the respective codes.

Update:
codes for each function, let's start with the simplest ones:

Proximity fuse for the cannon

set fuseInput as:

max(0.3, (TargetSelected & Activate5) ? TargetDistance / (850 - rate(TargetDistance)) : 60)

This code basically means:
if
there is a target selected
and
AG5 is on (proximity mode on)
then
detonate cannon shell at the estimated target distance

This neglects bullet drop, and does NOT include target lead. It only detonates the shell at a reasonable position.

Air-to-air rocket timing finder

TargetDistance + rate(TargetDistance) * 1.4 < 1250 - (GS * 1.4) & TargetDistance + rate(TargetDistance) * 1.4 > 1150 - (GS * 1.4)

1.4 is the mean time of rocket detonation (I have 3 groups, which detonates at 1.3, 1.4 and 1.5 seconds from launch, respectively)
1200m is the approximate distance that these rockets will fly in that time.

So this command basically means:
"Turn on the beacon light when the target's distance 1.4 seconds from now is between 1150m and 1250m, so that when my rockets detonate 1.4 seconds from now, 1200m in front of me, the enemy plane will be right there".

Radar

The radar contact dot itself is very simple, just use TargetDistance for the piston and deltaangle(TargetHeading, Heading) for the rotator.

The real challenge is update upon sweep.

the code for the activation group of these parts are:

abs(deltaangle(TargetHeading, Heading) / 180 - 0.3 * (pingpong(Time, 2) - 1)) < 0.1

while the "sweep" has a code of

pingpong(Time, 2) - 1

so basically, the rotator and the piston will *only change its input when the sweep roughly matches the target direction *

Please note that it is possible to see your radar contact update when the sweep is on the opposite side of the arc.
This means that you need to invert the input of the sweep.

Pilot's Neck(beta, please give input and advice)

Horizontal rotator:

clamp((((TargetHeading - Heading) - (360 * clamp01(sign(TargetHeading - Heading - 180)))) / 180) * clamp01(TargetSelected), -0.6, 0.6)

The "clamp between +- 0.6" is to give it a limitation similar to a real person's neck.

Vertical rotator:

clamp(((TargetElevation) - (PitchAngle * cos(abs(TargetHeading - Heading))) - ((RollAngle) * sin(TargetHeading - Heading))) / 90 * clamp01(TargetSelected), -0.3, 1)

Likewise, the clamp is to limit it to your neck and cockpit obstruction.

The formula currently only gives limited success, so inputs are welcome.

now, the most difficult one:

3-in-1 target solution finder (except the rocket one stated above so it's technically 2-in-1)

There are three elements for this

bomb/torpedo solution finder

3 pistons, their codes are like:

clamp01(sign(50 - sqrt((pow((Longitude + GS * cos(PitchAngle) * sin(Heading) * (TargetDistance / (- rate(TargetDistance)))) - ((Longitude + TargetDistance * sin(TargetHeading)) + rate((Longitude + TargetDistance * sin(TargetHeading))) * (TargetDistance / (- rate(TargetDistance)))), 2) + pow((Latitude + GS * cos(PitchAngle) * cos(Heading) * (TargetDistance / (- rate(TargetDistance)))) - ((Latitude + TargetDistance * cos(TargetHeading)) + rate((Latitude + TargetDistance * cos(TargetHeading))) * (TargetDistance / (- rate(TargetDistance)))), 2)))))

Looks like a bunch of crap but basically it's this:
sign(50 - sqrt(ERLON ^ 2 + ERLAT ^2))
ERLON = Error, longitude
ERLAT = Error, latitude
so in simpler terms, this is a piston that extends when the distance between your bomb and the target at the estimated time of impact is below 50m.

while

ERLON =

(Longitude + GS * cos(PitchAngle) * sin(Heading) * TOT) - (TLON + rate(TLON) * TOT)

while
TOT= time on target

The first part until *TOT) is your estimated position at the time of impact
This is why we are using skip bombs instead of torpedoes because it retains the speed of the aircraft almost all the way to target.

and
(TLON + rate(TLON) * TOT)
means the estimated longitude of your target at the time of impact.
TLON = target longitude

while

TLON = (Longitude + TargetDistance * sin(TargetHeading))
and
TOT = (TargetDistance / (- rate(TargetDistance))

notice that the TOT basically assumes that you are almost flying right toward the target. This means that this target solution finder only works when bomb trajectory is either totally vertical or totally horizontal (like skip bomb) and when your speed is significantly faster than the target.

For latitude, it's similar story.
ERLAT =

(Latitude + GS * cos(PitchAngle) * cos(Heading) * TOT) - (TLAT + rate(TLAT) * TOT)

while TLAT =

(Latitude + TargetDistance * cos(TargetHeading))

I have three similar pistons, one set at 100m, one at 50m and the last at 20m, so I can use these three pistons to know my current deviation from the calculated impact point.

Altitude check (skip bomb mode)

This checks that you are below a safe altitude to drop the bomb. If you drop the bomb too high, the bomb will sink.

Altitude < 200 & GearDown = - 1

very simple. I put GearDown as a factor because I don't want it to turn on while I'm trying to land.

Sink Rate (skip bomb mode)

This checks that you are not descending too fast. If you drop the bomb with a high(er) descend rate, it could also cause the skip bomb to sink.

Altitude < 200 & rate(Altitude) > - 10

Actually, with the Altitude Check, the first part is not necessary......

  • Log in to leave a comment
  • Profile image
    9,445 vcharng

    @marcox43 I've always have problem programming lights. In this Radar I simply used a dot and hide it in the sweep axle when not activated.

    4.0 years ago
  • Profile image
    23.4k marcox43

    can the code also be linked to the blinking for the radar's enemy location? so in time of the sweep, the light turns on for a second, then off and on again with the next sweep.
    Note: after a bunch of investigation, I think I'll be using your config for this radar, the Neptun's 3 dial display is a bit confusing and too bulky to use...

    4.0 years ago
  • Profile image
    9,445 vcharng

    @ThomasRoderick check the air-to-air rocket part, it answers your question on the plane page.

    4.1 years ago
  • Profile image
    9,445 vcharng

    Please raise any questions if you fail to understand what the hell I'm saying. I understand some of the stuff is pretty complicated (especially the bomb solution finder)

    4.1 years ago
  • Profile image
    24.1k BagelPlane

    Well, the “pilot’s neck” system could be used in part for turrets on bombers, which do not exceed 90 degrees.

    +2 4.1 years ago