function exampleHelperROS2PlotOdom(msg,hAxes,linespec)
%exampleHelperROS2PlotOdom Subscriber callback function for odometry data
%   exampleHelperROS2PlotOdom(MESSAGE,AXES,LINESPEC) returns no arguments.
%   Instead it plots the position of the robot, using the provided marker,
%   and noting the timestamp of the message next to the position.
%
%   See also ManageQualityOfServicePoliciesInROS2Example.

%   Copyright 2019 The MathWorks, Inc.

% Set up axes
hold(hAxes,"on")

% Plot the robot position
msgTimestamp = double(msg.header.stamp.sec)+...
    double(msg.header.stamp.nanosec)*1e-9;
plot(hAxes,msg.pose.pose.position.x,msg.pose.pose.position.y,linespec)
text(hAxes,msg.pose.pose.position.x,msg.pose.pose.position.y,sprintf(" %.0d",msgTimestamp))
end