def unpack_transform_msg(msg, stamped=False):
    """ Get translation and rotation from a Transform(Stamped) message. """
    if stamped:
        t = msg.transform.translation
        r = msg.transform.rotation
    else:
        t = msg.translation
        r = msg.rotation

    return (t.x, t.y, t.z), (r.w, r.x, r.y, r.z)