_JointMuscleValveControllerCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/JointMuscleValveControllerCommand.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class JointMuscleValveControllerCommand(genpy.Message):
00009   _md5sum = "1a35a9f185150fc2bca2640471eeb55f"
00010   _type = "sr_robot_msgs/JointMuscleValveControllerCommand"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# This command will allow the user to specify a separate command for each of the two muscles that control the joint.
00013 # The user will also specify a duration in ms for that command. During this duration the command will be sent to the hand
00014 # every ms. 
00015 # Once this duration period has elapsed, a command of 0 will be sent to the muscle (meaning both the filling and emptying valves for that 
00016 # muscle remain closed), until a new command is received
00017 # A duration of 0 means that there is no timeout, so the valve command will be sent to the muscle until a different valve command is received.
00018 # BE CAREFUL WHEN USING A DURATION OF 0 AS THIS COULD EVENTUALLY DAMAGE THE MUSCLE
00019 
00020 # Allowed values for the cmd_valve_muscle are integers from -4 to +4.
00021 # +4 the filling valve is open during a full ms cycle. Emptying valve is closed
00022 # +3 the filling valve is open during 0.75 ms and closed during 0.25 ms in a 1 ms cycle. Emptying valve is closed
00023 # +2 the filling valve is open during 0.5 ms and closed during 0.5 ms in a 1 ms cycle. Emptying valve is closed
00024 # +1 the filling valve is open during 0.25 ms and closed during 0.75 ms in a 1 ms cycle. Emptying valve is closed
00025 # 0 both valves (filling and emptying) remain closed in a 1 ms cycle
00026 # ...
00027 # -3 the emptying valve is open during 0.75 ms and closed during 0.25 ms in a 1 ms cycle. Filling valve is closed
00028 # -4 the emptying valve is open during a full ms cycle. Filling valve is closed
00029 
00030 int8[2] cmd_valve_muscle
00031 uint64[2] cmd_duration_ms
00032 
00033 
00034 
00035 
00036 """
00037   __slots__ = ['cmd_valve_muscle','cmd_duration_ms']
00038   _slot_types = ['int8[2]','uint64[2]']
00039 
00040   def __init__(self, *args, **kwds):
00041     """
00042     Constructor. Any message fields that are implicitly/explicitly
00043     set to None will be assigned a default value. The recommend
00044     use is keyword arguments as this is more robust to future message
00045     changes.  You cannot mix in-order arguments and keyword arguments.
00046 
00047     The available fields are:
00048        cmd_valve_muscle,cmd_duration_ms
00049 
00050     :param args: complete set of field values, in .msg order
00051     :param kwds: use keyword arguments corresponding to message field names
00052     to set specific fields.
00053     """
00054     if args or kwds:
00055       super(JointMuscleValveControllerCommand, self).__init__(*args, **kwds)
00056       #message fields cannot be None, assign default values for those that are
00057       if self.cmd_valve_muscle is None:
00058         self.cmd_valve_muscle = [0,0]
00059       if self.cmd_duration_ms is None:
00060         self.cmd_duration_ms = [0,0]
00061     else:
00062       self.cmd_valve_muscle = [0,0]
00063       self.cmd_duration_ms = [0,0]
00064 
00065   def _get_types(self):
00066     """
00067     internal API method
00068     """
00069     return self._slot_types
00070 
00071   def serialize(self, buff):
00072     """
00073     serialize message into buffer
00074     :param buff: buffer, ``StringIO``
00075     """
00076     try:
00077       buff.write(_struct_2b.pack(*self.cmd_valve_muscle))
00078       buff.write(_struct_2Q.pack(*self.cmd_duration_ms))
00079     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00080     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00081 
00082   def deserialize(self, str):
00083     """
00084     unpack serialized message in str into this message instance
00085     :param str: byte array of serialized message, ``str``
00086     """
00087     try:
00088       end = 0
00089       start = end
00090       end += 2
00091       self.cmd_valve_muscle = _struct_2b.unpack(str[start:end])
00092       start = end
00093       end += 16
00094       self.cmd_duration_ms = _struct_2Q.unpack(str[start:end])
00095       return self
00096     except struct.error as e:
00097       raise genpy.DeserializationError(e) #most likely buffer underfill
00098 
00099 
00100   def serialize_numpy(self, buff, numpy):
00101     """
00102     serialize message with numpy array types into buffer
00103     :param buff: buffer, ``StringIO``
00104     :param numpy: numpy python module
00105     """
00106     try:
00107       buff.write(self.cmd_valve_muscle.tostring())
00108       buff.write(self.cmd_duration_ms.tostring())
00109     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00110     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00111 
00112   def deserialize_numpy(self, str, numpy):
00113     """
00114     unpack serialized message in str into this message instance using numpy for array types
00115     :param str: byte array of serialized message, ``str``
00116     :param numpy: numpy python module
00117     """
00118     try:
00119       end = 0
00120       start = end
00121       end += 2
00122       self.cmd_valve_muscle = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=2)
00123       start = end
00124       end += 16
00125       self.cmd_duration_ms = numpy.frombuffer(str[start:end], dtype=numpy.uint64, count=2)
00126       return self
00127     except struct.error as e:
00128       raise genpy.DeserializationError(e) #most likely buffer underfill
00129 
00130 _struct_I = genpy.struct_I
00131 _struct_2Q = struct.Struct("<2Q")
00132 _struct_2b = struct.Struct("<2b")


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Mon Oct 6 2014 07:40:06