Skip to content

Commit

Permalink
Merge pull request #169 from kas-lab/mc_reasoner
Browse files Browse the repository at this point in the history
Remove SuaveReasoner, adjust launchfiles, and runner
  • Loading branch information
Rezenders authored Jun 4, 2024
2 parents e06de04 + 3a04c4a commit 038d1e5
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 200 deletions.
12 changes: 6 additions & 6 deletions runner/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if [ $# -lt 1 ]; then
echo "usage: $0 gui adaptation_manager mission_type runs"
echo example:
echo " "$0 "[true | false] [metacontrol | random | none] [time | distance] runs(integer)"
echo " "$0 "[true | false] [metacontrol | random | none | bt] [time | distance] runs(integer)"
exit 1
fi

Expand All @@ -30,7 +30,7 @@ else
exit 1
fi

if [ "$2" == "metacontrol" ] || [ "$2" == "random" ] || [[ "$2" == "none" ]];
if [ "$2" == "metacontrol" ] || [ "$2" == "random" ] || [[ "$2" == "none" ]] || [[ "$2" == "bt" ]];
then
MANAGER=$2
else
Expand Down Expand Up @@ -106,18 +106,18 @@ run_missions(){
xfce4-terminal --execute ./scripts/launch_sim.sh $GUI &
sleep 30 #let it boot up

rm -f ~/suave_ws/mission.done
rm -f /tmp/mission.done
xfce4-terminal --execute ./scripts/launch_mission.sh $MANAGER $MTYPE $FILENAME &
sleep 30 #let it boot up

echo "start waiting for mission to finish"
start_time=$SECONDS
while [ ! -f ~/suave_ws/mission.done ]
while [ ! -f /tmp/mission.done ]
do
if [ -f ~/suave_ws/mission.done ]
if [ -f /tmp/mission.done ]
then
echo "mission done"
rm ~/suave_ws/mission.done
rm /tmp/mission.done
break;
fi
current_time=$SECONDS
Expand Down
4 changes: 0 additions & 4 deletions runner/scripts/launch_mc.sh

This file was deleted.

15 changes: 12 additions & 3 deletions runner/scripts/launch_mission.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ source ~/suave_ws/install/setup.bash
if [ $# -lt 1 ]; then
echo "usage: $0 adaptation_manager mission_type"
echo example:
echo " "$0 "[metacontrol | random | none] [time | distance]"
echo " "$0 "[metacontrol | random | none | bt] [time | distance]"
exit 1
fi

MANAGER=""
MTYPE=""

if [ "$1" == "metacontrol" ] || [ "$1" == "random" ] || [[ "$1" == "none" ]];
if [ "$1" == "metacontrol" ] || [ "$1" == "random" ] || [[ "$1" == "none" ]] || [[ "$1" == "bt" ]];
then
MANAGER=$1
else
Expand All @@ -33,4 +33,13 @@ else
fi
fi

ros2 launch suave_missions mission.launch.py adaptation_manager:=$MANAGER mission_type:=$MTYPE result_filename:=$3
FILE=$3
MCFILE=${FILE}"_mc_reasoning_time"

if [ "$MANAGER" == "metacontrol" ] || [ "$MANAGER" == "random" ] || [[ "$MANAGER" == "none" ]];
then
ros2 launch suave_missions mission.launch.py adaptation_manager:=$MANAGER mission_type:=$MTYPE result_filename:=$FILE mc_reasoning_time_filename:=$MCFILE
elif [ "$MANAGER" == "bt" ];
then
ros2 launch suave_bt suave_bt.launch.py result_filename:=$3
fi
4 changes: 0 additions & 4 deletions suave.rosinstall
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ repositories:
type: git
url: https://github.com/remaro-network/remaro_worlds.git
version: 2650f19
suave:
type: git
url: https://github.com/kas-lab/suave.git
version: main
mc_mdl_tomasys:
type: git
url: https://github.com/meta-control/mc_mdl_tomasys.git
Expand Down
2 changes: 1 addition & 1 deletion suave/launch/simulation.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_launch_description():
mavros_node = IncludeLaunchDescription(
AnyLaunchDescriptionSource(mavros_launch_path),
launch_arguments={
'fcu_url': 'udp://127.0.0.1:14551@14555',
'fcu_url': 'udp://0.0.0.0:14551@14555',
'gcs_url': 'udp://@localhost:14550',
'system_id': '255',
'component_id': '240',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/suave_reasoner:
ros__parameters:
reasoning_time_save: True
reasoning_time_file_path: '~/suave/results' #Path to save results
reasoning_period: 1.5
61 changes: 0 additions & 61 deletions suave_managing/suave_metacontrol/launch/launch_reasoner.launch.py

This file was deleted.

32 changes: 0 additions & 32 deletions suave_managing/suave_metacontrol/launch/metacontrol.launch.py

This file was deleted.

79 changes: 62 additions & 17 deletions suave_managing/suave_metacontrol/launch/suave_metacontrol.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,78 @@
from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource

from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
pkg_suave_path = get_package_share_directory(
'suave')
tomasys_file = LaunchConfiguration('tomasys_file')
model_file = LaunchConfiguration('model_file')
reasoning_time_filename = LaunchConfiguration('reasoning_time_filename')

pkg_mc_mdl_tomasys_path = get_package_share_directory('mc_mdl_tomasys')
pkg_mros_ontology_path = get_package_share_directory('mros_ontology')

tomasys_files_array = [
os.path.join(pkg_mc_mdl_tomasys_path, 'owl', 'tomasys.owl'),
os.path.join(pkg_mros_ontology_path, 'owl', 'mros.owl')]

tomasys_file_arg = DeclareLaunchArgument(
'tomasys_file',
default_value=str(tomasys_files_array),
description='Path for the tomasys ontologies'
)

pkg_suave_metacontrol_path = get_package_share_directory(
'suave_metacontrol')

metacontrol_launch_path = os.path.join(
suave_ontology_path = os.path.join(
pkg_suave_metacontrol_path,
'launch',
'metacontrol.launch.py')
'config',
'suave.owl')

model_file_arg = DeclareLaunchArgument(
'model_file',
default_value=suave_ontology_path,
description='Path for the application-specific ontology file')

metacontrol_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(metacontrol_launch_path))
reasoning_time_filename_arg = DeclareLaunchArgument(
'reasoning_time_filename',
default_value='metacontrol_reasoning_time',
description='File name for saving metacontrol reasoning time')

metacontrol_config = os.path.join(
pkg_suave_metacontrol_path,
'config',
'metacontrol_config.yaml')

mros_reasoner_node = Node(
package='mros2_reasoner',
executable='mros2_reasoner_node',
name='suave_reasoner',
output='screen',
parameters=[metacontrol_config, {
'tomasys_file': tomasys_file,
'model_file': model_file,
'reasoning_time_filename': reasoning_time_filename,
}],
)

mros2_system_modes_bridge_node = Node(
mros_system_modes_bridge_node = Node(
package='mros2_reasoner',
executable='mros2_system_modes_bridge',
)

task_bridge_node = Node(
package='suave_metacontrol',
executable='task_bridge_metacontrol',
)

pkg_suave_path = get_package_share_directory(
'suave')
suave_launch_path = os.path.join(
pkg_suave_path,
'launch',
Expand All @@ -39,14 +86,12 @@ def generate_launch_description():
'task_bridge': 'False'}.items()
)

task_bridge_node = Node(
package='suave_metacontrol',
executable='task_bridge_metacontrol',
)

return LaunchDescription([
suave_launch,
metacontrol_launch,
mros2_system_modes_bridge_node,
tomasys_file_arg,
model_file_arg,
reasoning_time_filename_arg,
mros_reasoner_node,
mros_system_modes_bridge_node,
task_bridge_node,
suave_launch,
])
3 changes: 0 additions & 3 deletions suave_managing/suave_metacontrol/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
tests_require=['pytest'],
entry_points={
'console_scripts': [
'fake_managed_system = ' +
'suave_metacontrol.fake_managed_system:main',
'suave_reasoner = suave_metacontrol.suave_reasoner:main',
'task_bridge_metacontrol = ' +
' suave_metacontrol.task_bridge_metacontrol:main',
],
Expand Down

This file was deleted.

Loading

0 comments on commit 038d1e5

Please sign in to comment.