Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "mrpt_bridge/range.h"
00016 #include <iostream>
00017 using namespace std;
00018
00019
00020 namespace mrpt_bridge
00021 {
00022 namespace range
00023 {
00024
00025
00026
00027 bool ros2mrpt(const sensor_msgs::Range &msg,
00028 CObservationRange &obj) {
00029 obj.minSensorDistance = msg.min_range;
00030 obj.maxSensorDistance = msg.max_range;
00031 obj.sensorConeApperture = msg.field_of_view;
00032
00034 obj.sensedData.at(0).sensedDistance = msg.range;
00035 }
00036
00037
00038
00039
00040 bool mrpt2ros(const CObservationRange &obj,
00041 const std_msgs::Header &msg_header,
00042 sensor_msgs::Range *msg)
00043 {
00044 long num_range = obj.sensedData.size();
00045
00046
00047 for(int i=0 ; i<num_range ; i++)
00048 msg[i].header = msg_header;
00049
00050
00051 for(int i=0 ; i<num_range ; i++)
00052 {
00053 msg[i].max_range = obj.maxSensorDistance;
00054 msg[i].min_range = obj.minSensorDistance;
00055 msg[i].field_of_view = obj.sensorConeApperture;
00056 }
00057
00060 for (int i = 0; i < num_range; i++)
00061 msg[i].range = obj.sensedData.at(i).sensedDistance;
00062
00065
00066 }
00067 }
00068 }
00069
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080