|
41 | 41 | #include <boost/uuid/uuid_io.hpp> |
42 | 42 | #include <optional> |
43 | 43 | #include <memory> |
44 | | - |
45 | 44 | #include <functional> |
46 | | -#include <geometry_msgs/msg/point_stamped.hpp> |
47 | | -#include <geometry_msgs/msg/vector3.hpp> |
48 | | -#include <visualization_msgs/msg/marker_array.hpp> |
| 45 | +#include <mutex> |
| 46 | +#include <filesystem> |
| 47 | +#include <assimp/Importer.hpp> |
| 48 | +#include <assimp/postprocess.h> |
| 49 | +#include <assimp/scene.h> |
49 | 50 |
|
50 | 51 | #include <lvr2/geometry/Normal.hpp> |
51 | 52 | #include <lvr2/algorithm/GeometryAlgorithms.hpp> |
52 | 53 | #include <lvr2/algorithm/NormalAlgorithms.hpp> |
53 | 54 | #include <lvr2/io/deprecated/hdf5/MeshIO.hpp> |
54 | 55 | #include <lvr2/types/MeshBuffer.hpp> |
55 | | - |
56 | 56 | // Mesh structure for fast surface traversal |
57 | 57 | #include <lvr2/geometry/PMPMesh.hpp> |
58 | | - |
59 | 58 | // Raycaster implementations |
60 | 59 | #ifdef LVR2_USE_EMBREE |
61 | 60 | #include <lvr2/algorithm/raycasting/EmbreeRaycaster.hpp> |
62 | 61 | #else |
63 | 62 | #include <lvr2/algorithm/raycasting/BVHRaycaster.hpp> |
64 | 63 | #endif |
65 | 64 |
|
| 65 | +#include <rclcpp/rclcpp.hpp> |
| 66 | +#include <tf2_ros/buffer.h> |
| 67 | +#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp> |
| 68 | +#include <geometry_msgs/msg/point_stamped.hpp> |
| 69 | +#include <geometry_msgs/msg/transform_stamped.hpp> |
| 70 | +#include <geometry_msgs/msg/vector3.hpp> |
| 71 | +#include <visualization_msgs/msg/marker.hpp> |
| 72 | +#include <visualization_msgs/msg/marker_array.hpp> |
| 73 | + |
66 | 74 | #include <mesh_map/abstract_layer.h> |
67 | 75 | #include <mesh_map/mesh_map.h> |
68 | 76 | #include <mesh_map/util.h> |
69 | 77 | #include <mesh_map/timer.h> |
70 | 78 | #include <mesh_msgs/msg/mesh_geometry_stamped.hpp> |
71 | 79 | #include <mesh_msgs_conversions/conversions.h> |
72 | | -#include <mutex> |
73 | | -#include <rclcpp/rclcpp.hpp> |
74 | | -#include <visualization_msgs/msg/marker.hpp> |
75 | | - |
76 | | -#include <filesystem> |
77 | | - |
78 | | -#include <assimp/Importer.hpp> |
79 | | -#include <assimp/postprocess.h> |
80 | | -#include <assimp/scene.h> |
81 | 80 |
|
82 | 81 | namespace fs = std::filesystem; |
83 | 82 |
|
@@ -1307,6 +1306,24 @@ bool MeshMap::resetLayers() |
1307 | 1306 | return true; // TODO implement |
1308 | 1307 | } |
1309 | 1308 |
|
| 1309 | +geometry_msgs::msg::PoseStamped MeshMap::transformToMapFrame( |
| 1310 | + const geometry_msgs::msg::PoseStamped& input_pose) const |
| 1311 | +{ |
| 1312 | + if(input_pose.header.frame_id == mapFrame()) |
| 1313 | + { |
| 1314 | + return input_pose; |
| 1315 | + } |
| 1316 | + |
| 1317 | + // we shouldn't catch/ignore the error that comes from here, as it indicates a misconfiguration |
| 1318 | + const geometry_msgs::msg::TransformStamped Tim = tf_buffer.lookupTransform( |
| 1319 | + mapFrame(), input_pose.header.frame_id, input_pose.header.stamp); |
| 1320 | + |
| 1321 | + geometry_msgs::msg::PoseStamped output_pose; |
| 1322 | + tf2::doTransform(input_pose, output_pose, Tim); |
| 1323 | + |
| 1324 | + return output_pose; |
| 1325 | +} |
| 1326 | + |
1310 | 1327 | void MeshMap::publishVertexCosts(const lvr2::VertexMap<float>& costs, const std::string& name, const rclcpp::Time& map_stamp) |
1311 | 1328 | { |
1312 | 1329 | layer_manager_.publish_cost_layer(costs, name, map_stamp); |
|
0 commit comments