www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+applanix_msgs/GAMS.m

    classdef GAMS < robotics.ros.Message
    %GAMS MATLAB implementation of applanix_msgs/GAMS
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'applanix_msgs/GAMS' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = '018cc2b2b8ae19d409c9e0d80bd8927e' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant)
        STATUSFIXEDINTEGER = uint8(0)
        STATUSFIXEDINTEGERTESTINSTALLDATA = uint8(1)
        STATUSDEGRADEDFIXEDINTEGER = uint8(2)
        STATUSFLOATEDAMBIGUITY = uint8(3)
        STATUSDEGRADEDFLOATEDAMBIGUITY = uint8(4)
        STATUSSOLUTIONWITHOUTINSTALLDATA = uint8(5)
        STATUSSOLUTIONFROMATTITUDEANDINSTALLDATA = uint8(6)
        STATUSNOSOLUTION = uint8(7)
        PRNUNASSIGNED = uint8(0)
    end
    
    properties (Constant, Access = protected)
        ApplanixMsgsTimeDistanceClass = robotics.ros.msg.internal.MessageFactory.getClassForType('applanix_msgs/TimeDistance') % Dispatch to MATLAB class for message type applanix_msgs/TimeDistance
    end
    
    properties (Dependent)
        Td
        NumSatellites
        APrioriPdop
        AntennaSeparation
        Status
        CycleSlipFlag
        GamsHeading
        GamsHeadingRmsErr
        PrnAssignment
    end
    
    properties (Access = protected)
        Cache = struct('Td', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'APrioriPdop', 'AntennaSeparation', 'CycleSlipFlag', 'GamsHeading', 'GamsHeadingRmsErr', 'NumSatellites', 'PrnAssignment', 'Status', 'Td'} % List of non-constant message properties
        ROSPropertyList = {'a_priori_pdop', 'antenna_separation', 'cycle_slip_flag', 'gams_heading', 'gams_heading_rms_err', 'num_satellites', 'prn_assignment', 'status', 'td'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = GAMS(msg)
            %GAMS Construct the message object GAMS
            import com.mathworks.toolbox.robotics.ros.message.MessageInfo;
            
            % Support default constructor
            if nargin == 0
                obj.JavaMessage = obj.createNewJavaMessage;
                return;
            end
            
            % Construct appropriate empty array
            if isempty(msg)
                obj = obj.empty(0,1);
                return;
            end
            
            % Make scalar construction fast
            if isscalar(msg)
                % Check for correct input class
                if ~MessageInfo.compareTypes(msg(1), obj.MessageType)
                    error(message('robotics:ros:message:NoTypeMatch', obj.MessageType, ...
                        char(MessageInfo.getType(msg(1))) ));
                end
                obj.JavaMessage = msg(1);
                return;
            end
            
            % Check that this is a vector of scalar messages. Since this
            % is an object array, use arrayfun to verify.
            if ~all(arrayfun(@isscalar, msg))
                error(message('robotics:ros:message:MessageArraySizeError'));
            end
            
            % Check that all messages in the array have the correct type
            if ~all(arrayfun(@(x) MessageInfo.compareTypes(x, obj.MessageType), msg))
                error(message('robotics:ros:message:NoTypeMatchArray', obj.MessageType));
            end
            
            % Construct array of objects if necessary
            objType = class(obj);
            for i = 1:length(msg)
                obj(i,1) = feval(objType, msg(i)); %#ok<AGROW>
            end
        end
        
        function td = get.Td(obj)
            %get.Td Get the value for property Td
            if isempty(obj.Cache.Td)
                obj.Cache.Td = feval(obj.ApplanixMsgsTimeDistanceClass, obj.JavaMessage.getTd);
            end
            td = obj.Cache.Td;
        end
        
        function set.Td(obj, td)
            %set.Td Set the value for property Td
            validateattributes(td, {obj.ApplanixMsgsTimeDistanceClass}, {'nonempty', 'scalar'}, 'GAMS', 'Td');
            
            obj.JavaMessage.setTd(td.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Td)
                obj.Cache.Td.setJavaObject(td.getJavaObject);
            end
        end
        
        function numsatellites = get.NumSatellites(obj)
            %get.NumSatellites Get the value for property NumSatellites
            numsatellites = typecast(int8(obj.JavaMessage.getNumSatellites), 'uint8');
        end
        
        function set.NumSatellites(obj, numsatellites)
            %set.NumSatellites Set the value for property NumSatellites
            validateattributes(numsatellites, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'NumSatellites');
            
            obj.JavaMessage.setNumSatellites(numsatellites);
        end
        
        function aprioripdop = get.APrioriPdop(obj)
            %get.APrioriPdop Get the value for property APrioriPdop
            aprioripdop = single(obj.JavaMessage.getAPrioriPdop);
        end
        
        function set.APrioriPdop(obj, aprioripdop)
            %set.APrioriPdop Set the value for property APrioriPdop
            validateattributes(aprioripdop, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'APrioriPdop');
            
            obj.JavaMessage.setAPrioriPdop(aprioripdop);
        end
        
        function antennaseparation = get.AntennaSeparation(obj)
            %get.AntennaSeparation Get the value for property AntennaSeparation
            antennaseparation = single(obj.JavaMessage.getAntennaSeparation);
        end
        
        function set.AntennaSeparation(obj, antennaseparation)
            %set.AntennaSeparation Set the value for property AntennaSeparation
            validateattributes(antennaseparation, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'AntennaSeparation');
            
            obj.JavaMessage.setAntennaSeparation(antennaseparation);
        end
        
        function status = get.Status(obj)
            %get.Status Get the value for property Status
            status = typecast(int8(obj.JavaMessage.getStatus), 'uint8');
        end
        
        function set.Status(obj, status)
            %set.Status Set the value for property Status
            validateattributes(status, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'Status');
            
            obj.JavaMessage.setStatus(status);
        end
        
        function cycleslipflag = get.CycleSlipFlag(obj)
            %get.CycleSlipFlag Get the value for property CycleSlipFlag
            cycleslipflag = typecast(int16(obj.JavaMessage.getCycleSlipFlag), 'uint16');
        end
        
        function set.CycleSlipFlag(obj, cycleslipflag)
            %set.CycleSlipFlag Set the value for property CycleSlipFlag
            validateattributes(cycleslipflag, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'CycleSlipFlag');
            
            obj.JavaMessage.setCycleSlipFlag(cycleslipflag);
        end
        
        function gamsheading = get.GamsHeading(obj)
            %get.GamsHeading Get the value for property GamsHeading
            gamsheading = double(obj.JavaMessage.getGamsHeading);
        end
        
        function set.GamsHeading(obj, gamsheading)
            %set.GamsHeading Set the value for property GamsHeading
            validateattributes(gamsheading, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'GamsHeading');
            
            obj.JavaMessage.setGamsHeading(gamsheading);
        end
        
        function gamsheadingrmserr = get.GamsHeadingRmsErr(obj)
            %get.GamsHeadingRmsErr Get the value for property GamsHeadingRmsErr
            gamsheadingrmserr = double(obj.JavaMessage.getGamsHeadingRmsErr);
        end
        
        function set.GamsHeadingRmsErr(obj, gamsheadingrmserr)
            %set.GamsHeadingRmsErr Set the value for property GamsHeadingRmsErr
            validateattributes(gamsheadingrmserr, {'numeric'}, {'nonempty', 'scalar'}, 'GAMS', 'GamsHeadingRmsErr');
            
            obj.JavaMessage.setGamsHeadingRmsErr(gamsheadingrmserr);
        end
        
        function prnassignment = get.PrnAssignment(obj)
            %get.PrnAssignment Get the value for property PrnAssignment
            javaArray = obj.JavaMessage.getPrnAssignment;
            array = obj.readJavaArray(javaArray, 'uint8');
            prnassignment = uint8(array);
        end
        
        function set.PrnAssignment(obj, prnassignment)
            %set.PrnAssignment Set the value for property PrnAssignment
            validateattributes(prnassignment, {'numeric'}, {'vector', 'numel', 12}, 'GAMS', 'PrnAssignment');
            
            javaArray = obj.JavaMessage.getPrnAssignment;
            array = obj.writeJavaArray(prnassignment, javaArray, 'uint8');
            obj.JavaMessage.setPrnAssignment(array);
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.Td = [];
        end
        
        function cpObj = copyElement(obj)
            %copyElement Implements deep copy behavior for message
            
            % Call default copy method for shallow copy
            cpObj = copyElement@robotics.ros.Message(obj);
            
            % Clear any existing cached properties
            cpObj.resetCache;
            
            % Create a new Java message object
            cpObj.JavaMessage = obj.createNewJavaMessage;
            
            % Iterate over all primitive properties
            cpObj.NumSatellites = obj.NumSatellites;
            cpObj.APrioriPdop = obj.APrioriPdop;
            cpObj.AntennaSeparation = obj.AntennaSeparation;
            cpObj.Status = obj.Status;
            cpObj.CycleSlipFlag = obj.CycleSlipFlag;
            cpObj.GamsHeading = obj.GamsHeading;
            cpObj.GamsHeadingRmsErr = obj.GamsHeadingRmsErr;
            cpObj.PrnAssignment = obj.PrnAssignment;
            
            % Recursively copy compound properties
            cpObj.Td = copy(obj.Td);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.NumSatellites = strObj.NumSatellites;
            obj.APrioriPdop = strObj.APrioriPdop;
            obj.AntennaSeparation = strObj.AntennaSeparation;
            obj.Status = strObj.Status;
            obj.CycleSlipFlag = strObj.CycleSlipFlag;
            obj.GamsHeading = strObj.GamsHeading;
            obj.GamsHeadingRmsErr = strObj.GamsHeadingRmsErr;
            obj.PrnAssignment = strObj.PrnAssignment;
            obj.Td = feval([obj.ApplanixMsgsTimeDistanceClass '.loadobj'], strObj.Td);
        end
    end
    
    methods (Access = ?robotics.ros.Message)
        function strObj = saveobj(obj)
            %saveobj Implements saving of message to MAT file
            
            % Return an empty element if object array is empty
            if isempty(obj)
                strObj = struct.empty;
                return
            end
            
            strObj.NumSatellites = obj.NumSatellites;
            strObj.APrioriPdop = obj.APrioriPdop;
            strObj.AntennaSeparation = obj.AntennaSeparation;
            strObj.Status = obj.Status;
            strObj.CycleSlipFlag = obj.CycleSlipFlag;
            strObj.GamsHeading = obj.GamsHeading;
            strObj.GamsHeadingRmsErr = obj.GamsHeadingRmsErr;
            strObj.PrnAssignment = obj.PrnAssignment;
            strObj.Td = saveobj(obj.Td);
        end
    end
    
    methods (Static, Access = {?matlab.unittest.TestCase, ?robotics.ros.Message})
        function obj = loadobj(strObj)
            %loadobj Implements loading of message from MAT file
            
            % Return an empty object array if the structure element is not defined
            if isempty(strObj)
                obj = robotics.ros.msggen.applanix_msgs.GAMS.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.applanix_msgs.GAMS;
            obj.reload(strObj);
        end
    end
end