コード例 #1
0
ファイル: CModuleComm.cs プロジェクト: gaslypierre/Drive
        //Reset all the byte arrays from modules
        public void ResetAllModuleCommValues()
        {
            machineData[mdHeaderHi]             = 127; // PGN - 32762
            machineData[mdHeaderLo]             = 250;
            machineData[mdSectionControlByteHi] = 0;
            machineData[mdSectionControlByteLo] = 0;
            machineData[mdSpeedXFour]           = 0;
            machineData[mdUTurn]   = 0;
            machineData[mdTree]    = 0;
            machineData[mdHydLift] = 0;
            machineData[md8]       = 0;
            machineData[md9]       = 0;
            mf.SendOutUSBMachinePort(machineData, pgnSentenceLength);

            autoSteerData[sdHeaderHi]     = 127; // PGN - 32766
            autoSteerData[sdHeaderLo]     = 254;
            autoSteerData[sd2]            = 0;
            autoSteerData[sdSpeed]        = 0;
            autoSteerData[sdDistanceHi]   = 125; // PGN - 32020
            autoSteerData[sdDistanceLo]   = 20;
            autoSteerData[sdSteerAngleHi] = 125; // PGN - 32020
            autoSteerData[sdSteerAngleLo] = 20;
            autoSteerData[sd8]            = 0;
            autoSteerData[sd9]            = 0;
            mf.SendOutUSBAutoSteerPort(autoSteerData, pgnSentenceLength);

            autoSteerSettings[ssHeaderHi]        = 127;// PGN - 32764 as header
            autoSteerSettings[ssHeaderLo]        = 252;
            autoSteerSettings[ssKp]              = Properties.Settings.Default.setAS_Kp;
            autoSteerSettings[ssLowPWM]          = Properties.Settings.Default.setAS_lowSteerPWM;
            autoSteerSettings[ssKd]              = Properties.Settings.Default.setAS_Kd;
            autoSteerSettings[ssKo]              = Properties.Settings.Default.setAS_Ko;
            autoSteerSettings[ssSteerOffset]     = Properties.Settings.Default.setAS_steerAngleOffset;
            autoSteerSettings[ssMinPWM]          = Properties.Settings.Default.setAS_minSteerPWM;
            autoSteerSettings[ssHighPWM]         = Properties.Settings.Default.setAS_highSteerPWM;
            autoSteerSettings[ssCountsPerDegree] = Properties.Settings.Default.setAS_countsPerDegree;
            //mf.SendSteerSettingsOutAutoSteerPort();

            ardSteerConfig[arHeaderHi] = 127; //PGN - 32763
            ardSteerConfig[arHeaderLo] = 251;
            ardSteerConfig[arSet0]     = Properties.Vehicle.Default.setArdSteer_setting0;
            ardSteerConfig[arSet1]     = Properties.Vehicle.Default.setArdSteer_setting1;
            ardSteerConfig[arMaxSpd]   = Properties.Vehicle.Default.setArdSteer_maxSpeed;
            ardSteerConfig[arMinSpd]   = Properties.Vehicle.Default.setArdSteer_minSpeed;
            byte inc = (byte)(Properties.Vehicle.Default.setArdSteer_inclinometer << 6);

            ardSteerConfig[arIncMaxPulse] = (byte)(inc + (byte)Properties.Vehicle.Default.setArdSteer_maxPulseCounts);
            ardSteerConfig[arAckermanFix] = Properties.Vehicle.Default.setArdSteer_ackermanFix;
            ardSteerConfig[arSet2]        = Properties.Vehicle.Default.setArdSteer_setting2;
            ardSteerConfig[ar9]           = 0;

            //arduino machine configuration
            ardMachineConfig[amHeaderHi]  = 127; //PGN - 32760
            ardMachineConfig[amHeaderLo]  = 248;
            ardMachineConfig[amRaiseTime] = Properties.Vehicle.Default.setArdMac_hydRaiseTime;
            ardMachineConfig[amLowerTime] = Properties.Vehicle.Default.setArdMac_hydLowerTime;
            ardMachineConfig[amEnableHyd] = Properties.Vehicle.Default.setArdMac_isHydEnabled;
            ardMachineConfig[amSet0]      = Properties.Vehicle.Default.setArdMac_setting0;
            ardMachineConfig[am6]         = 0;
            ardMachineConfig[am7]         = 0;
            ardMachineConfig[am8]         = 0;
            ardMachineConfig[am9]         = 0;
        }