Exemple #1
0
        public void InitMode(DriveCommand dc)
        {
            UpdateAxis();

            mRoverAlt = (float)mVessel.altitude;
            mRoverLat = (float)mVessel.latitude;
            mRoverLon = (float)mVessel.longitude;

            switch (dc.mode)
            {
            case DriveCommand.DriveMode.Turn:
                mRoverRot = mVessel.ReferenceTransform.rotation;
                break;

            case DriveCommand.DriveMode.Distance:
                mWheelPID.setClamp(-1, 1);
                mKeepHDG = RoverHDG;
                break;

            case DriveCommand.DriveMode.DistanceHeading:
                mWheelPID.setClamp(-dc.steering, dc.steering);
                break;

            case DriveCommand.DriveMode.Coord:
                mWheelPID.setClamp(-dc.steering, dc.steering);
                mTargetLat = dc.target;
                mTargetLon = dc.target2;
                break;
            }
            mThrottlePID.Reset();
            mWheelPID.Reset();
            mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, false);
        }
Exemple #2
0
        public void InitMode(DriveCommand dc)
        {
            axis = ModuleWheel.AlignmentAxis.None;
            foreach (Part p in mVessel.parts)
            {
                if (p.Modules.Contains("ModuleWheel"))
                {
                    axis = (p.Modules["ModuleWheel"] as ModuleWheel).alignmentAxis;
                    if (axis != ModuleWheel.AlignmentAxis.None)
                    {
                        break;
                    }
                }
            }
            mRoverAlt = (float)mVessel.altitude;
            mRoverLat = (float)mVessel.latitude;
            mRoverLon = (float)mVessel.longitude;

            switch (dc.mode)
            {
            case DriveCommand.DriveMode.Turn:
                mRoverRot = mVessel.ReferenceTransform.rotation;
                break;

            case DriveCommand.DriveMode.Distance:
                mWheelPID.setClamp(-1, 1);
                mKeepHDG = RoverHDG;
                break;

            case DriveCommand.DriveMode.DistanceHeading:
                mWheelPID.setClamp(-dc.steering, dc.steering);
                break;

            case DriveCommand.DriveMode.Coord:
                mWheelPID.setClamp(-dc.steering, dc.steering);
                mTargetLat = dc.target;
                mTargetLon = dc.target2;
                break;
            }
            mThrottlePID.Reset();
            mWheelPID.Reset();
            mVessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, false);
        }