@@ -52,6 +52,7 @@ def __init__(self, zenoh_router: str, kachaka_access_point: str, robot_name: str
52
52
with open (file_path / "config" / config_file , 'r' ) as f :
53
53
config = yaml .safe_load (f )
54
54
self .method_mapping = config .get ('method_mapping' , {})
55
+ self .map_name_mapping = config .get ('map_name_mapping' , {})
55
56
self .kachaka_client = kachaka_api .KachakaApiClient (kachaka_access_point )
56
57
self .robot_name = robot_name
57
58
self .task_id = None
@@ -120,13 +121,14 @@ async def switch_map(self, args: dict) -> None:
120
121
Args:
121
122
args (dict): The arguments for the switch_map method.
122
123
"""
124
+ map_name = self .map_name_mapping .get (args .get ('map_name' ), args .get ('map_name' ))
123
125
map_list = await self .run_method ("get_map_list" )
124
- map_id = next ((item ["id" ] for item in map_list if item ["name" ] == args . get ( ' map_name' ) ), None )
126
+ map_id = next ((item ["id" ] for item in map_list if item ["name" ] == map_name ), None )
125
127
if map_id is not None :
126
128
payload = {"map_id" : map_id , "pose" : args .get ("pose" , {"x" : 0.0 , "y" : 0.0 , "theta" : 0.0 })}
127
129
await self .run_method ("switch_map" , payload )
128
130
else :
129
- print (f"Map { args . get ( ' map_name' ) } not found" )
131
+ print (f"Map { map_name } not found" )
130
132
131
133
async def publish_result (self ) -> None :
132
134
"""Publish the last command is_completed to Zenoh."""
@@ -219,7 +221,7 @@ def main() -> None:
219
221
asyncio .run (node .publish_result ())
220
222
time .sleep (1 )
221
223
except KeyboardInterrupt :
222
- node .session .delete (f"kachaka /{ robot_name } /**" )
224
+ node .session .delete (f"robots /{ robot_name } /**" )
223
225
node .session .close ()
224
226
225
227
0 commit comments