Skip to content

Commit 5274edf

Browse files
authored
Merge branch 'main' into arjo/fix/mapgen_error
2 parents e3197af + 613e8ab commit 5274edf

File tree

15 files changed

+86
-9
lines changed

15 files changed

+86
-9
lines changed

rmf_building_map_tools/CHANGELOG.rst

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package rmf\_building\_map\_tools
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
1.8.2 (2023-12-15)
6+
------------------
7+
* Export door information to nav graphs (`#479 <https://github.com/open-rmf/rmf_traffic_editor/pull/479>`_)
8+
* Export lift information to nav graphs (`#478 <https://github.com/open-rmf/rmf_traffic_editor/pull/478>`_)
9+
510
1.8.1 (2023-08-10)
611
------------------
712
* Fix gz classic model download (`#470 <https://github.com/open-rmf/rmf_traffic_editor/pull/470>`_)

rmf_building_map_tools/building_map/building.py

+18
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ def generate_nav_graphs(self):
352352
g = {}
353353
g['building_name'] = self.name
354354
g['levels'] = {}
355+
g['lifts'] = {}
356+
g['doors'] = {}
355357

356358
if self.coordinate_system == CoordinateSystem.web_mercator:
357359
g['crs_name'] = self.global_transform.crs_name
@@ -372,6 +374,22 @@ def generate_nav_graphs(self):
372374
g['levels'][level_name] = level_graph
373375
if level_graph['lanes']:
374376
empty = False
377+
378+
for door_edge in level.doors:
379+
door_edge.calc_statistics(level.transformed_vertices)
380+
g['doors'][door_edge.params['name'].value] = {
381+
'endpoints': [
382+
[door_edge.x1, door_edge.y1],
383+
[door_edge.x2, door_edge.y2]
384+
],
385+
'map': level_name
386+
}
387+
388+
for lift_name, lift in self.lifts.items():
389+
g['lifts'][lift_name] = {
390+
'position': [lift.x, lift.y, lift.yaw],
391+
'dims': [lift.width, lift.depth]
392+
}
375393
if not empty:
376394
nav_graphs[f'{i}'] = g
377395
return nav_graphs

rmf_building_map_tools/building_map/level.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ def add_edge_from_coords(self, edge_type, p1, p2, props):
211211
ParamValue.DOUBLE,
212212
props.get('speed_limit', 0.0)
213213
])
214+
edge.params['mutex'] = ParamValue([
215+
ParamValue.STRING,
216+
props.get('mutex', "")
217+
])
214218
self.lanes.append(edge)
215219
else:
216220
raise ValueError('unknown edge type!')
@@ -486,6 +490,10 @@ def generate_nav_graph(self, graph_idx, always_unidirectional=True):
486490
l.params['speed_limit'].value > 0.0:
487491
p['speed_limit'] = l.params['speed_limit'].value
488492

493+
if 'mutex' in l.params and \
494+
l.params['mutex'].value:
495+
p['mutex'] = l.params['mutex'].value
496+
489497
if 'demo_mock_floor_name' in l.params and \
490498
l.params['demo_mock_floor_name'].value:
491499
p['demo_mock_floor_name'] = \
@@ -503,9 +511,6 @@ def generate_nav_graph(self, graph_idx, always_unidirectional=True):
503511
if 'dock_name' in v1.params: # lane segment begins at dock
504512
beginning_dock = v1.params['dock_name'].value
505513

506-
if 'speed_limit' in l.params:
507-
p['speed_limit'] = l.params['speed_limit'].value
508-
509514
if always_unidirectional and l.is_bidirectional():
510515
# now flip things around and make the second link
511516
forward_params = copy.deepcopy(p)

rmf_building_map_tools/package.xml

+1-1
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>rmf_building_map_tools</name>
5-
<version>1.8.1</version>
5+
<version>1.8.2</version>
66
<description>RMF Building map tools</description>
77
<maintainer email="[email protected]">Morgan Quigley</maintainer>
88
<maintainer email="[email protected]">Marco A. Gutiérrez</maintainer>

rmf_traffic_editor/CHANGELOG.rst

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package rmf\_traffic\_editor
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
1.8.2 (2023-12-15)
6+
------------------
7+
* Merge radius property (`#480 <https://github.com/open-rmf/rmf_traffic_editor/pull/480>`_)
8+
* Mutex group property (`#477 <https://github.com/open-rmf/rmf_traffic_editor/pull/477>`_)
9+
510
1.8.1 (2023-08-10)
611
------------------
712

rmf_traffic_editor/gui/building_dialog.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,16 @@ void BuildingDialog::ok_button_clicked()
8787
_building.reference_level_name =
8888
_reference_floor_combo_box->currentText().toStdString();
8989

90-
_building.params["generate_crs"] =
91-
Param(generate_crs_line_edit->text().toStdString());
90+
if (!generate_crs_line_edit->text().isEmpty())
91+
{
92+
_building.params["generate_crs"] = Param(
93+
generate_crs_line_edit->text().toStdString());
94+
}
95+
else
96+
{
97+
if (_building.params.find("generate_crs") != _building.params.end())
98+
_building.params.erase("generate_crs");
99+
}
92100

93101
accept();
94102
}

