www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+pr2_controllers_msgs/JointControllerState.m
classdef JointControllerState < robotics.ros.Message %JointControllerState MATLAB implementation of pr2_controllers_msgs/JointControllerState % This class was automatically generated by % robotics.ros.msg.internal.gen.MessageClassGenerator. % Copyright 2014-2016 The MathWorks, Inc. %#ok<*INUSD> properties (Constant) MessageType = 'pr2_controllers_msgs/JointControllerState' % The ROS message type end properties (Constant, Hidden) MD5Checksum = 'c0d034a7bf20aeb1c37f3eccb7992b69' % The MD5 Checksum of the message definition end properties (Access = protected) JavaMessage % The Java message object end properties (Constant, Access = protected) StdMsgsHeaderClass = robotics.ros.msg.internal.MessageFactory.getClassForType('std_msgs/Header') % Dispatch to MATLAB class for message type std_msgs/Header end properties (Dependent) Header SetPoint ProcessValue ProcessValueDot Error TimeStep Command P I D IClamp end properties (Access = protected) Cache = struct('Header', []) % The cache for fast data access end properties (Constant, Hidden) PropertyList = {'Command', 'D', 'Error', 'Header', 'I', 'IClamp', 'P', 'ProcessValue', 'ProcessValueDot', 'SetPoint', 'TimeStep'} % List of non-constant message properties ROSPropertyList = {'command', 'd', 'error', 'header', 'i', 'i_clamp', 'p', 'process_value', 'process_value_dot', 'set_point', 'time_step'} % List of non-constant ROS message properties end methods function obj = JointControllerState(msg) %JointControllerState Construct the message object JointControllerState 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'}, 'JointControllerState', 'Header'); obj.JavaMessage.setHeader(header.getJavaObject); % Update cache if necessary if ~isempty(obj.Cache.Header) obj.Cache.Header.setJavaObject(header.getJavaObject); end end function setpoint = get.SetPoint(obj) %get.SetPoint Get the value for property SetPoint setpoint = double(obj.JavaMessage.getSetPoint); end function set.SetPoint(obj, setpoint) %set.SetPoint Set the value for property SetPoint validateattributes(setpoint, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'SetPoint'); obj.JavaMessage.setSetPoint(setpoint); end function processvalue = get.ProcessValue(obj) %get.ProcessValue Get the value for property ProcessValue processvalue = double(obj.JavaMessage.getProcessValue); end function set.ProcessValue(obj, processvalue) %set.ProcessValue Set the value for property ProcessValue validateattributes(processvalue, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'ProcessValue'); obj.JavaMessage.setProcessValue(processvalue); end function processvaluedot = get.ProcessValueDot(obj) %get.ProcessValueDot Get the value for property ProcessValueDot processvaluedot = double(obj.JavaMessage.getProcessValueDot); end function set.ProcessValueDot(obj, processvaluedot) %set.ProcessValueDot Set the value for property ProcessValueDot validateattributes(processvaluedot, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'ProcessValueDot'); obj.JavaMessage.setProcessValueDot(processvaluedot); end function error = get.Error(obj) %get.Error Get the value for property Error error = double(obj.JavaMessage.getError); end function set.Error(obj, error) %set.Error Set the value for property Error validateattributes(error, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'Error'); obj.JavaMessage.setError(error); end function timestep = get.TimeStep(obj) %get.TimeStep Get the value for property TimeStep timestep = double(obj.JavaMessage.getTimeStep); end function set.TimeStep(obj, timestep) %set.TimeStep Set the value for property TimeStep validateattributes(timestep, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'TimeStep'); obj.JavaMessage.setTimeStep(timestep); end function command = get.Command(obj) %get.Command Get the value for property Command command = double(obj.JavaMessage.getCommand); end function set.Command(obj, command) %set.Command Set the value for property Command validateattributes(command, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'Command'); obj.JavaMessage.setCommand(command); end function p = get.P(obj) %get.P Get the value for property P p = double(obj.JavaMessage.getP); end function set.P(obj, p) %set.P Set the value for property P validateattributes(p, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'P'); obj.JavaMessage.setP(p); end function i = get.I(obj) %get.I Get the value for property I i = double(obj.JavaMessage.getI); end function set.I(obj, i) %set.I Set the value for property I validateattributes(i, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'I'); obj.JavaMessage.setI(i); end function d = get.D(obj) %get.D Get the value for property D d = double(obj.JavaMessage.getD); end function set.D(obj, d) %set.D Set the value for property D validateattributes(d, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'D'); obj.JavaMessage.setD(d); end function iclamp = get.IClamp(obj) %get.IClamp Get the value for property IClamp iclamp = double(obj.JavaMessage.getIClamp); end function set.IClamp(obj, iclamp) %set.IClamp Set the value for property IClamp validateattributes(iclamp, {'numeric'}, {'nonempty', 'scalar'}, 'JointControllerState', 'IClamp'); obj.JavaMessage.setIClamp(iclamp); end end methods (Access = protected) function resetCache(obj) %resetCache Resets any cached properties obj.Cache.Header = []; 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.SetPoint = obj.SetPoint; cpObj.ProcessValue = obj.ProcessValue; cpObj.ProcessValueDot = obj.ProcessValueDot; cpObj.Error = obj.Error; cpObj.TimeStep = obj.TimeStep; cpObj.Command = obj.Command; cpObj.P = obj.P; cpObj.I = obj.I; cpObj.D = obj.D; cpObj.IClamp = obj.IClamp; % Recursively copy compound properties cpObj.Header = copy(obj.Header); end function reload(obj, strObj) %reload Called by loadobj to assign properties obj.SetPoint = strObj.SetPoint; obj.ProcessValue = strObj.ProcessValue; obj.ProcessValueDot = strObj.ProcessValueDot; obj.Error = strObj.Error; obj.TimeStep = strObj.TimeStep; obj.Command = strObj.Command; obj.P = strObj.P; obj.I = strObj.I; obj.D = strObj.D; obj.IClamp = strObj.IClamp; obj.Header = feval([obj.StdMsgsHeaderClass '.loadobj'], strObj.Header); 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.SetPoint = obj.SetPoint; strObj.ProcessValue = obj.ProcessValue; strObj.ProcessValueDot = obj.ProcessValueDot; strObj.Error = obj.Error; strObj.TimeStep = obj.TimeStep; strObj.Command = obj.Command; strObj.P = obj.P; strObj.I = obj.I; strObj.D = obj.D; strObj.IClamp = obj.IClamp; strObj.Header = saveobj(obj.Header); 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_controllers_msgs.JointControllerState.empty(0,1); return end % Create an empty message object obj = robotics.ros.msggen.pr2_controllers_msgs.JointControllerState; obj.reload(strObj); end end end