Skip to content

Commit ed3d289

Browse files
authored
Merge pull request #62 from naturerobots/feature/dynamic-cost-updates
Feature: Message Definition and Visualization Support for Dynamic Cost Updates
2 parents 0074c69 + 1758fa7 commit ed3d289

File tree

23 files changed

+535
-19
lines changed

23 files changed

+535
-19
lines changed

label_manager/CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package label_manager
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.1.0 (2025-08-11)
6+
------------------
7+
* Add MeshVertexCostsSparse and MeshVertexCostsSparseStamped messages
8+
* Add support for visualizing cost map updates in RViz using the MeshDisplay
9+
510
2.0.1 (2025-08-11)
611
------------------
712
* Changes since the first ROS 2 port to enable the same functionality as the ROS 1 version

label_manager/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>label_manager</name>
5-
<version>2.0.1</version>
5+
<version>2.1.0</version>
66
<description>Serving and persisting label information</description>
77
<maintainer email="[email protected]">Alexander Mock</maintainer>
88
<maintainer email="[email protected]">Matthias Holoch</maintainer>

mesh_msgs/CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package mesh_msgs
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.1.0 (2025-08-11)
6+
------------------
7+
* Add MeshVertexCostsSparse and MeshVertexCostsSparseStamped messages
8+
* Add support for visualizing cost map updates in RViz using the MeshDisplay
9+
510
2.0.1 (2025-08-11)
611
------------------
712
* Changes since the first ROS 2 port to enable the same functionality as the ROS 1 version

mesh_msgs/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ rosidl_generate_interfaces(${PROJECT_NAME}
2929
"msg/MeshVertexColorsStamped.msg"
3030
"msg/MeshVertexCosts.msg"
3131
"msg/MeshVertexCostsStamped.msg"
32+
"msg/MeshVertexCostsSparse.msg"
33+
"msg/MeshVertexCostsSparseStamped.msg"
3234
"msg/MeshTexture.msg"
3335
"msg/MeshTriangleIndices.msg"
3436
"msg/VectorField.msg"
@@ -49,4 +51,4 @@ rosidl_generate_interfaces(${PROJECT_NAME}
4951
)
5052

5153
ament_export_dependencies(rosidl_default_runtime)
52-
ament_package()
54+
ament_package()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# MeshVertexCostsSparse
2+
# Holds costs for a subset of the mesh vertices
3+
4+
# The vertex indices
5+
uint32[] vertices
6+
7+
# The cost per vertex
8+
float32[] costs
9+
10+
# The default value for all other vertices
11+
float32 default_value
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Mesh Attribute Message
2+
std_msgs/Header header
3+
string uuid
4+
string type
5+
mesh_msgs/MeshVertexCostsSparse mesh_vertex_costs

mesh_msgs/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>mesh_msgs</name>
5-
<version>2.0.1</version>
5+
<version>2.1.0</version>
66
<description>Various Message Types for Mesh Data.</description>
77
<maintainer email="[email protected]">Alexander Mock</maintainer>
88
<maintainer email="[email protected]">Matthias Holoch</maintainer>

mesh_msgs_conversions/CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package mesh_msgs_conversions
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.1.0 (2025-08-11)
6+
------------------
7+
* Add MeshVertexCostsSparse and MeshVertexCostsSparseStamped messages
8+
* Add support for visualizing cost map updates in RViz using the MeshDisplay
9+
510
2.0.1 (2025-08-11)
611
------------------
712
* Changes since the first ROS 2 port to enable the same functionality as the ROS 1 version

mesh_msgs_conversions/include/mesh_msgs_conversions/conversions.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "mesh_msgs/msg/mesh_vertex_colors.hpp"
6363
#include "mesh_msgs/msg/mesh_vertex_colors_stamped.hpp"
6464
#include "mesh_msgs/msg/mesh_vertex_costs_stamped.hpp"
65+
#include "mesh_msgs/msg/mesh_vertex_costs_sparse_stamped.hpp"
6566
#include "mesh_msgs/msg/mesh_vertex_tex_coords.hpp"
6667
#include "mesh_msgs/msg/mesh_material.hpp"
6768
#include "mesh_msgs/msg/mesh_texture.hpp"
@@ -224,6 +225,31 @@ inline const mesh_msgs::msg::MeshVertexCosts toVertexCosts(
224225
return costs_msg;
225226
}
226227

228+
inline const mesh_msgs::msg::MeshVertexCostsSparse toVertexCostsSparse(
229+
const lvr2::VertexMap<float>& costs,
230+
const float default_value
231+
)
232+
{
233+
mesh_msgs::msg::MeshVertexCostsSparse costs_msg;
234+
costs_msg.vertices.resize(costs.numValues());
235+
costs_msg.costs.resize(costs.numValues());
236+
costs_msg.default_value = default_value;
237+
238+
std::transform(costs.begin(), costs.end(), costs_msg.vertices.begin(),
239+
[](const lvr2::VertexHandle& v)
240+
{
241+
return v.idx();
242+
}
243+
);
244+
std::transform(costs_msg.vertices.begin(), costs_msg.vertices.end(), costs_msg.costs.begin(),
245+
[&costs](const uint32_t idx)
246+
{
247+
return costs[lvr2::VertexHandle(idx)];
248+
}
249+
);
250+
return costs_msg;
251+
}
252+
227253
inline const mesh_msgs::msg::MeshVertexCostsStamped toVertexCostsStamped(
228254
const lvr2::VertexMap<float>& costs,
229255
const size_t num_values,
@@ -243,6 +269,24 @@ inline const mesh_msgs::msg::MeshVertexCostsStamped toVertexCostsStamped(
243269
return mesh_msg;
244270
}
245271

272+
inline const mesh_msgs::msg::MeshVertexCostsSparseStamped toVertexCostsSparseStamped(
273+
const lvr2::VertexMap<float>& costs,
274+
const float default_value,
275+
const std::string& name,
276+
const std::string& frame_id,
277+
const std::string& uuid,
278+
const rclcpp::Time& stamp = rclcpp::Time()
279+
)
280+
{
281+
mesh_msgs::msg::MeshVertexCostsSparseStamped msg;
282+
msg.mesh_vertex_costs = toVertexCostsSparse(costs, default_value);
283+
msg.uuid = uuid;
284+
msg.type = name;
285+
msg.header.frame_id = frame_id;
286+
msg.header.stamp = stamp;
287+
return msg;
288+
}
289+
246290
inline const mesh_msgs::msg::MeshVertexCosts toVertexCosts(
247291
const lvr2::DenseVertexMap<float>& costs)
248292
{

mesh_msgs_conversions/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>mesh_msgs_conversions</name>
5-
<version>2.0.1</version>
5+
<version>2.1.0</version>
66
<description>converts point clouds and attributes into meshes and mesh attributes</description>
77

88
<maintainer email="[email protected]">Alexander Mock</maintainer>

0 commit comments

Comments
 (0)