示例#1
0
        private bool Coord(RemoteTech.FlightComputer.Commands.DriveCommand dc, FlightCtrlState fs)
        {
            float
                deg   = RTUtil.AngleBetween(RoverHDG, TargetHDG),
                speed = RoverSpeed;

            Delta  = Vector3.Distance(mVessel.CoM, TargetPos);
            DeltaT = Delta / speed;

            if (Delta > Math.Abs(deg) / 36)
            {
                fs.wheelThrottle = mThrottlePID.Control(BrakeSpeed(dc.speed, speed) - speed);
                if (ForwardAxis != Vector3.zero)
                {
                    fs.wheelSteer = mWheelPID.Control(deg);
                }
                return(false);
            }
            else
            {
                fs.wheelThrottle = 0;
                fs.wheelSteer    = 0;
                mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
                dc.mode = RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.Off;
                return(true);
            }
        }
示例#2
0
        private bool Coord(RemoteTech.FlightComputer.Commands.DriveCommand dc, FlightCtrlState fs)
        {
            Delta  = Vector3.Distance(mVessel.CoM, TargetPos);
            DeltaT = Delta / RoverSpeed;

            if (Delta > 0)
            {
                fs.wheelThrottle = (float)throttlePID.Update(RoverSpeed, dc.speed, -1.0, 1.0);
                if (ForwardAxis != Vector3.zero)
                {
                    Vector3d actuation      = pidController.GetActuation(targetRotation);
                    float    steeringOutput = (float)-steerPID.Update(RTUtil.AngleBetween(RoverHDG, TargetHDG), -1.0, 1.0);

                    if (mVessel.radarAltitude > minRadarAlt)
                    {
                        fs.pitch = Mathf.Clamp((float)actuation.x, -driveLimit, driveLimit);
                        fs.roll  = Mathf.Clamp((float)actuation.y, -driveLimit, driveLimit);
                    }
                    fs.yaw        = Mathf.Clamp((float)actuation.z, -driveLimit, driveLimit); //keep if u want jet car
                    fs.wheelSteer = SmoothenWheelSteering(RTUtil.AngleBetween(RoverHDG, TargetHDG), steeringOutput, -dc.steering, dc.steering);
                }
                return(false);
            }
            else
            {
                fs.wheelThrottle = 0;
                fs.wheelSteer    = 0;
                mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
                dc.mode = RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.Off;
                return(true);
            }
        }
示例#3
0
        private bool DistanceHeading(RemoteTech.FlightComputer.Commands.DriveCommand dc, FlightCtrlState fs)
        {
            float speed = RoverSpeed;

            Delta  = Math.Abs(dc.target) - Vector3.Distance(RoverOrigPos, mVessel.CoM);
            DeltaT = Delta / speed;
            if (Delta > 0)
            {
                fs.wheelThrottle = mThrottlePID.Control(BrakeSpeed(dc.speed, speed) - speed);
                if (ForwardAxis != Vector3.zero)
                {
                    fs.wheelSteer = mWheelPID.Control(RTUtil.AngleBetween(RoverHDG, dc.target2));
                }
                return(false);
            }
            else
            {
                fs.wheelThrottle = 0;
                fs.wheelSteer    = 0;
                mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, true);
                dc.mode = RemoteTech.FlightComputer.Commands.DriveCommand.DriveMode.Off;
                return(true);
            }
        }