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

    classdef PR2GripperFindContactData < robotics.ros.Message
    %PR2GripperFindContactData MATLAB implementation of pr2_gripper_sensor_msgs/PR2GripperFindContactData
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'pr2_gripper_sensor_msgs/PR2GripperFindContactData' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = 'bc53e3dc7d19b896ca9b5ea205d54b91' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant, Access = protected)
        Pr2GripperSensorMsgsPR2GripperSensorRTStateClass = robotics.ros.msg.internal.MessageFactory.getClassForType('pr2_gripper_sensor_msgs/PR2GripperSensorRTState') % Dispatch to MATLAB class for message type pr2_gripper_sensor_msgs/PR2GripperSensorRTState
        TimeClass = robotics.ros.msg.internal.MessageFactory.getClassForType('time') % Dispatch to MATLAB class for message type time
    end
    
    properties (Dependent)
        Stamp
        ContactConditionsMet
        LeftFingertipPadContact
        RightFingertipPadContact
        LeftFingertipPadForce
        RightFingertipPadForce
        JointPosition
        JointEffort
        Rtstate
    end
    
    properties (Access = protected)
        Cache = struct('Stamp', [], 'Rtstate', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'ContactConditionsMet', 'JointEffort', 'JointPosition', 'LeftFingertipPadContact', 'LeftFingertipPadForce', 'RightFingertipPadContact', 'RightFingertipPadForce', 'Rtstate', 'Stamp'} % List of non-constant message properties
        ROSPropertyList = {'contact_conditions_met', 'joint_effort', 'joint_position', 'left_fingertip_pad_contact', 'left_fingertip_pad_force', 'right_fingertip_pad_contact', 'right_fingertip_pad_force', 'rtstate', 'stamp'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = PR2GripperFindContactData(msg)
            %PR2GripperFindContactData Construct the message object PR2GripperFindContactData
            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 stamp = get.Stamp(obj)
            %get.Stamp Get the value for property Stamp
            if isempty(obj.Cache.Stamp)
                obj.Cache.Stamp = feval(obj.TimeClass, obj.JavaMessage.getStamp);
            end
            stamp = obj.Cache.Stamp;
        end
        
        function set.Stamp(obj, stamp)
            %set.Stamp Set the value for property Stamp
            validateattributes(stamp, {obj.TimeClass}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'Stamp');
            
            obj.JavaMessage.setStamp(stamp.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Stamp)
                obj.Cache.Stamp.setJavaObject(stamp.getJavaObject);
            end
        end
        
        function contactconditionsmet = get.ContactConditionsMet(obj)
            %get.ContactConditionsMet Get the value for property ContactConditionsMet
            contactconditionsmet = logical(obj.JavaMessage.getContactConditionsMet);
        end
        
        function set.ContactConditionsMet(obj, contactconditionsmet)
            %set.ContactConditionsMet Set the value for property ContactConditionsMet
            validateattributes(contactconditionsmet, {'logical', 'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'ContactConditionsMet');
            
            obj.JavaMessage.setContactConditionsMet(contactconditionsmet);
        end
        
        function leftfingertippadcontact = get.LeftFingertipPadContact(obj)
            %get.LeftFingertipPadContact Get the value for property LeftFingertipPadContact
            leftfingertippadcontact = logical(obj.JavaMessage.getLeftFingertipPadContact);
        end
        
        function set.LeftFingertipPadContact(obj, leftfingertippadcontact)
            %set.LeftFingertipPadContact Set the value for property LeftFingertipPadContact
            validateattributes(leftfingertippadcontact, {'logical', 'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'LeftFingertipPadContact');
            
            obj.JavaMessage.setLeftFingertipPadContact(leftfingertippadcontact);
        end
        
        function rightfingertippadcontact = get.RightFingertipPadContact(obj)
            %get.RightFingertipPadContact Get the value for property RightFingertipPadContact
            rightfingertippadcontact = logical(obj.JavaMessage.getRightFingertipPadContact);
        end
        
        function set.RightFingertipPadContact(obj, rightfingertippadcontact)
            %set.RightFingertipPadContact Set the value for property RightFingertipPadContact
            validateattributes(rightfingertippadcontact, {'logical', 'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'RightFingertipPadContact');
            
            obj.JavaMessage.setRightFingertipPadContact(rightfingertippadcontact);
        end
        
        function leftfingertippadforce = get.LeftFingertipPadForce(obj)
            %get.LeftFingertipPadForce Get the value for property LeftFingertipPadForce
            leftfingertippadforce = double(obj.JavaMessage.getLeftFingertipPadForce);
        end
        
        function set.LeftFingertipPadForce(obj, leftfingertippadforce)
            %set.LeftFingertipPadForce Set the value for property LeftFingertipPadForce
            validateattributes(leftfingertippadforce, {'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'LeftFingertipPadForce');
            
            obj.JavaMessage.setLeftFingertipPadForce(leftfingertippadforce);
        end
        
        function rightfingertippadforce = get.RightFingertipPadForce(obj)
            %get.RightFingertipPadForce Get the value for property RightFingertipPadForce
            rightfingertippadforce = double(obj.JavaMessage.getRightFingertipPadForce);
        end
        
        function set.RightFingertipPadForce(obj, rightfingertippadforce)
            %set.RightFingertipPadForce Set the value for property RightFingertipPadForce
            validateattributes(rightfingertippadforce, {'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'RightFingertipPadForce');
            
            obj.JavaMessage.setRightFingertipPadForce(rightfingertippadforce);
        end
        
        function jointposition = get.JointPosition(obj)
            %get.JointPosition Get the value for property JointPosition
            jointposition = double(obj.JavaMessage.getJointPosition);
        end
        
        function set.JointPosition(obj, jointposition)
            %set.JointPosition Set the value for property JointPosition
            validateattributes(jointposition, {'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'JointPosition');
            
            obj.JavaMessage.setJointPosition(jointposition);
        end
        
        function jointeffort = get.JointEffort(obj)
            %get.JointEffort Get the value for property JointEffort
            jointeffort = double(obj.JavaMessage.getJointEffort);
        end
        
        function set.JointEffort(obj, jointeffort)
            %set.JointEffort Set the value for property JointEffort
            validateattributes(jointeffort, {'numeric'}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'JointEffort');
            
            obj.JavaMessage.setJointEffort(jointeffort);
        end
        
        function rtstate = get.Rtstate(obj)
            %get.Rtstate Get the value for property Rtstate
            if isempty(obj.Cache.Rtstate)
                obj.Cache.Rtstate = feval(obj.Pr2GripperSensorMsgsPR2GripperSensorRTStateClass, obj.JavaMessage.getRtstate);
            end
            rtstate = obj.Cache.Rtstate;
        end
        
        function set.Rtstate(obj, rtstate)
            %set.Rtstate Set the value for property Rtstate
            validateattributes(rtstate, {obj.Pr2GripperSensorMsgsPR2GripperSensorRTStateClass}, {'nonempty', 'scalar'}, 'PR2GripperFindContactData', 'Rtstate');
            
            obj.JavaMessage.setRtstate(rtstate.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Rtstate)
                obj.Cache.Rtstate.setJavaObject(rtstate.getJavaObject);
            end
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.Stamp = [];
            obj.Cache.Rtstate = [];
        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.ContactConditionsMet = obj.ContactConditionsMet;
            cpObj.LeftFingertipPadContact = obj.LeftFingertipPadContact;
            cpObj.RightFingertipPadContact = obj.RightFingertipPadContact;
            cpObj.LeftFingertipPadForce = obj.LeftFingertipPadForce;
            cpObj.RightFingertipPadForce = obj.RightFingertipPadForce;
            cpObj.JointPosition = obj.JointPosition;
            cpObj.JointEffort = obj.JointEffort;
            
            % Recursively copy compound properties
            cpObj.Stamp = copy(obj.Stamp);
            cpObj.Rtstate = copy(obj.Rtstate);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.ContactConditionsMet = strObj.ContactConditionsMet;
            obj.LeftFingertipPadContact = strObj.LeftFingertipPadContact;
            obj.RightFingertipPadContact = strObj.RightFingertipPadContact;
            obj.LeftFingertipPadForce = strObj.LeftFingertipPadForce;
            obj.RightFingertipPadForce = strObj.RightFingertipPadForce;
            obj.JointPosition = strObj.JointPosition;
            obj.JointEffort = strObj.JointEffort;
            obj.Stamp = feval([obj.TimeClass '.loadobj'], strObj.Stamp);
            obj.Rtstate = feval([obj.Pr2GripperSensorMsgsPR2GripperSensorRTStateClass '.loadobj'], strObj.Rtstate);
        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.ContactConditionsMet = obj.ContactConditionsMet;
            strObj.LeftFingertipPadContact = obj.LeftFingertipPadContact;
            strObj.RightFingertipPadContact = obj.RightFingertipPadContact;
            strObj.LeftFingertipPadForce = obj.LeftFingertipPadForce;
            strObj.RightFingertipPadForce = obj.RightFingertipPadForce;
            strObj.JointPosition = obj.JointPosition;
            strObj.JointEffort = obj.JointEffort;
            strObj.Stamp = saveobj(obj.Stamp);
            strObj.Rtstate = saveobj(obj.Rtstate);
        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.pr2_gripper_sensor_msgs.PR2GripperFindContactData.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.pr2_gripper_sensor_msgs.PR2GripperFindContactData;
            obj.reload(strObj);
        end
    end
end