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 return true;
00036 }
00037
00038
00039
00040
00041 bool mrpt2ros(const CObservationRange &obj,
00042 const std_msgs::Header &msg_header,
00043 sensor_msgs::Range *msg)
00044 {
00045 long num_range = obj.sensedData.size();
00046
00047
00048 for(int i=0 ; i<num_range ; i++)
00049 msg[i].header = msg_header;
00050
00051
00052 for(int i=0 ; i<num_range ; i++)
00053 {
00054 msg[i].max_range = obj.maxSensorDistance;
00055 msg[i].min_range = obj.minSensorDistance;
00056 msg[i].field_of_view = obj.sensorConeApperture;
00057 }
00058
00061 for (int i = 0; i < num_range; i++)
00062 msg[i].range = obj.sensedData.at(i).sensedDistance;
00063
00066
00067 return true;
00068 }
00069 }
00070 }
00071
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082