Skip to content

Commit

Permalink
Update to use perspectives in RQT interface
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoJManasAlvarez committed Feb 10, 2024
1 parent a29f0ba commit d9d8706
Show file tree
Hide file tree
Showing 41 changed files with 6,883 additions and 136 deletions.
12 changes: 8 additions & 4 deletions mars_supervisor_pkg/mars_supervisor_pkg/supervisor_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def initialize(self):
cmd_file = self.get_parameter('file').get_parameter_value().string_value
config_path = self.get_parameter('config').get_parameter_value().string_value

with open(config_path, 'r') as file:
self.config = yaml.safe_load(file)

with open(cmd_file, 'r') as file:
self.cmd = yaml.safe_load(file)

Expand Down Expand Up @@ -71,11 +74,12 @@ def initialize(self):

self.timer_task = self.create_timer(0.1, self.iterate)

if self.config['Data_Logging']['enable']:
e = datetime.datetime.now()
target = os.getcwd() + "/" + e.strftime("%Y-%m-%d-%H-%M")+ "/config.yaml"
# os.mkdir(e.strftime("%Y-%m-%d-%H-%M"))
shutil.copy(config_path, target)
self.get_logger().info('Supervisor::inicialized.')
e = datetime.datetime.now()
target = os.getcwd() + "/" + e.strftime("%Y-%m-%d-%H-%M")+ "/config.yaml"
# os.mkdir(e.strftime("%Y-%m-%d-%H-%M"))
shutil.copy(config_path, target)

def iterate(self):
if self.ready:
Expand Down
1 change: 1 addition & 0 deletions roboticpark_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ install(
resources
worlds
rviz
rqt
DESTINATION share/${PROJECT_NAME}
)

Expand Down
28 changes: 23 additions & 5 deletions roboticpark_config/launch/experience.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def get_ros2_nodes(context, *args):
use_sim_time = LaunchConfiguration('use_sim_time', default=True)
use_sim_time = LaunchConfiguration('use_sim_time', default=False)
distributed_architecture = False
# ExecuteProcess(cmd=['ros2', 'bag', 'record', '-a', '-o', e.strftime("%Y-%m-%d-%H-%M"), ], output='screen'),
node_list = []
Expand Down Expand Up @@ -141,9 +141,11 @@ def get_ros2_nodes(context, *args):
executable='swarm_driver',
name='swarm',
output='screen',
shell=True,
emulate_tty=True,
parameters=[
{'config': config_path},
{'use_sim_time': use_sim_time},
# {'use_sim_time': use_sim_time},
{'robots': physical_crazyflie_list}
]
)
Expand All @@ -169,13 +171,15 @@ def get_ros2_nodes(context, *args):
#--------------------#
if documents['Interface']['enable']:
if documents['Interface']['rqt']['enable']:
rqt_config_path = os.path.join(general_package_dir, 'rqt', documents['Interface']['rqt']['file'])
node_list.append(Node(
package=documents['Interface']['rqt']['node']['pkg'],
executable=documents['Interface']['rqt']['node']['executable'],
name=documents['Interface']['rqt']['node']['name'],
parameters=[
{'use_sim_time': use_sim_time},
],
arguments=['--perspective-file', rqt_config_path],
))
if documents['Interface']['rviz2']['enable']:
rviz_config_path = os.path.join(general_package_dir, 'rviz', documents['Interface']['rviz2']['file'])
Expand Down Expand Up @@ -242,14 +246,14 @@ def get_ros2_nodes(context, *args):
executable='supervisor_node',
name='supervisor',
parameters=[
{'use_sim_time': False},
# {'use_sim_time': use_sim_time},
{'file': topic_config_path},
{'config': config_path},
],
)

node_list.append(supervisor)

'''
kill_ros2_supervisor = launch.actions.RegisterEventHandler(
event_handler=launch.event_handlers.OnProcessExit(
target_action=supervisor,
Expand All @@ -260,11 +264,25 @@ def get_ros2_nodes(context, *args):
)
node_list.append(kill_ros2_supervisor)

'''
#---------------#
# Other #
#---------------#
print('TO-DO: Physical nodes: Positioning System')

for agent in documents['Other']:
if documents['Other'][agent]['enable']:
config_node_path = os.path.join(general_package_dir, 'resources', documents['Other'][agent]['file'])
node = Node(
package=documents['Other'][agent]['pkg'],
executable=documents['Other'][agent]['executable'],
name=documents['Other'][agent]['name'],
parameters=[
# {'use_sim_time': use_sim_time},
{'file': config_node_path},
],
)
node_list.append(node)

return node_list

Expand Down
Loading

0 comments on commit d9d8706

Please sign in to comment.