rmf_traffic_editor/gui/edge.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ void Edge::create_required_parameters()
132132
std::string());
133133
create_param_if_needed("demo_mock_lift_name", Param::STRING, std::string());
134134
create_param_if_needed("speed_limit", Param::DOUBLE, 0.0);
135+
create_param_if_needed("mutex", Param::STRING, std::string());
135136
}
136137
else if (type == DOOR)
137138
{

rmf_traffic_editor/gui/level.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ void Level::draw(
11841184
v.draw(
11851185
scene,
11861186
vertex_radius / drawing_meters_per_pixel,
1187+
drawing_meters_per_pixel,
11871188
vertex_name_font,
11881189
coordinate_system);
11891190

rmf_traffic_editor/gui/vertex.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const vector<pair<string, Param::Type>> Vertex::allowed_params
3939
{ "is_holding_point", Param::Type::BOOL },
4040
{ "is_passthrough_point", Param::Type::BOOL },
4141
{ "human_goal_set_name", Param::Type::STRING },
42+
{ "mutex", Param::Type::STRING },
43+
{ "merge_radius", Param::Type::DOUBLE },
4244
};
4345

4446

@@ -131,6 +133,7 @@ YAML::Node Vertex::to_yaml(const CoordinateSystem& coordinate_system) const
131133
void Vertex::draw(
132134
QGraphicsScene* scene,
133135
const double radius,
136+
const double drawing_meters_per_pixel,
134137
const QFont& font,
135138
const CoordinateSystem& coordinate_system) const
136139
{
@@ -163,6 +166,19 @@ void Vertex::draw(
163166
const double icon_ring_radius = radius * 2.5;
164167
const double icon_scale = 2.0 * radius / 128.0;
165168

169+
if (const auto r_merge_opt = merge_radius())
170+
{
171+
const double r_merge = *r_merge_opt / drawing_meters_per_pixel;
172+
const QPen radius_pen(selected ? selected_color : Qt::black);
173+
auto* radius_item = scene->addEllipse(
174+
x - r_merge,
175+
y - r_merge,
176+
2 * r_merge,
177+
2 * r_merge,
178+
radius_pen);
179+
radius_item->setZValue(19.0);
180+
}
181+
166182
if (is_holding_point())
167183
{
168184
const double icon_bearing = -135.0 * M_PI / 180.0;
@@ -342,6 +358,15 @@ bool Vertex::is_charger() const
342358
return it->second.value_bool;
343359
}
344360

361+
std::optional<double> Vertex::merge_radius() const
362+
{
363+
const auto it = params.find("merge_radius");
364+
if (it == params.end())
365+
return std::nullopt;
366+
367+
return it->second.value_double;
368+
}
369+
345370
bool Vertex::is_cleaning_zone() const
346371
{
347372
const auto it = params.find("is_cleaning_zone");

rmf_traffic_editor/gui/vertex.h

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <map>
2323
#include <string>
2424
#include <vector>
25+
#include <optional>
2526
#include <yaml-cpp/yaml.h>
2627

2728
#include <QColor>
@@ -58,13 +59,15 @@ class Vertex
5859
void draw(
5960
QGraphicsScene* scene,
6061
const double radius,
62+
const double drawing_meters_per_pixel,
6163
const QFont& font,
6264
const CoordinateSystem& coordinate_system) const;
6365

6466
bool is_parking_point() const;
6567
bool is_holding_point() const;
6668
bool is_cleaning_zone() const;
6769
bool is_charger() const;
70+
std::optional<double> merge_radius() const;
6871

6972
std::string dropoff_ingestor() const;
7073
std::string pickup_dispenser() const;

rmf_traffic_editor/package.xml

+1-1
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>rmf_traffic_editor</name>
5-
<version>1.8.1</version>
5+
<version>1.8.2</version>
66
<description>traffic editor</description>
77
<maintainer email="[email protected]">Morgan Quigley</maintainer>
88
<maintainer email="[email protected]">Marco A. Gutiérrez</maintainer>

rmf_traffic_editor_assets/CHANGELOG.rst

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Changelog for package rmf\_traffic\_editor\_assets
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
1.8.2 (2023-12-15)
6+
------------------
7+
58
1.8.1 (2023-08-10)
69
------------------
710

rmf_traffic_editor_assets/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
44
<name>rmf_traffic_editor_assets</name>
5-
<version>1.8.1</version>
5+
<version>1.8.2</version>
66
<description>Assets for use with traffic_editor.</description>
77

88
<maintainer email="[email protected]">Brandon Ong</maintainer>

rmf_traffic_editor_test_maps/CHANGELOG.rst

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Changelog for package rmf\_traffic\_editor\_test\_maps
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
1.8.2 (2023-12-15)
6+
------------------
7+
58
1.8.1 (2023-08-10)
69
------------------
710
* Fix gz classic model download (`#470 <https://github.com/open-rmf/rmf_traffic_editor/pull/470>`_)

rmf_traffic_editor_test_maps/package.xml

+1-1
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>rmf_traffic_editor_test_maps</name>
5-
<version>1.8.1</version>
5+
<version>1.8.2</version>
66
<description>
77
Some test maps for traffic_editor and rmf_building_map_tools.
88
</description>

0 commit comments

Comments
 (0)