19 #include <marker_msgs/MarkerDetection.h>
20 #include <mrpt/obs/CObservationBearingRange.h>
29 mrpt::obs::CObservationBearingRange& des)
31 convert(src.header.stamp, des.timestamp);
32 des.setSensorPose(pose);
33 des.minSensorDistance = src.distance_min;
34 des.maxSensorDistance = src.distance_max;
36 des.sensedData.resize(src.markers.size());
37 for (
size_t i = 0; i < src.markers.size(); i++)
39 const marker_msgs::Marker& marker = src.markers[i];
40 mrpt::obs::CObservationBearingRange::TMeasurement& measurment =
42 measurment.range = sqrt(
43 marker.pose.position.x * marker.pose.position.x +
44 marker.pose.position.y * marker.pose.position.y);
45 measurment.yaw = atan2(marker.pose.position.y, marker.pose.position.x);
46 measurment.pitch = 0.0;
47 if (marker.ids.size() > 0)
49 measurment.landmarkID = marker.ids[0];
53 measurment.landmarkID = -1;
60 mrpt::obs::CObservationBeaconRanges& des)
62 convert(src.header.stamp, des.timestamp);
63 des.setSensorPose(pose);
64 des.minSensorDistance = src.distance_min;
65 des.maxSensorDistance = src.distance_max;
67 des.sensedData.resize(src.markers.size());
68 for (
size_t i = 0; i < src.markers.size(); i++)
70 const marker_msgs::Marker& marker = src.markers[i];
71 mrpt::obs::CObservationBeaconRanges::TMeasurement& measurment =
73 measurment.sensedDistance = sqrt(
74 marker.pose.position.x * marker.pose.position.x +
75 marker.pose.position.y * marker.pose.position.y);
76 measurment.sensorLocationOnRobot.m_coords = pose.m_coords;
77 if (marker.ids.size() > 0)
79 measurment.beaconID = marker.ids[0];
83 measurment.beaconID = -1;