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

    classdef GetCartesianPathRequest < robotics.ros.Message
    %GetCartesianPathRequest MATLAB implementation of moveit_msgs/GetCartesianPathRequest
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'moveit_msgs/GetCartesianPathRequest' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = 'b37c16ad7ed838d811a270a8054276b6' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant, Access = protected)
        GeometryMsgsPoseClass = robotics.ros.msg.internal.MessageFactory.getClassForType('geometry_msgs/Pose') % Dispatch to MATLAB class for message type geometry_msgs/Pose
        MoveitMsgsConstraintsClass = robotics.ros.msg.internal.MessageFactory.getClassForType('moveit_msgs/Constraints') % Dispatch to MATLAB class for message type moveit_msgs/Constraints
        MoveitMsgsRobotStateClass = robotics.ros.msg.internal.MessageFactory.getClassForType('moveit_msgs/RobotState') % Dispatch to MATLAB class for message type moveit_msgs/RobotState
        StdMsgsHeaderClass = robotics.ros.msg.internal.MessageFactory.getClassForType('std_msgs/Header') % Dispatch to MATLAB class for message type std_msgs/Header
    end
    
    properties (Dependent)
        Header
        StartState
        GroupName
        LinkName
        MaxStep
        JumpThreshold
        AvoidCollisions
        PathConstraints
        Waypoints
    end
    
    properties (Access = protected)
        Cache = struct('Header', [], 'StartState', [], 'Waypoints', [], 'PathConstraints', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'AvoidCollisions', 'GroupName', 'Header', 'JumpThreshold', 'LinkName', 'MaxStep', 'PathConstraints', 'StartState', 'Waypoints'} % List of non-constant message properties
        ROSPropertyList = {'avoid_collisions', 'group_name', 'header', 'jump_threshold', 'link_name', 'max_step', 'path_constraints', 'start_state', 'waypoints'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = GetCartesianPathRequest(msg)
            %GetCartesianPathRequest Construct the message object GetCartesianPathRequest
            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 header = get.Header(obj)
            %get.Header Get the value for property Header
            if isempty(obj.Cache.Header)
                obj.Cache.Header = feval(obj.StdMsgsHeaderClass, obj.JavaMessage.getHeader);
            end
            header = obj.Cache.Header;
        end
        
        function set.Header(obj, header)
            %set.Header Set the value for property Header
            validateattributes(header, {obj.StdMsgsHeaderClass}, {'nonempty', 'scalar'}, 'GetCartesianPathRequest', 'Header');
            
            obj.JavaMessage.setHeader(header.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Header)
                obj.Cache.Header.setJavaObject(header.getJavaObject);
            end
        end
        
        function startstate = get.StartState(obj)
            %get.StartState Get the value for property StartState
            if isempty(obj.Cache.StartState)
                obj.Cache.StartState = feval(obj.MoveitMsgsRobotStateClass, obj.JavaMessage.getStartState);
            end
            startstate = obj.Cache.StartState;
        end
        
        function set.StartState(obj, startstate)
            %set.StartState Set the value for property StartState
            validateattributes(startstate, {obj.MoveitMsgsRobotStateClass}, {'nonempty', 'scalar'}, 'GetCartesianPathRequest', 'StartState');
            
            obj.JavaMessage.setStartState(startstate.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.StartState)
                obj.Cache.StartState.setJavaObject(startstate.getJavaObject);
            end
        end
        
        function groupname = get.GroupName(obj)
            %get.GroupName Get the value for property GroupName
            groupname = char(obj.JavaMessage.getGroupName);
        end
        
        function set.GroupName(obj, groupname)
            %set.GroupName Set the value for property GroupName
            validateattributes(groupname, {'char'}, {}, 'GetCartesianPathRequest', 'GroupName');
            
            obj.JavaMessage.setGroupName(groupname);
        end
        
        function linkname = get.LinkName(obj)
            %get.LinkName Get the value for property LinkName
            linkname = char(obj.JavaMessage.getLinkName);
        end
        
        function set.LinkName(obj, linkname)
            %set.LinkName Set the value for property LinkName
            validateattributes(linkname, {'char'}, {}, 'GetCartesianPathRequest', 'LinkName');
            
            obj.JavaMessage.setLinkName(linkname);
        end
        
        function maxstep = get.MaxStep(obj)
            %get.MaxStep Get the value for property MaxStep
            maxstep = double(obj.JavaMessage.getMaxStep);
        end
        
        function set.MaxStep(obj, maxstep)
            %set.MaxStep Set the value for property MaxStep
            validateattributes(maxstep, {'numeric'}, {'nonempty', 'scalar'}, 'GetCartesianPathRequest', 'MaxStep');
            
            obj.JavaMessage.setMaxStep(maxstep);
        end
        
        function jumpthreshold = get.JumpThreshold(obj)
            %get.JumpThreshold Get the value for property JumpThreshold
            jumpthreshold = double(obj.JavaMessage.getJumpThreshold);
        end
        
        function set.JumpThreshold(obj, jumpthreshold)
            %set.JumpThreshold Set the value for property JumpThreshold
            validateattributes(jumpthreshold, {'numeric'}, {'nonempty', 'scalar'}, 'GetCartesianPathRequest', 'JumpThreshold');
            
            obj.JavaMessage.setJumpThreshold(jumpthreshold);
        end
        
        function avoidcollisions = get.AvoidCollisions(obj)
            %get.AvoidCollisions Get the value for property AvoidCollisions
            avoidcollisions = logical(obj.JavaMessage.getAvoidCollisions);
        end
        
        function set.AvoidCollisions(obj, avoidcollisions)
            %set.AvoidCollisions Set the value for property AvoidCollisions
            validateattributes(avoidcollisions, {'logical', 'numeric'}, {'nonempty', 'scalar'}, 'GetCartesianPathRequest', 'AvoidCollisions');
            
            obj.JavaMessage.setAvoidCollisions(avoidcollisions);
        end
        
        function pathconstraints = get.PathConstraints(obj)
            %get.PathConstraints Get the value for property PathConstraints
            if isempty(obj.Cache.PathConstraints)
                obj.Cache.PathConstraints = feval(obj.MoveitMsgsConstraintsClass, obj.JavaMessage.getPathConstraints);
            end
            pathconstraints = obj.Cache.PathConstraints;
        end
        
        function set.PathConstraints(obj, pathconstraints)
            %set.PathConstraints Set the value for property PathConstraints
            validateattributes(pathconstraints, {obj.MoveitMsgsConstraintsClass}, {'nonempty', 'scalar'}, 'GetCartesianPathRequest', 'PathConstraints');
            
            obj.JavaMessage.setPathConstraints(pathconstraints.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.PathConstraints)
                obj.Cache.PathConstraints.setJavaObject(pathconstraints.getJavaObject);
            end
        end
        
        function waypoints = get.Waypoints(obj)
            %get.Waypoints Get the value for property Waypoints
            if isempty(obj.Cache.Waypoints)
                javaArray = obj.JavaMessage.getWaypoints;
                array = obj.readJavaArray(javaArray, obj.GeometryMsgsPoseClass);
                obj.Cache.Waypoints = feval(obj.GeometryMsgsPoseClass, array);
            end
            waypoints = obj.Cache.Waypoints;
        end
        
        function set.Waypoints(obj, waypoints)
            %set.Waypoints Set the value for property Waypoints
            if ~isvector(waypoints) && isempty(waypoints)
                % Allow empty [] input
                waypoints = feval([obj.GeometryMsgsPoseClass '.empty'], 0, 1);
            end
            
            validateattributes(waypoints, {obj.GeometryMsgsPoseClass}, {'vector'}, 'GetCartesianPathRequest', 'Waypoints');
            
            javaArray = obj.JavaMessage.getWaypoints;
            array = obj.writeJavaArray(waypoints, javaArray, obj.GeometryMsgsPoseClass);
            obj.JavaMessage.setWaypoints(array);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Waypoints)
                obj.Cache.Waypoints = [];
                obj.Cache.Waypoints = obj.Waypoints;
            end
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.Header = [];
            obj.Cache.StartState = [];
            obj.Cache.Waypoints = [];
            obj.Cache.PathConstraints = [];
        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.GroupName = obj.GroupName;
            cpObj.LinkName = obj.LinkName;
            cpObj.MaxStep = obj.MaxStep;
            cpObj.JumpThreshold = obj.JumpThreshold;
            cpObj.AvoidCollisions = obj.AvoidCollisions;
            
            % Recursively copy compound properties
            cpObj.Header = copy(obj.Header);
            cpObj.StartState = copy(obj.StartState);
            cpObj.PathConstraints = copy(obj.PathConstraints);
            cpObj.Waypoints = copy(obj.Waypoints);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.GroupName = strObj.GroupName;
            obj.LinkName = strObj.LinkName;
            obj.MaxStep = strObj.MaxStep;
            obj.JumpThreshold = strObj.JumpThreshold;
            obj.AvoidCollisions = strObj.AvoidCollisions;
            obj.Header = feval([obj.StdMsgsHeaderClass '.loadobj'], strObj.Header);
            obj.StartState = feval([obj.MoveitMsgsRobotStateClass '.loadobj'], strObj.StartState);
            obj.PathConstraints = feval([obj.MoveitMsgsConstraintsClass '.loadobj'], strObj.PathConstraints);
            WaypointsCell = arrayfun(@(x) feval([obj.GeometryMsgsPoseClass '.loadobj'], x), strObj.Waypoints, 'UniformOutput', false);
            obj.Waypoints = vertcat(WaypointsCell{:});
        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.GroupName = obj.GroupName;
            strObj.LinkName = obj.LinkName;
            strObj.MaxStep = obj.MaxStep;
            strObj.JumpThreshold = obj.JumpThreshold;
            strObj.AvoidCollisions = obj.AvoidCollisions;
            strObj.Header = saveobj(obj.Header);
            strObj.StartState = saveobj(obj.StartState);
            strObj.PathConstraints = saveobj(obj.PathConstraints);
            strObj.Waypoints = arrayfun(@(x) saveobj(x), obj.Waypoints);
        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.moveit_msgs.GetCartesianPathRequest.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.moveit_msgs.GetCartesianPathRequest;
            obj.reload(strObj);
        end
    end
end