Skip to content

Commit 5acf19e

Browse files
committed
Propagate robot name from launch files into mocha_core
1 parent 865f5aa commit 5acf19e

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

mocha_core/launch/database_translators_publishers.launch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def generate_launch_description():
2323
'robot_configs',
2424
default_value=PathJoinSubstitution([
2525
FindPackageShare('mocha_core'),
26-
'config', 'testConfigs', 'robot_configs.yaml'
26+
'config', 'robot_configs.yaml'
2727
]),
2828
description='Path to robot configuration file'
2929
)
@@ -32,7 +32,7 @@ def generate_launch_description():
3232
'topic_configs',
3333
default_value=PathJoinSubstitution([
3434
FindPackageShare('mocha_core'),
35-
'config', 'testConfigs', 'topic_configs.yaml'
35+
'config', 'topic_configs.yaml'
3636
]),
3737
description='Path to topic configuration file'
3838
)

mocha_core/mocha_core/database_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ class DatabaseServer:
1717
1818
Please see the list of services in the srv folder
1919
"""
20-
def __init__(self, robot_configs, topic_configs, node=None):
20+
def __init__(self, robot_configs, topic_configs, robot_name, node=None):
2121
# Check input topics
2222
assert isinstance(robot_configs, dict)
2323
assert isinstance(topic_configs, dict)
24+
assert isinstance(robot_name, str)
2425

2526
self.robot_configs = robot_configs
2627
self.topic_configs = topic_configs
@@ -32,9 +33,8 @@ def __init__(self, robot_configs, topic_configs, node=None):
3233
else:
3334
self.logger = self.node.get_logger()
3435

35-
# Get current robot name from params (passed as parameter since ROS2 doesn't use global params)
36-
# For now, we'll default to 'charon' - this should be passed as a parameter
37-
self.robot_name = 'charon' # TODO: Make this configurable
36+
# Get robot name from parameter
37+
self.robot_name = robot_name
3838

3939
if self.robot_name not in self.robot_configs.keys():
4040
self.logger.error(f"{self.robot_name} does not exist in robot_configs")

mocha_core/mocha_core/integrate_database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(self, node=None):
9494

9595
# Create a database server object with ROS2 node
9696
self.DBServer = ds.DatabaseServer(self.robot_configs,
97-
self.topic_configs, node=self.node)
97+
self.topic_configs, self.this_robot, node=self.node)
9898

9999
self.num_robot_in_comm = 0
100100

mocha_core/test/test_database_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def setUp(self):
3838
self.node = rclpy.create_node('test_database_server_node')
3939

4040
# Create a database server object with the node (this will create the services)
41-
self.dbs = ds.DatabaseServer(robot_configs, topic_configs, node=self.node)
41+
self.dbs = ds.DatabaseServer(robot_configs, topic_configs, "charon", node=self.node)
4242

4343
super().setUp()
4444

mocha_core/test/test_translator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def setUp(self):
3636

3737
# Create database server to handle service requests
3838
self.db_node = rclpy.create_node('test_database_server_node')
39-
self.dbs = ds.DatabaseServer(robot_configs, topic_configs, node=self.db_node)
39+
self.dbs = ds.DatabaseServer(robot_configs, topic_configs, "charon", node=self.db_node)
4040

4141
super().setUp()
4242

0 commit comments

Comments
 (0)