Source code for panda_gazebo.srv._GetControlledJoints

# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from panda_gazebo/GetControlledJointsRequest.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct


[docs]class GetControlledJointsRequest(genpy.Message): _md5sum = "0ea89702d7e871352a5cee1adef402fd" _type = "panda_gazebo/GetControlledJointsRequest" _has_header = False # flag to mark the presence of a Header object _full_text = """# Service that can be used to retrieve the joints that are controlled for a given # control type. string control_type """ __slots__ = ['control_type'] _slot_types = ['string'] def __init__(self, *args, **kwds): """ Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: control_type :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields. """ if args or kwds: super(GetControlledJointsRequest, self).__init__(*args, **kwds) # message fields cannot be None, assign default values for those that are if self.control_type is None: self.control_type = '' else: self.control_type = '' def _get_types(self): """ internal API method """ return self._slot_types
[docs] def serialize(self, buff): """ serialize message into buffer :param buff: buffer, ``StringIO`` """ try: _x = self.control_type length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
[docs] def deserialize(self, str): """ unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str`` """ if python3: codecs.lookup_error("rosmsg").msg_type = self._type try: end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.control_type = str[start:end].decode('utf-8', 'rosmsg') else: self.control_type = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill
[docs] def serialize_numpy(self, buff, numpy): """ serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module """ try: _x = self.control_type length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
[docs] def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ if python3: codecs.lookup_error("rosmsg").msg_type = self._type try: end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.control_type = str[start:end].decode('utf-8', 'rosmsg') else: self.control_type = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill
_struct_I = genpy.struct_I def _get_struct_I(): global _struct_I return _struct_I # This Python file uses the following encoding: utf-8 """autogenerated by genpy from panda_gazebo/GetControlledJointsResponse.msg. Do not edit.""" import codecs import sys
[docs]python3 = True if sys.hexversion > 0x03000000 else False
import genpy import struct
[docs]class GetControlledJointsResponse(genpy.Message): _md5sum = "de338cfffbebe92f5e336e5f98b28598" _type = "panda_gazebo/GetControlledJointsResponse" _has_header = False # flag to mark the presence of a Header object _full_text = """string[] controlled_joints string[] controlled_joints_arm string[] controlled_joints_hand bool success string message """ __slots__ = ['controlled_joints','controlled_joints_arm','controlled_joints_hand','success','message'] _slot_types = ['string[]','string[]','string[]','bool','string'] def __init__(self, *args, **kwds): """ Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: controlled_joints,controlled_joints_arm,controlled_joints_hand,success,message :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields. """ if args or kwds: super(GetControlledJointsResponse, self).__init__(*args, **kwds) # message fields cannot be None, assign default values for those that are if self.controlled_joints is None: self.controlled_joints = [] if self.controlled_joints_arm is None: self.controlled_joints_arm = [] if self.controlled_joints_hand is None: self.controlled_joints_hand = [] if self.success is None: self.success = False if self.message is None: self.message = '' else: self.controlled_joints = [] self.controlled_joints_arm = [] self.controlled_joints_hand = [] self.success = False self.message = '' def _get_types(self): """ internal API method """ return self._slot_types
[docs] def serialize(self, buff): """ serialize message into buffer :param buff: buffer, ``StringIO`` """ try: length = len(self.controlled_joints) buff.write(_struct_I.pack(length)) for val1 in self.controlled_joints: length = len(val1) if python3 or type(val1) == unicode: val1 = val1.encode('utf-8') length = len(val1) buff.write(struct.Struct('<I%ss'%length).pack(length, val1)) length = len(self.controlled_joints_arm) buff.write(_struct_I.pack(length)) for val1 in self.controlled_joints_arm: length = len(val1) if python3 or type(val1) == unicode: val1 = val1.encode('utf-8') length = len(val1) buff.write(struct.Struct('<I%ss'%length).pack(length, val1)) length = len(self.controlled_joints_hand) buff.write(_struct_I.pack(length)) for val1 in self.controlled_joints_hand: length = len(val1) if python3 or type(val1) == unicode: val1 = val1.encode('utf-8') length = len(val1) buff.write(struct.Struct('<I%ss'%length).pack(length, val1)) _x = self.success buff.write(_get_struct_B().pack(_x)) _x = self.message length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
[docs] def deserialize(self, str): """ unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str`` """ if python3: codecs.lookup_error("rosmsg").msg_type = self._type try: end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) self.controlled_joints = [] for i in range(0, length): start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: val1 = str[start:end].decode('utf-8', 'rosmsg') else: val1 = str[start:end] self.controlled_joints.append(val1) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) self.controlled_joints_arm = [] for i in range(0, length): start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: val1 = str[start:end].decode('utf-8', 'rosmsg') else: val1 = str[start:end] self.controlled_joints_arm.append(val1) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) self.controlled_joints_hand = [] for i in range(0, length): start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: val1 = str[start:end].decode('utf-8', 'rosmsg') else: val1 = str[start:end] self.controlled_joints_hand.append(val1) start = end end += 1 (self.success,) = _get_struct_B().unpack(str[start:end]) self.success = bool(self.success) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.message = str[start:end].decode('utf-8', 'rosmsg') else: self.message = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill
[docs] def serialize_numpy(self, buff, numpy): """ serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module """ try: length = len(self.controlled_joints) buff.write(_struct_I.pack(length)) for val1 in self.controlled_joints: length = len(val1) if python3 or type(val1) == unicode: val1 = val1.encode('utf-8') length = len(val1) buff.write(struct.Struct('<I%ss'%length).pack(length, val1)) length = len(self.controlled_joints_arm) buff.write(_struct_I.pack(length)) for val1 in self.controlled_joints_arm: length = len(val1) if python3 or type(val1) == unicode: val1 = val1.encode('utf-8') length = len(val1) buff.write(struct.Struct('<I%ss'%length).pack(length, val1)) length = len(self.controlled_joints_hand) buff.write(_struct_I.pack(length)) for val1 in self.controlled_joints_hand: length = len(val1) if python3 or type(val1) == unicode: val1 = val1.encode('utf-8') length = len(val1) buff.write(struct.Struct('<I%ss'%length).pack(length, val1)) _x = self.success buff.write(_get_struct_B().pack(_x)) _x = self.message length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.Struct('<I%ss'%length).pack(length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
[docs] def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ if python3: codecs.lookup_error("rosmsg").msg_type = self._type try: end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) self.controlled_joints = [] for i in range(0, length): start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: val1 = str[start:end].decode('utf-8', 'rosmsg') else: val1 = str[start:end] self.controlled_joints.append(val1) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) self.controlled_joints_arm = [] for i in range(0, length): start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: val1 = str[start:end].decode('utf-8', 'rosmsg') else: val1 = str[start:end] self.controlled_joints_arm.append(val1) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) self.controlled_joints_hand = [] for i in range(0, length): start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: val1 = str[start:end].decode('utf-8', 'rosmsg') else: val1 = str[start:end] self.controlled_joints_hand.append(val1) start = end end += 1 (self.success,) = _get_struct_B().unpack(str[start:end]) self.success = bool(self.success) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.message = str[start:end].decode('utf-8', 'rosmsg') else: self.message = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) # most likely buffer underfill
_struct_I = genpy.struct_I def _get_struct_I(): global _struct_I return _struct_I _struct_B = None def _get_struct_B(): global _struct_B if _struct_B is None: _struct_B = struct.Struct("<B") return _struct_B
[docs]class GetControlledJoints(object): _type = 'panda_gazebo/GetControlledJoints' _md5sum = 'c0fa937e297125af5ab96e86caa683cd' _request_class = GetControlledJointsRequest _response_class = GetControlledJointsResponse