title: How to get ROS MSG length in python?
body: <p>I have a problem that needs to count the length of each ROS topic msg.</p>
  
  <p>I modified rostopic(/opt/ros/smart-ros/lib/python2.7/dist-packages/rostopic / __ init__.py):</p>
  
  <pre><code>Class CallbackEcho(object) -&gt;
  Def callback (self, data, callback_args, current_time = None):
      Print('message length =',sys.getsizeof(data)) #statics msg length
  </code></pre>
  
  <p>But when the message contains a vector or struct list, the length is incorrect.</p>
  
  <p>Please help solve this problem?</p>
  
  <p>Thanks.</p>