def quat_to_list(quat):
if isinstance(quat, Quaternion):<EOL><INDENT>return [quat.x, quat.y, quat.z, quat.w]<EOL><DEDENT>elif isinstance(quat, ndarray):<EOL><INDENT>return [quat[<NUM_LIT:0>], quat[<NUM_LIT:1>], quat[<NUM_LIT:2>], quat[<NUM_LIT:3>]]<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>".<EOL>format(str(type(quat))))<EOL><DEDENT>
convert a geometry_msgs/Quaternion or numpy.ndarray in list [x, y, z, w]
:param quat:  a geometry_msgs/Quaternion or numpy.ndarray
:return: the corresponding quaternion [x, y, z, w]