11 #include <marker_msgs/MarkerDetection.h> 12 #include <mrpt/obs/CObservationBearingRange.h> 24 convert(src.header.stamp, des.timestamp);
25 des.setSensorPose(pose);
26 des.minSensorDistance = src.distance_min;
27 des.maxSensorDistance = src.distance_max;
29 des.sensedData.resize(src.markers.size());
30 for(
size_t i = 0; i < src.markers.size(); i++) {
31 const marker_msgs::Marker &marker = src.markers[i];
32 mrpt::obs::CObservationBearingRange::TMeasurement &measurment = des.sensedData[i];
33 measurment.range = sqrt(marker.pose.position.x * marker.pose.position.x + marker.pose.position.y * marker.pose.position.y);
34 measurment.yaw = atan2(marker.pose.position.y, marker.pose.position.x);
35 measurment.pitch = 0.0;
36 if(marker.ids.size() > 0) {
37 measurment.landmarkID = marker.ids[0];
39 measurment.landmarkID = -1;
46 convert(src.header.stamp, des.timestamp);
47 des.setSensorPose(pose);
48 des.minSensorDistance = src.distance_min;
49 des.maxSensorDistance = src.distance_max;
51 des.sensedData.resize(src.markers.size());
52 for(
size_t i = 0; i < src.markers.size(); i++) {
53 const marker_msgs::Marker &marker = src.markers[i];
54 mrpt::obs::CObservationBeaconRanges::TMeasurement &measurment = des.sensedData[i];
55 measurment.sensedDistance = sqrt(marker.pose.position.x * marker.pose.position.x + marker.pose.position.y * marker.pose.position.y);
56 measurment.sensorLocationOnRobot.m_coords = pose.m_coords;
57 if(marker.ids.size() > 0) {
58 measurment.beaconID = marker.ids[0];
60 measurment.beaconID = -1;
Funtions to convert marker_msgs to mrpt msgs.
File includes methods for converting CNetworkOfPoses*DInf <=> NetworkOfPoses message types...
bool convert(const mrpt_msgs::ObservationRangeBeacon &_msg, const mrpt::poses::CPose3D &_pose, mrpt::obs::CObservationBeaconRanges &_obj)