Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
linatypes.cpp
Go to the documentation of this file.
1 #include <galaxis/linatypes.hpp>
2 
3 #include <cstdlib>
4 
5 using namespace galaxis::lina;
6 
7 std::shared_ptr<DebugPolynomType> pointcloud_to_ros_message(std::vector<Point2f> const& p_pointCloud) {
8  std::shared_ptr<DebugPolynomType> message = std::make_shared<DebugPolynomType>();
9 
10  for(auto& p: p_pointCloud) {
11  Vector2fType v2f;
12  v2f.x = p(0);
13  v2f.y = p(1);
14  message->points.track.push_back(v2f);
15  }
16 
17  return message;
18 }
19 
20 std::shared_ptr<std::vector<Point2f>> ros_message_to_pointcloud(std::shared_ptr<DebugPolynomType>& p_debugPolynomMessageSPtr) {
21  std::shared_ptr<std::vector<Point2f>> pointCloud = std::make_shared<std::vector<Point2f>>();
22 
23  for(auto& p: p_debugPolynomMessageSPtr->points.track) {
24  Vector2f vec(p.x, p.y);
25  pointCloud->push_back(vec);
26  }
27 
28  return pointCloud;
29 }
galaxis::lina::ros_message_to_pointcloud
std::shared_ptr< std::vector< Point2f > > ros_message_to_pointcloud(std::shared_ptr< DebugPolynomType > &p_debugPolynomMessageSPtr)
Definition: linatypes.cpp:20
galaxis::lina::pointcloud_to_ros_message
std::shared_ptr< DebugPolynomType > pointcloud_to_ros_message(std::vector< Point2f > const &p_pointCloud)
Definition: linatypes.cpp:7
Vector2fType
messages::msg::Vector2f Vector2fType
Definition: messages.hpp:44
galaxis::lina
Definition: linatypes.hpp:11
galaxis::lina::Vector2f
Eigen::Vector2f Vector2f
Definition: linatypes.hpp:14
linatypes.hpp