Plotting Covariance from poseWithCo​varianceSt​amped message

조회 수: 15 (최근 30일)
Lasse Goncz
Lasse Goncz 2020년 3월 4일
댓글: LinuxPen 2022년 10월 18일
I have recorded a bagfile and am trying to plot the /amcl_pose/pose/covariance matrix which has a message type geometry_msgs/PoseWithCovarianceStamped. I followed this tutorial on plotting data from topics, however, when i try the below code i get the error The Pose.covariance property does not exist for message type geometry_msgs/PoseWithCovarianceStamped. What am I doing wrong?
bagselect = select(bag, 'Topic', '/amcl_pose');
msgs = readMessages(bagselect);
ts = timeseries(bagselect, 'Pose.Covariance');

답변 (1개)

Cam Salzberger
Cam Salzberger 2020년 5월 1일
Hello Lasse,
I know this is a bit late to be responding to this, but maybe someone will still benefit. I believe the issue is that the use of "timeseries" with BagSelection objects is only valid for numeric, scalar properties. The "Covariance" field is an array of values, so it cannot be translated into a timeseries the way that, for example, "Pose.Pose.Point.X" would.
You should be able to see available fields by doing "timeseries" on the whole selection (or maybe limit the time first, just to make it faster) and see which data fields are available (in DataInfo.UserData).
-Cam
  댓글 수: 1
LinuxPen
LinuxPen 2022년 10월 18일
I have the same problem trying to extract the covariance matrices. @Lasse Goncz @Cam Salzberger could you please guide me on how I can plot the cov array as a function of time.
bagselect = rosbag('bagfile.bag');
bagselect3 = select(bagselect,"Topic","/amcl_pose");
cov = timeseries(bagselect3,"Pose.Covariance[0;0]","Pose.Covariance[0;1]", "Pose.Covariance[0;5]");

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 ROS Network Connection and Exploration에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by