function pose = get2DPose(odomMsg)
% GET2DPOSE Helper function that extracts [x y theta] 2D pose 
% from a ROS odometry message.
% Copyright 2018 The MathWorks, Inc.

    % Unwrap position
    position = odomMsg.pose.pose.position;
    x = position.x;
    y = position.y;

    % Unwrap orientation
    orientation = odomMsg.pose.pose.orientation;
    q = [orientation.w, orientation.x, ...
         orientation.y, orientation.z];
    r = quat2eul(q);
    theta = r(1); % Extract Z component
    
    pose = [x, y, theta];

end
