From 4f6ed1222bba53f3a925a0943b7d7c920972e8d4 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Mon, 9 Oct 2023 23:10:20 +0800 Subject: [PATCH] Add mutex to lane parameters Signed-off-by: Luca Della Vedova --- rmf_building_map_tools/building_map/level.py | 11 ++++++++--- rmf_traffic_editor/gui/edge.cpp | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rmf_building_map_tools/building_map/level.py b/rmf_building_map_tools/building_map/level.py index 3e45bcc6..66b036ae 100644 --- a/rmf_building_map_tools/building_map/level.py +++ b/rmf_building_map_tools/building_map/level.py @@ -211,6 +211,10 @@ def add_edge_from_coords(self, edge_type, p1, p2, props): ParamValue.DOUBLE, props.get('speed_limit', 0.0) ]) + edge.params['mutex'] = ParamValue([ + ParamValue.STRING, + props.get('mutex', "") + ]) self.lanes.append(edge) else: raise ValueError('unknown edge type!') @@ -486,6 +490,10 @@ def generate_nav_graph(self, graph_idx, always_unidirectional=True): l.params['speed_limit'].value > 0.0: p['speed_limit'] = l.params['speed_limit'].value + if 'mutex' in l.params and \ + l.params['mutex'].value: + p['mutex'] = l.params['mutex'].value + if 'demo_mock_floor_name' in l.params and \ l.params['demo_mock_floor_name'].value: p['demo_mock_floor_name'] = \ @@ -503,9 +511,6 @@ def generate_nav_graph(self, graph_idx, always_unidirectional=True): if 'dock_name' in v1.params: # lane segment begins at dock beginning_dock = v1.params['dock_name'].value - if 'speed_limit' in l.params: - p['speed_limit'] = l.params['speed_limit'].value - if always_unidirectional and l.is_bidirectional(): # now flip things around and make the second link forward_params = copy.deepcopy(p) diff --git a/rmf_traffic_editor/gui/edge.cpp b/rmf_traffic_editor/gui/edge.cpp index dc09bcde..aa208d61 100644 --- a/rmf_traffic_editor/gui/edge.cpp +++ b/rmf_traffic_editor/gui/edge.cpp @@ -132,6 +132,7 @@ void Edge::create_required_parameters() std::string()); create_param_if_needed("demo_mock_lift_name", Param::STRING, std::string()); create_param_if_needed("speed_limit", Param::DOUBLE, 0.0); + create_param_if_needed("mutex", Param::STRING, std::string()); } else if (type == DOOR) {