www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+sr_robot_msgs/JointMusclePositionControllerState.m
classdef JointMusclePositionControllerState < robotics.ros.Message %JointMusclePositionControllerState MATLAB implementation of sr_robot_msgs/JointMusclePositionControllerState % This class was automatically generated by % robotics.ros.msg.internal.gen.MessageClassGenerator. % Copyright 2014-2016 The MathWorks, Inc. %#ok<*INUSD> properties (Constant) MessageType = 'sr_robot_msgs/JointMusclePositionControllerState' % The ROS message type end properties (Constant, Hidden) MD5Checksum = '5a9f3e4da940842d5d2d35e00e1cd647' % 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 PseudoCommand ValveMuscle0 ValveMuscle1 PackedValve MusclePressure0 MusclePressure1 P I D IClamp end properties (Access = protected) Cache = struct('Header', []) % The cache for fast data access end properties (Constant, Hidden) PropertyList = {'D', 'Error', 'Header', 'I', 'IClamp', 'MusclePressure0', 'MusclePressure1', 'P', 'PackedValve', 'ProcessValue', 'ProcessValueDot', 'PseudoCommand', 'SetPoint', 'TimeStep', 'ValveMuscle0', 'ValveMuscle1'} % List of non-constant message properties ROSPropertyList = {'d', 'error', 'header', 'i', 'i_clamp', 'muscle_pressure_0', 'muscle_pressure_1', 'p', 'packed_valve', 'process_value', 'process_value_dot', 'pseudo_command', 'set_point', 'time_step', 'valve_muscle_0', 'valve_muscle_1'} % List of non-constant ROS message properties end methods function obj = JointMusclePositionControllerState(msg) %JointMusclePositionControllerState Construct the message object JointMusclePositionControllerState 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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', 'TimeStep'); obj.JavaMessage.setTimeStep(timestep); end function pseudocommand = get.PseudoCommand(obj) %get.PseudoCommand Get the value for property PseudoCommand pseudocommand = double(obj.JavaMessage.getPseudoCommand); end function set.PseudoCommand(obj, pseudocommand) %set.PseudoCommand Set the value for property PseudoCommand validateattributes(pseudocommand, {'numeric'}, {'nonempty', 'scalar'}, 'JointMusclePositionControllerState', 'PseudoCommand'); obj.JavaMessage.setPseudoCommand(pseudocommand); end function valvemuscle0 = get.ValveMuscle0(obj) %get.ValveMuscle0 Get the value for property ValveMuscle0 valvemuscle0 = int8(obj.JavaMessage.getValveMuscle0); end function set.ValveMuscle0(obj, valvemuscle0) %set.ValveMuscle0 Set the value for property ValveMuscle0 validateattributes(valvemuscle0, {'numeric'}, {'nonempty', 'scalar'}, 'JointMusclePositionControllerState', 'ValveMuscle0'); obj.JavaMessage.setValveMuscle0(valvemuscle0); end function valvemuscle1 = get.ValveMuscle1(obj) %get.ValveMuscle1 Get the value for property ValveMuscle1 valvemuscle1 = int8(obj.JavaMessage.getValveMuscle1); end function set.ValveMuscle1(obj, valvemuscle1) %set.ValveMuscle1 Set the value for property ValveMuscle1 validateattributes(valvemuscle1, {'numeric'}, {'nonempty', 'scalar'}, 'JointMusclePositionControllerState', 'ValveMuscle1'); obj.JavaMessage.setValveMuscle1(valvemuscle1); end function packedvalve = get.PackedValve(obj) %get.PackedValve Get the value for property PackedValve packedvalve = double(obj.JavaMessage.getPackedValve); end function set.PackedValve(obj, packedvalve) %set.PackedValve Set the value for property PackedValve validateattributes(packedvalve, {'numeric'}, {'nonempty', 'scalar'}, 'JointMusclePositionControllerState', 'PackedValve'); obj.JavaMessage.setPackedValve(packedvalve); end function musclepressure0 = get.MusclePressure0(obj) %get.MusclePressure0 Get the value for property MusclePressure0 musclepressure0 = typecast(int16(obj.JavaMessage.getMusclePressure0), 'uint16'); end function set.MusclePressure0(obj, musclepressure0) %set.MusclePressure0 Set the value for property MusclePressure0 validateattributes(musclepressure0, {'numeric'}, {'nonempty', 'scalar'}, 'JointMusclePositionControllerState', 'MusclePressure0'); obj.JavaMessage.setMusclePressure0(musclepressure0); end function musclepressure1 = get.MusclePressure1(obj) %get.MusclePressure1 Get the value for property MusclePressure1 musclepressure1 = typecast(int16(obj.JavaMessage.getMusclePressure1), 'uint16'); end function set.MusclePressure1(obj, musclepressure1) %set.MusclePressure1 Set the value for property MusclePressure1 validateattributes(musclepressure1, {'numeric'}, {'nonempty', 'scalar'}, 'JointMusclePositionControllerState', 'MusclePressure1'); obj.JavaMessage.setMusclePressure1(musclepressure1); 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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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'}, 'JointMusclePositionControllerState', '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.PseudoCommand = obj.PseudoCommand; cpObj.ValveMuscle0 = obj.ValveMuscle0; cpObj.ValveMuscle1 = obj.ValveMuscle1; cpObj.PackedValve = obj.PackedValve; cpObj.MusclePressure0 = obj.MusclePressure0; cpObj.MusclePressure1 = obj.MusclePressure1; 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.PseudoCommand = strObj.PseudoCommand; obj.ValveMuscle0 = strObj.ValveMuscle0; obj.ValveMuscle1 = strObj.ValveMuscle1; obj.PackedValve = strObj.PackedValve; obj.MusclePressure0 = strObj.MusclePressure0; obj.MusclePressure1 = strObj.MusclePressure1; 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.PseudoCommand = obj.PseudoCommand; strObj.ValveMuscle0 = obj.ValveMuscle0; strObj.ValveMuscle1 = obj.ValveMuscle1; strObj.PackedValve = obj.PackedValve; strObj.MusclePressure0 = obj.MusclePressure0; strObj.MusclePressure1 = obj.MusclePressure1; 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.sr_robot_msgs.JointMusclePositionControllerState.empty(0,1); return end % Create an empty message object obj = robotics.ros.msggen.sr_robot_msgs.JointMusclePositionControllerState; obj.reload(strObj); end end end