conversor.cpp
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright (C) 2021-2022 Wageningen University - All Rights Reserved
3 // Author: Gonzalo Mier
4 // BSD-3 License
5 //=============================================================================
6 
7 #include "ros/conversor.h"
8 
9 
10 namespace conversor
11 {
12 void ROS::to(const F2CPoint& _point, GeometryMsgs::Point32& _p32) {
13  _p32.x = static_cast<float>(_point.getX());
14  _p32.y = static_cast<float>(_point.getY());
15  _p32.z = static_cast<float>(_point.getZ());
16 }
17 
18 void ROS::to(const F2CPoint& _point, GeometryMsgs::Point& _p64) {
19  _p64.x = _point.getX();
20  _p64.y = _point.getY();
21  _p64.z = _point.getZ();
22 }
23 
24 
25 void ROS::to(const F2CCell& _poly,
26  std::vector<GeometryMsgs::Polygon>& _ros_poly) {
27  GeometryMsgs::Polygon ros_ring;
28  to(_poly.getExteriorRing(), ros_ring);
29  _ros_poly.push_back(ros_ring);
30  const int n_in_rings = _poly.size() - 1;
31  for (int i=0; i < n_in_rings; ++i) {
32  ros_ring.points.clear();
33  to(_poly.getInteriorRing(i), ros_ring);
34  _ros_poly.push_back(ros_ring);
35  }
36 }
37 
38 void ROS::to(const F2CCells& _polys,
39  std::vector<std::vector<GeometryMsgs::Polygon>>& _ros_polys) {
40  for (auto&& p : _polys) {
41  std::vector<GeometryMsgs::Polygon> poly;
42  to(p, poly);
43  _ros_polys.push_back(poly);
44  }
45 }
46 
47 void ROS::to(const F2CLineString& _line, NavMsgs::Path& _path) {
48  GeometryMsgs::PoseStamped pose;
49  for (auto&& p : _line) {
50  to(p, pose.pose.position);
51  _path.poses.push_back(pose);
52  }
53 }
54 
55 } // namespace conversor
56 
conversor.h
conversor
Definition: conversor.h:28
conversor::ROS::to
static void to(const F2CPoint &_point, GeometryMsgs::Point32 &_p32)
Definition: conversor.cpp:12


fields2cover_ros
Author(s):
autogenerated on Tue Feb 7 2023 03:46:06