예제 #1
0
        float GetFollowerIDMAcc(IDMInfo myIDMInfo, DriverBehavior followingDriver)
        {
            if (myIDMInfo.followingS <= 0)
            {
                return(-Algebra.Infinity);
            }

            float desiredDist = followingDriver.s0 +
                                Mathf.Max(0f, myIDMInfo.followingV * followingDriver.T + myIDMInfo.followingV * myIDMInfo.followingDeltaV / (2 * Mathf.Sqrt(followingDriver.a * followingDriver.b)));

            return(followingDriver.a * (1f - Mathf.Pow(myIDMInfo.followingV / followingDriver.v0, followingDriver.delta) - Mathf.Pow(desiredDist / myIDMInfo.followingS, 2)));
        }
예제 #2
0
        float GetFollowerIDMAccWithoutMe(IDMInfo myIDMInfo, DriverBehavior followingDriver)
        {
            IDMInfo partialInfoForFollower = new IDMInfo
            {
                laneNo   = myIDMInfo.laneNo,
                leadingS = myIDMInfo.followingS + myIDMInfo.leadingS,
                leadingV = myIDMInfo.leadingV,
                myV      = myIDMInfo.followingV
            };

            return(GetIDMAcc(partialInfoForFollower, followingDriver));
        }
예제 #3
0
        float GetIDMAcc(IDMInfo iDMInfo, DriverBehavior driver)
        {
            if (iDMInfo.leadingS <= 0)
            {
                //if would collide
                return(-Algebra.Infinity);
            }

            float desiredDist = driver.s0 +
                                Mathf.Max(0f, iDMInfo.myV * driver.T + iDMInfo.myV * iDMInfo.deltaV / (2 * Mathf.Sqrt(driver.a * driver.b)));

            return(driver.a * (1f - Mathf.Pow(iDMInfo.myV / driver.v0, driver.delta) - Mathf.Pow(desiredDist / iDMInfo.leadingS, 2)));
        }