www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+mavros/CommandLongRequest.m
classdef CommandLongRequest < robotics.ros.Message %CommandLongRequest MATLAB implementation of mavros/CommandLongRequest % This class was automatically generated by % robotics.ros.msg.internal.gen.MessageClassGenerator. % Copyright 2014-2016 The MathWorks, Inc. %#ok<*INUSD> properties (Constant) MessageType = 'mavros/CommandLongRequest' % The ROS message type end properties (Constant, Hidden) MD5Checksum = '5972d4d8225f9d160bb683f0834762b4' % The MD5 Checksum of the message definition end properties (Access = protected) JavaMessage % The Java message object end properties (Constant) CMDDOSETMODE = uint16(176) CMDDOJUMP = uint16(177) CMDDOCHANGESPEED = uint16(178) CMDDOSETHOME = uint16(179) CMDDOSETRELAY = uint16(181) CMDDOREPEATRELAY = uint16(182) CMDDOSETSERVO = uint16(183) CMDDOREPEATSERVO = uint16(184) CMDDOCONTROLVIDEO = uint16(200) CMDDOSETROI = uint16(201) CMDDOMOUNTCONTROL = uint16(205) CMDDOSETCAMTRIGGDIST = uint16(206) CMDDOFENCEENABLE = uint16(207) CMDDOPARACHUTE = uint16(208) CMDDOINVERTEDFLOGHT = uint16(210) CMDDOMOUNTCONTROLQUAT = uint16(220) CMDPREFLIGHTCALIBRATION = uint16(241) CMDMISSIONSTART = uint16(300) CMDCOMPONENTARMDISARM = uint16(400) CMDSTARTRXPAIR = uint16(500) end properties (Dependent) Command Confirmation Param1 Param2 Param3 Param4 Param5 Param6 Param7 end properties (Constant, Hidden) PropertyList = {'Command', 'Confirmation', 'Param1', 'Param2', 'Param3', 'Param4', 'Param5', 'Param6', 'Param7'} % List of non-constant message properties ROSPropertyList = {'command', 'confirmation', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7'} % List of non-constant ROS message properties end methods function obj = CommandLongRequest(msg) %CommandLongRequest Construct the message object CommandLongRequest 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 command = get.Command(obj) %get.Command Get the value for property Command command = typecast(int16(obj.JavaMessage.getCommand), 'uint16'); end function set.Command(obj, command) %set.Command Set the value for property Command validateattributes(command, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Command'); obj.JavaMessage.setCommand(command); end function confirmation = get.Confirmation(obj) %get.Confirmation Get the value for property Confirmation confirmation = typecast(int8(obj.JavaMessage.getConfirmation), 'uint8'); end function set.Confirmation(obj, confirmation) %set.Confirmation Set the value for property Confirmation validateattributes(confirmation, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Confirmation'); obj.JavaMessage.setConfirmation(confirmation); end function param1 = get.Param1(obj) %get.Param1 Get the value for property Param1 param1 = single(obj.JavaMessage.getParam1); end function set.Param1(obj, param1) %set.Param1 Set the value for property Param1 validateattributes(param1, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param1'); obj.JavaMessage.setParam1(param1); end function param2 = get.Param2(obj) %get.Param2 Get the value for property Param2 param2 = single(obj.JavaMessage.getParam2); end function set.Param2(obj, param2) %set.Param2 Set the value for property Param2 validateattributes(param2, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param2'); obj.JavaMessage.setParam2(param2); end function param3 = get.Param3(obj) %get.Param3 Get the value for property Param3 param3 = single(obj.JavaMessage.getParam3); end function set.Param3(obj, param3) %set.Param3 Set the value for property Param3 validateattributes(param3, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param3'); obj.JavaMessage.setParam3(param3); end function param4 = get.Param4(obj) %get.Param4 Get the value for property Param4 param4 = single(obj.JavaMessage.getParam4); end function set.Param4(obj, param4) %set.Param4 Set the value for property Param4 validateattributes(param4, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param4'); obj.JavaMessage.setParam4(param4); end function param5 = get.Param5(obj) %get.Param5 Get the value for property Param5 param5 = single(obj.JavaMessage.getParam5); end function set.Param5(obj, param5) %set.Param5 Set the value for property Param5 validateattributes(param5, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param5'); obj.JavaMessage.setParam5(param5); end function param6 = get.Param6(obj) %get.Param6 Get the value for property Param6 param6 = single(obj.JavaMessage.getParam6); end function set.Param6(obj, param6) %set.Param6 Set the value for property Param6 validateattributes(param6, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param6'); obj.JavaMessage.setParam6(param6); end function param7 = get.Param7(obj) %get.Param7 Get the value for property Param7 param7 = single(obj.JavaMessage.getParam7); end function set.Param7(obj, param7) %set.Param7 Set the value for property Param7 validateattributes(param7, {'numeric'}, {'nonempty', 'scalar'}, 'CommandLongRequest', 'Param7'); obj.JavaMessage.setParam7(param7); end end methods (Access = protected) function cpObj = copyElement(obj) %copyElement Implements deep copy behavior for message % Call default copy method for shallow copy cpObj = copyElement@robotics.ros.Message(obj); % Create a new Java message object cpObj.JavaMessage = obj.createNewJavaMessage; % Iterate over all primitive properties cpObj.Command = obj.Command; cpObj.Confirmation = obj.Confirmation; cpObj.Param1 = obj.Param1; cpObj.Param2 = obj.Param2; cpObj.Param3 = obj.Param3; cpObj.Param4 = obj.Param4; cpObj.Param5 = obj.Param5; cpObj.Param6 = obj.Param6; cpObj.Param7 = obj.Param7; end function reload(obj, strObj) %reload Called by loadobj to assign properties obj.Command = strObj.Command; obj.Confirmation = strObj.Confirmation; obj.Param1 = strObj.Param1; obj.Param2 = strObj.Param2; obj.Param3 = strObj.Param3; obj.Param4 = strObj.Param4; obj.Param5 = strObj.Param5; obj.Param6 = strObj.Param6; obj.Param7 = strObj.Param7; 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.Command = obj.Command; strObj.Confirmation = obj.Confirmation; strObj.Param1 = obj.Param1; strObj.Param2 = obj.Param2; strObj.Param3 = obj.Param3; strObj.Param4 = obj.Param4; strObj.Param5 = obj.Param5; strObj.Param6 = obj.Param6; strObj.Param7 = obj.Param7; 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.mavros.CommandLongRequest.empty(0,1); return end % Create an empty message object obj = robotics.ros.msggen.mavros.CommandLongRequest; obj.reload(strObj); end end end