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

    classdef GeneralParams < robotics.ros.Message
    %GeneralParams MATLAB implementation of applanix_msgs/GeneralParams
    %   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/GeneralParams' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = 'dd32351725c9c39d1131c0be17b24a7b' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant)
        MULTIPATHLOW = uint8(0)
        MULTIPATHMEDIUM = uint8(1)
        MULTIPATHHIGH = uint8(2)
    end
    
    properties (Constant, Access = protected)
        GeometryMsgsPoint32Class = robotics.ros.msg.internal.MessageFactory.getClassForType('geometry_msgs/Point32') % Dispatch to MATLAB class for message type geometry_msgs/Point32
    end
    
    properties (Dependent)
        Transaction
        TimeTypes
        DistanceType
        Autostart
        ImuLeverArm
        PrimaryGnssLeverArm
        Aux1GnssLeverArm
        Aux2GnssLeverArm
        ImuMountingAngle
        RefMountingAngle
        Multipath
    end
    
    properties (Access = protected)
        Cache = struct('ImuLeverArm', [], 'PrimaryGnssLeverArm', [], 'Aux1GnssLeverArm', [], 'Aux2GnssLeverArm', [], 'ImuMountingAngle', [], 'RefMountingAngle', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'Autostart', 'Aux1GnssLeverArm', 'Aux2GnssLeverArm', 'DistanceType', 'ImuLeverArm', 'ImuMountingAngle', 'Multipath', 'PrimaryGnssLeverArm', 'RefMountingAngle', 'TimeTypes', 'Transaction'} % List of non-constant message properties
        ROSPropertyList = {'autostart', 'aux_1_gnss_lever_arm', 'aux_2_gnss_lever_arm', 'distance_type', 'imu_lever_arm', 'imu_mounting_angle', 'multipath', 'primary_gnss_lever_arm', 'ref_mounting_angle', 'time_types', 'transaction'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = GeneralParams(msg)
            %GeneralParams Construct the message object GeneralParams
            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 transaction = get.Transaction(obj)
            %get.Transaction Get the value for property Transaction
            transaction = typecast(int16(obj.JavaMessage.getTransaction), 'uint16');
        end
        
        function set.Transaction(obj, transaction)
            %set.Transaction Set the value for property Transaction
            validateattributes(transaction, {'numeric'}, {'nonempty', 'scalar'}, 'GeneralParams', 'Transaction');
            
            obj.JavaMessage.setTransaction(transaction);
        end
        
        function timetypes = get.TimeTypes(obj)
            %get.TimeTypes Get the value for property TimeTypes
            timetypes = typecast(int8(obj.JavaMessage.getTimeTypes), 'uint8');
        end
        
        function set.TimeTypes(obj, timetypes)
            %set.TimeTypes Set the value for property TimeTypes
            validateattributes(timetypes, {'numeric'}, {'nonempty', 'scalar'}, 'GeneralParams', 'TimeTypes');
            
            obj.JavaMessage.setTimeTypes(timetypes);
        end
        
        function distancetype = get.DistanceType(obj)
            %get.DistanceType Get the value for property DistanceType
            distancetype = typecast(int8(obj.JavaMessage.getDistanceType), 'uint8');
        end
        
        function set.DistanceType(obj, distancetype)
            %set.DistanceType Set the value for property DistanceType
            validateattributes(distancetype, {'numeric'}, {'nonempty', 'scalar'}, 'GeneralParams', 'DistanceType');
            
            obj.JavaMessage.setDistanceType(distancetype);
        end
        
        function autostart = get.Autostart(obj)
            %get.Autostart Get the value for property Autostart
            autostart = typecast(int8(obj.JavaMessage.getAutostart), 'uint8');
        end
        
        function set.Autostart(obj, autostart)
            %set.Autostart Set the value for property Autostart
            validateattributes(autostart, {'numeric'}, {'nonempty', 'scalar'}, 'GeneralParams', 'Autostart');
            
            obj.JavaMessage.setAutostart(autostart);
        end
        
        function imuleverarm = get.ImuLeverArm(obj)
            %get.ImuLeverArm Get the value for property ImuLeverArm
            if isempty(obj.Cache.ImuLeverArm)
                obj.Cache.ImuLeverArm = feval(obj.GeometryMsgsPoint32Class, obj.JavaMessage.getImuLeverArm);
            end
            imuleverarm = obj.Cache.ImuLeverArm;
        end
        
        function set.ImuLeverArm(obj, imuleverarm)
            %set.ImuLeverArm Set the value for property ImuLeverArm
            validateattributes(imuleverarm, {obj.GeometryMsgsPoint32Class}, {'nonempty', 'scalar'}, 'GeneralParams', 'ImuLeverArm');
            
            obj.JavaMessage.setImuLeverArm(imuleverarm.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.ImuLeverArm)
                obj.Cache.ImuLeverArm.setJavaObject(imuleverarm.getJavaObject);
            end
        end
        
        function primarygnssleverarm = get.PrimaryGnssLeverArm(obj)
            %get.PrimaryGnssLeverArm Get the value for property PrimaryGnssLeverArm
            if isempty(obj.Cache.PrimaryGnssLeverArm)
                obj.Cache.PrimaryGnssLeverArm = feval(obj.GeometryMsgsPoint32Class, obj.JavaMessage.getPrimaryGnssLeverArm);
            end
            primarygnssleverarm = obj.Cache.PrimaryGnssLeverArm;
        end
        
        function set.PrimaryGnssLeverArm(obj, primarygnssleverarm)
            %set.PrimaryGnssLeverArm Set the value for property PrimaryGnssLeverArm
            validateattributes(primarygnssleverarm, {obj.GeometryMsgsPoint32Class}, {'nonempty', 'scalar'}, 'GeneralParams', 'PrimaryGnssLeverArm');
            
            obj.JavaMessage.setPrimaryGnssLeverArm(primarygnssleverarm.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.PrimaryGnssLeverArm)
                obj.Cache.PrimaryGnssLeverArm.setJavaObject(primarygnssleverarm.getJavaObject);
            end
        end
        
        function aux1gnssleverarm = get.Aux1GnssLeverArm(obj)
            %get.Aux1GnssLeverArm Get the value for property Aux1GnssLeverArm
            if isempty(obj.Cache.Aux1GnssLeverArm)
                obj.Cache.Aux1GnssLeverArm = feval(obj.GeometryMsgsPoint32Class, obj.JavaMessage.getAux1GnssLeverArm);
            end
            aux1gnssleverarm = obj.Cache.Aux1GnssLeverArm;
        end
        
        function set.Aux1GnssLeverArm(obj, aux1gnssleverarm)
            %set.Aux1GnssLeverArm Set the value for property Aux1GnssLeverArm
            validateattributes(aux1gnssleverarm, {obj.GeometryMsgsPoint32Class}, {'nonempty', 'scalar'}, 'GeneralParams', 'Aux1GnssLeverArm');
            
            obj.JavaMessage.setAux1GnssLeverArm(aux1gnssleverarm.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Aux1GnssLeverArm)
                obj.Cache.Aux1GnssLeverArm.setJavaObject(aux1gnssleverarm.getJavaObject);
            end
        end
        
        function aux2gnssleverarm = get.Aux2GnssLeverArm(obj)
            %get.Aux2GnssLeverArm Get the value for property Aux2GnssLeverArm
            if isempty(obj.Cache.Aux2GnssLeverArm)
                obj.Cache.Aux2GnssLeverArm = feval(obj.GeometryMsgsPoint32Class, obj.JavaMessage.getAux2GnssLeverArm);
            end
            aux2gnssleverarm = obj.Cache.Aux2GnssLeverArm;
        end
        
        function set.Aux2GnssLeverArm(obj, aux2gnssleverarm)
            %set.Aux2GnssLeverArm Set the value for property Aux2GnssLeverArm
            validateattributes(aux2gnssleverarm, {obj.GeometryMsgsPoint32Class}, {'nonempty', 'scalar'}, 'GeneralParams', 'Aux2GnssLeverArm');
            
            obj.JavaMessage.setAux2GnssLeverArm(aux2gnssleverarm.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Aux2GnssLeverArm)
                obj.Cache.Aux2GnssLeverArm.setJavaObject(aux2gnssleverarm.getJavaObject);
            end
        end
        
        function imumountingangle = get.ImuMountingAngle(obj)
            %get.ImuMountingAngle Get the value for property ImuMountingAngle
            if isempty(obj.Cache.ImuMountingAngle)
                obj.Cache.ImuMountingAngle = feval(obj.GeometryMsgsPoint32Class, obj.JavaMessage.getImuMountingAngle);
            end
            imumountingangle = obj.Cache.ImuMountingAngle;
        end
        
        function set.ImuMountingAngle(obj, imumountingangle)
            %set.ImuMountingAngle Set the value for property ImuMountingAngle
            validateattributes(imumountingangle, {obj.GeometryMsgsPoint32Class}, {'nonempty', 'scalar'}, 'GeneralParams', 'ImuMountingAngle');
            
            obj.JavaMessage.setImuMountingAngle(imumountingangle.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.ImuMountingAngle)
                obj.Cache.ImuMountingAngle.setJavaObject(imumountingangle.getJavaObject);
            end
        end
        
        function refmountingangle = get.RefMountingAngle(obj)
            %get.RefMountingAngle Get the value for property RefMountingAngle
            if isempty(obj.Cache.RefMountingAngle)
                obj.Cache.RefMountingAngle = feval(obj.GeometryMsgsPoint32Class, obj.JavaMessage.getRefMountingAngle);
            end
            refmountingangle = obj.Cache.RefMountingAngle;
        end
        
        function set.RefMountingAngle(obj, refmountingangle)
            %set.RefMountingAngle Set the value for property RefMountingAngle
            validateattributes(refmountingangle, {obj.GeometryMsgsPoint32Class}, {'nonempty', 'scalar'}, 'GeneralParams', 'RefMountingAngle');
            
            obj.JavaMessage.setRefMountingAngle(refmountingangle.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.RefMountingAngle)
                obj.Cache.RefMountingAngle.setJavaObject(refmountingangle.getJavaObject);
            end
        end
        
        function multipath = get.Multipath(obj)
            %get.Multipath Get the value for property Multipath
            multipath = typecast(int8(obj.JavaMessage.getMultipath), 'uint8');
        end
        
        function set.Multipath(obj, multipath)
            %set.Multipath Set the value for property Multipath
            validateattributes(multipath, {'numeric'}, {'nonempty', 'scalar'}, 'GeneralParams', 'Multipath');
            
            obj.JavaMessage.setMultipath(multipath);
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.ImuLeverArm = [];
            obj.Cache.PrimaryGnssLeverArm = [];
            obj.Cache.Aux1GnssLeverArm = [];
            obj.Cache.Aux2GnssLeverArm = [];
            obj.Cache.ImuMountingAngle = [];
            obj.Cache.RefMountingAngle = [];
        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.Transaction = obj.Transaction;
            cpObj.TimeTypes = obj.TimeTypes;
            cpObj.DistanceType = obj.DistanceType;
            cpObj.Autostart = obj.Autostart;
            cpObj.Multipath = obj.Multipath;
            
            % Recursively copy compound properties
            cpObj.ImuLeverArm = copy(obj.ImuLeverArm);
            cpObj.PrimaryGnssLeverArm = copy(obj.PrimaryGnssLeverArm);
            cpObj.Aux1GnssLeverArm = copy(obj.Aux1GnssLeverArm);
            cpObj.Aux2GnssLeverArm = copy(obj.Aux2GnssLeverArm);
            cpObj.ImuMountingAngle = copy(obj.ImuMountingAngle);
            cpObj.RefMountingAngle = copy(obj.RefMountingAngle);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.Transaction = strObj.Transaction;
            obj.TimeTypes = strObj.TimeTypes;
            obj.DistanceType = strObj.DistanceType;
            obj.Autostart = strObj.Autostart;
            obj.Multipath = strObj.Multipath;
            obj.ImuLeverArm = feval([obj.GeometryMsgsPoint32Class '.loadobj'], strObj.ImuLeverArm);
            obj.PrimaryGnssLeverArm = feval([obj.GeometryMsgsPoint32Class '.loadobj'], strObj.PrimaryGnssLeverArm);
            obj.Aux1GnssLeverArm = feval([obj.GeometryMsgsPoint32Class '.loadobj'], strObj.Aux1GnssLeverArm);
            obj.Aux2GnssLeverArm = feval([obj.GeometryMsgsPoint32Class '.loadobj'], strObj.Aux2GnssLeverArm);
            obj.ImuMountingAngle = feval([obj.GeometryMsgsPoint32Class '.loadobj'], strObj.ImuMountingAngle);
            obj.RefMountingAngle = feval([obj.GeometryMsgsPoint32Class '.loadobj'], strObj.RefMountingAngle);
        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.Transaction = obj.Transaction;
            strObj.TimeTypes = obj.TimeTypes;
            strObj.DistanceType = obj.DistanceType;
            strObj.Autostart = obj.Autostart;
            strObj.Multipath = obj.Multipath;
            strObj.ImuLeverArm = saveobj(obj.ImuLeverArm);
            strObj.PrimaryGnssLeverArm = saveobj(obj.PrimaryGnssLeverArm);
            strObj.Aux1GnssLeverArm = saveobj(obj.Aux1GnssLeverArm);
            strObj.Aux2GnssLeverArm = saveobj(obj.Aux2GnssLeverArm);
            strObj.ImuMountingAngle = saveobj(obj.ImuMountingAngle);
            strObj.RefMountingAngle = saveobj(obj.RefMountingAngle);
        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.GeneralParams.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.applanix_msgs.GeneralParams;
            obj.reload(strObj);
        end
    end
end