landmark.cpp
Go to the documentation of this file.
1 /*
2  * File: landmark.cpp
3  * Author: Vladislav Tananaev
4  *
5  */
6 
7 #include <geometry_msgs/Pose.h>
8 #include "mrpt_bridge/time.h"
9 #include "mrpt_bridge/pose.h"
10 #include <mrpt_msgs/ObservationRangeBearing.h>
11 #include "tf/transform_datatypes.h"
13 #include "mrpt_bridge/landmark.h"
14 
15 #include <mrpt/version.h>
16 #include <mrpt/obs/CObservationBearingRange.h>
17 using namespace mrpt::obs;
18 
19 namespace mrpt_bridge
20 {
21 bool convert(
23  const mrpt::poses::CPose3D& _pose, CObservationBearingRange& _obj)
24 
25 {
26  // mrpt_bridge::convert(_msg.header.stamp, _obj.timestamp);
27  mrpt::poses::CPose3D cpose_obj;
28 
29  //_obj.stdError = _msg.sensor_std_range;
30  //_obj.sensorLabel = _msg.header.frame_id;
31  _obj.maxSensorDistance = _msg.max_sensor_distance;
32  _obj.minSensorDistance = _msg.min_sensor_distance;
33  _obj.sensor_std_yaw = _msg.sensor_std_yaw;
34  _obj.sensor_std_pitch = _msg.sensor_std_pitch;
35  _obj.sensor_std_range = _msg.sensor_std_range;
36 
37  if (_pose.empty())
38  {
39  convert(_msg.sensor_pose_on_robot, cpose_obj);
40  _obj.setSensorPose(cpose_obj);
41  }
42  else
43  {
44  _obj.setSensorPose(_pose);
45  }
46 
47  ASSERT_(_msg.sensed_data.size() >= 1);
48  const size_t N = _msg.sensed_data.size();
49 
50  _obj.sensedData.resize(N);
51 
52  for (std::size_t i_mrpt = 0; i_mrpt < N; i_mrpt++)
53  {
54  _obj.sensedData[i_mrpt].range = _msg.sensed_data[i_mrpt].range;
55  _obj.sensedData[i_mrpt].landmarkID = _msg.sensed_data[i_mrpt].id;
56  _obj.sensedData[i_mrpt].yaw = _msg.sensed_data[i_mrpt].yaw;
57  _obj.sensedData[i_mrpt].pitch = _msg.sensed_data[i_mrpt].pitch;
58  }
59  return true;
60 }
61 
62 bool convert(
63  const CObservationBearingRange& _obj,
65 {
66  mrpt::poses::CPose3D cpose_obj;
67 
68  // mrpt_bridge::convert(_obj.timestamp, _msg.header.stamp);
69  _obj.getSensorPose(cpose_obj);
70  convert(cpose_obj, _msg.sensor_pose_on_robot);
71 
72  _msg.max_sensor_distance = _obj.maxSensorDistance;
73  _msg.min_sensor_distance = _obj.minSensorDistance;
74  _msg.sensor_std_yaw = _obj.sensor_std_yaw;
75  _msg.sensor_std_pitch = _obj.sensor_std_pitch;
76  _msg.sensor_std_range = _obj.sensor_std_range;
77 
78  ASSERT_(_obj.sensedData.size() >= 1);
79  const size_t N = _obj.sensedData.size();
80 
81  _msg.sensed_data.resize(N);
82 
83  for (std::size_t i_msg = 0; i_msg < N; i_msg++)
84  {
85  _msg.sensed_data[i_msg].range = _obj.sensedData[i_msg].range;
86  _msg.sensed_data[i_msg].id = _obj.sensedData[i_msg].landmarkID;
87  _msg.sensed_data[i_msg].yaw = _obj.sensedData[i_msg].yaw;
88  _msg.sensed_data[i_msg].pitch = _obj.sensedData[i_msg].pitch;
89  }
90  return true;
91 }
92 
93 bool convert(
94  const CObservationBearingRange& _obj,
96 {
97  convert(_obj, _msg);
98  mrpt::poses::CPose3D pose;
99  _obj.getSensorPose(pose);
100  convert(pose, _pose);
101  return true;
102 }
103 } // end namespace
bool convert(const CObservationBearingRange &_obj, mrpt_msgs::ObservationRangeBearing &_msg, geometry_msgs::Pose &_pose)
Definition: landmark.cpp:93
File includes methods for converting CNetworkOfPoses*DInf <=> NetworkOfPoses message types...


mrpt_bridge
Author(s): Markus Bader , Raphael Zack
autogenerated on Sat Apr 28 2018 02:49:17