Closed jeroenzwan closed 1 year ago
I don't know exactly how to best test the changes I made, as I don't know how to run everything now. Also, I know there will be a few issues with trying the whole experiment, since the system_modes config is outdated (we still need to decide on the exact adaptation options)
A general comment, I was thinking and I think the system_modes_bridge.py
should be part of the mc_mros_reasoner repo.
But this needs to be more generic:
self.node_mapping = {'fd_spiral_low': ('spiral_lc_node', 'SLOW'),
'fd_spiral_medium': ('spiral_lc_node', '__DEFAULT__'),
'fd_spiral_high': ('spiral_lc_node', 'FAST')
}
In the mc_mros_reasoner repo I added a required_function_name
field to the service msg type https://github.com/meta-control/mc_mros_reasoner/commit/67bcd965dcc5577c57b3c6777e8c3f58ba84c67f. So required_function_name and required_fd_name can be the default node_name
and mode
. We just need to think how to populate this dictionary using ros params or a config file. If the solution for this is too complicated, I think we can just use the default names and move it to the mc_mros_reasoner
for now.
I don't know exactly how to best test the changes I made, as I don't know how to run everything now. Also, I know there will be a few issues with trying the whole experiment, since the system_modes config is outdated (we still need to decide on the exact adaptation options)
To test you can use the mock ontology by running
ros2 launch mros2_mock mock.launch.py
ros2 run mros2_mock mock_objective.py
ros2 run pipeline_inspection_metacontrol bridge_service
When I run it I get this error:
Traceback (most recent call last):
File "/home/gus/pipeline_ws/install/pipeline_inspection_metacontrol/lib/pipeline_inspection_metacontrol/bridge_service", line 33, in <module>
sys.exit(load_entry_point('pipeline-inspection-metacontrol', 'console_scripts', 'bridge_service')())
File "/home/gus/pipeline_ws/build/pipeline_inspection_metacontrol/pipeline_inspection_metacontrol/system_modes_bridge.py", line 52, in main
rclpy.spin(bridge_service)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py", line 222, in spin
executor.spin_once()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 713, in spin_once
raise handler.exception()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in __call__
self._handler.send(None)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 418, in handler
await call_coroutine(entity, arg)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 372, in _execute_service
response = await await_or_execute(srv.callback, request, srv.srv_type.Response())
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
return callback(*args)
File "/home/gus/pipeline_ws/build/pipeline_inspection_metacontrol/pipeline_inspection_metacontrol/system_modes_bridge.py", line 35, in change_mode_cb
callback_group=ReentrantCallbackGroup())
NameError: name 'ReentrantCallbackGroup' is not defined
[ros2run]: Process exited with failure 1
A general comment, I was thinking and I think the
system_modes_bridge.py
should be part of the mc_mros_reasoner repo.But this needs to be more generic:
self.node_mapping = {'fd_spiral_low': ('spiral_lc_node', 'SLOW'), 'fd_spiral_medium': ('spiral_lc_node', '__DEFAULT__'), 'fd_spiral_high': ('spiral_lc_node', 'FAST') }
In the mc_mros_reasoner repo I added a
required_function_name
field to the service msg type meta-control/mc_mros_reasoner@67bcd96. So required_function_name and required_fd_name can be the defaultnode_name
andmode
. We just need to think how to populate this dictionary using ros params or a config file. If the solution for this is too complicated, I think we can just use the default names and move it to themc_mros_reasoner
for now.
Hmm yes, I think that might be the best place. I thought it might be nice to have in the exemplar repo as an example, but we could also add that later in an example file as well.
added service to act as bridge between mros and system_modes