def unpack_twist_msg(msg, stamped=False):
    """ Get linear and angular velocity from a Twist(Stamped) message. """
    if stamped:
        v = msg.twist.linear
        w = msg.twist.angular
    else:
        v = msg.linear
        w = msg.angular

    return (v.x, v.y, v.z), (w.x, w.y, w.z)