www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+gazebo_msgs/GetPhysicsPropertiesResponse.m
classdef GetPhysicsPropertiesResponse < robotics.ros.Message %GetPhysicsPropertiesResponse MATLAB implementation of gazebo_msgs/GetPhysicsPropertiesResponse % This class was automatically generated by % robotics.ros.msg.internal.gen.MessageClassGenerator. % Copyright 2014-2016 The MathWorks, Inc. %#ok<*INUSD> properties (Constant) MessageType = 'gazebo_msgs/GetPhysicsPropertiesResponse' % The ROS message type end properties (Constant, Hidden) MD5Checksum = '575a5e74786981b7df2e3afc567693a6' % The MD5 Checksum of the message definition end properties (Access = protected) JavaMessage % The Java message object end properties (Constant, Access = protected) GazeboMsgsODEPhysicsClass = robotics.ros.msg.internal.MessageFactory.getClassForType('gazebo_msgs/ODEPhysics') % Dispatch to MATLAB class for message type gazebo_msgs/ODEPhysics GeometryMsgsVector3Class = robotics.ros.msg.internal.MessageFactory.getClassForType('geometry_msgs/Vector3') % Dispatch to MATLAB class for message type geometry_msgs/Vector3 end properties (Dependent) TimeStep Pause MaxUpdateRate Gravity OdeConfig Success StatusMessage end properties (Access = protected) Cache = struct('Gravity', [], 'OdeConfig', []) % The cache for fast data access end properties (Constant, Hidden) PropertyList = {'Gravity', 'MaxUpdateRate', 'OdeConfig', 'Pause', 'StatusMessage', 'Success', 'TimeStep'} % List of non-constant message properties ROSPropertyList = {'gravity', 'max_update_rate', 'ode_config', 'pause', 'status_message', 'success', 'time_step'} % List of non-constant ROS message properties end methods function obj = GetPhysicsPropertiesResponse(msg) %GetPhysicsPropertiesResponse Construct the message object GetPhysicsPropertiesResponse 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 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'}, 'GetPhysicsPropertiesResponse', 'TimeStep'); obj.JavaMessage.setTimeStep(timestep); end function pause = get.Pause(obj) %get.Pause Get the value for property Pause pause = logical(obj.JavaMessage.getPause); end function set.Pause(obj, pause) %set.Pause Set the value for property Pause validateattributes(pause, {'logical', 'numeric'}, {'nonempty', 'scalar'}, 'GetPhysicsPropertiesResponse', 'Pause'); obj.JavaMessage.setPause(pause); end function maxupdaterate = get.MaxUpdateRate(obj) %get.MaxUpdateRate Get the value for property MaxUpdateRate maxupdaterate = double(obj.JavaMessage.getMaxUpdateRate); end function set.MaxUpdateRate(obj, maxupdaterate) %set.MaxUpdateRate Set the value for property MaxUpdateRate validateattributes(maxupdaterate, {'numeric'}, {'nonempty', 'scalar'}, 'GetPhysicsPropertiesResponse', 'MaxUpdateRate'); obj.JavaMessage.setMaxUpdateRate(maxupdaterate); end function gravity = get.Gravity(obj) %get.Gravity Get the value for property Gravity if isempty(obj.Cache.Gravity) obj.Cache.Gravity = feval(obj.GeometryMsgsVector3Class, obj.JavaMessage.getGravity); end gravity = obj.Cache.Gravity; end function set.Gravity(obj, gravity) %set.Gravity Set the value for property Gravity validateattributes(gravity, {obj.GeometryMsgsVector3Class}, {'nonempty', 'scalar'}, 'GetPhysicsPropertiesResponse', 'Gravity'); obj.JavaMessage.setGravity(gravity.getJavaObject); % Update cache if necessary if ~isempty(obj.Cache.Gravity) obj.Cache.Gravity.setJavaObject(gravity.getJavaObject); end end function odeconfig = get.OdeConfig(obj) %get.OdeConfig Get the value for property OdeConfig if isempty(obj.Cache.OdeConfig) obj.Cache.OdeConfig = feval(obj.GazeboMsgsODEPhysicsClass, obj.JavaMessage.getOdeConfig); end odeconfig = obj.Cache.OdeConfig; end function set.OdeConfig(obj, odeconfig) %set.OdeConfig Set the value for property OdeConfig validateattributes(odeconfig, {obj.GazeboMsgsODEPhysicsClass}, {'nonempty', 'scalar'}, 'GetPhysicsPropertiesResponse', 'OdeConfig'); obj.JavaMessage.setOdeConfig(odeconfig.getJavaObject); % Update cache if necessary if ~isempty(obj.Cache.OdeConfig) obj.Cache.OdeConfig.setJavaObject(odeconfig.getJavaObject); end end function success = get.Success(obj) %get.Success Get the value for property Success success = logical(obj.JavaMessage.getSuccess); end function set.Success(obj, success) %set.Success Set the value for property Success validateattributes(success, {'logical', 'numeric'}, {'nonempty', 'scalar'}, 'GetPhysicsPropertiesResponse', 'Success'); obj.JavaMessage.setSuccess(success); end function statusmessage = get.StatusMessage(obj) %get.StatusMessage Get the value for property StatusMessage statusmessage = char(obj.JavaMessage.getStatusMessage); end function set.StatusMessage(obj, statusmessage) %set.StatusMessage Set the value for property StatusMessage validateattributes(statusmessage, {'char'}, {}, 'GetPhysicsPropertiesResponse', 'StatusMessage'); obj.JavaMessage.setStatusMessage(statusmessage); end end methods (Access = protected) function resetCache(obj) %resetCache Resets any cached properties obj.Cache.Gravity = []; obj.Cache.OdeConfig = []; 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.TimeStep = obj.TimeStep; cpObj.Pause = obj.Pause; cpObj.MaxUpdateRate = obj.MaxUpdateRate; cpObj.Success = obj.Success; cpObj.StatusMessage = obj.StatusMessage; % Recursively copy compound properties cpObj.Gravity = copy(obj.Gravity); cpObj.OdeConfig = copy(obj.OdeConfig); end function reload(obj, strObj) %reload Called by loadobj to assign properties obj.TimeStep = strObj.TimeStep; obj.Pause = strObj.Pause; obj.MaxUpdateRate = strObj.MaxUpdateRate; obj.Success = strObj.Success; obj.StatusMessage = strObj.StatusMessage; obj.Gravity = feval([obj.GeometryMsgsVector3Class '.loadobj'], strObj.Gravity); obj.OdeConfig = feval([obj.GazeboMsgsODEPhysicsClass '.loadobj'], strObj.OdeConfig); 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.TimeStep = obj.TimeStep; strObj.Pause = obj.Pause; strObj.MaxUpdateRate = obj.MaxUpdateRate; strObj.Success = obj.Success; strObj.StatusMessage = obj.StatusMessage; strObj.Gravity = saveobj(obj.Gravity); strObj.OdeConfig = saveobj(obj.OdeConfig); 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.gazebo_msgs.GetPhysicsPropertiesResponse.empty(0,1); return end % Create an empty message object obj = robotics.ros.msggen.gazebo_msgs.GetPhysicsPropertiesResponse; obj.reload(strObj); end end end