Skip to content

Commit

Permalink
Merge branch 'ros-2-complete' of https://github.com/purdue-arc/rocket…
Browse files Browse the repository at this point in the history
…_league into ros-2-complete
  • Loading branch information
jcrm1 committed Feb 25, 2024
2 parents d0477ef + d8299fa commit 0b70021
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 88 deletions.
37 changes: 19 additions & 18 deletions src/rktl_autonomy/launch/rocket_league_agent_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ def generate_launch_description():
weights = LaunchConfiguration('weights') # Filepath to weights

plot_log_launch_arg = DeclareLaunchArgument(
'plot_log',
default_value='false',
description='Set to true to enable logging for plotting performance.'
'plot_log',
default_value='false',
description='Set to true to enable logging for plotting performance.'
)

weights_launch_arg = DeclareLaunchArgument(
'weights',
default_value='~/catkin_ws/data/rocket_league/model',
description='filepath to weights.'
'weights',
default_value='~/catkin_ws/data/rocket_league/model',
description='filepath to weights.'
)

plot_log_info = LogInfo(condition=IfCondition(plot_log), msg="Enabling performance plotting...")
Expand All @@ -31,17 +31,18 @@ def generate_launch_description():
)

plotter_node = Node(
condition=IfCondition(plot_log),
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
remappings=[('~log', 'rocket_league_agent/log')],
condition=IfCondition(plot_log),
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
remappings=[('~log', 'rocket_league_agent/log')],
)

return LaunchDescription([plot_log_launch_arg,
weights_launch_arg,
plot_log_info,
agent_node,
plotter_node
])
return LaunchDescription([
plot_log_launch_arg,
weights_launch_arg,
plot_log_info,
agent_node,
plotter_node
])
140 changes: 79 additions & 61 deletions src/rktl_autonomy/launch/rocket_league_train_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,73 +7,91 @@
from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument(
'plot_log',
default_value='true',
description='Set to true to enable logging for plotting performance.'
),
DeclareLaunchArgument(
'agent_name',
default_value='rocket_league_agent',
description='Name of the agent.'
),
DeclareLaunchArgument(
'log_file',
default_value='rocket_league_agent/log',
description='Filepath for logger output'),
DeclareLaunchArgument(
plot_log_launch_arg = DeclareLaunchArgument(
'plot_log',
default_value='true',
description='Set to true to enable logging for plotting performance.'
)

agent_name_launch_arg = DeclareLaunchArgument(
'agent_name',
default_value='rocket_league_agent',
description='Name of the agent.'
)

log_file_launch_arg = DeclareLaunchArgument(
'log_file',
default_value='rocket_league_agent/log',
description='Filepath for logger output'
)

render_launch_arg = DeclareLaunchArgument(
'render',
default_value='false',
description='Set to true to enable rendering.'
),
DeclareLaunchArgument(
)

sim_mode_launch_arg = DeclareLaunchArgument(
'sim_mode',
default_value='ideal',
description='Simulation mode.'
),

DeclareLaunchArgument(
'rate',
default_value='10.0',
description='Rate parameter.'
),
DeclareLaunchArgument(
'agent_type',
default_value='none',
description='Agent type.'
),

LogInfo(
condition=IfCondition(LaunchConfiguration('plot_log')),
msg="Enabling performance plotting..."
),

Node(
package='rktl_autonomy',
executable='rocket_league_agent',
name=LaunchConfiguration('agent_name'),
output='screen',
parameters=[{'rate': LaunchConfiguration('rate')}],
namespace=LaunchConfiguration('agent_name')
),

IncludeLaunchDescription(
PythonLaunchDescriptionSource(['$(find rktl_launch)/launch/rocket_league_sim_launch.py']), # TODO: Replace with the path to the launch file
launch_arguments={
'render': LaunchConfiguration('render'),
'sim_mode': LaunchConfiguration('sim_mode'),
'agent_type': LaunchConfiguration('agent_type'),
}.items(),
),
)

Node(
condition=IfCondition(LaunchConfiguration('plot_log')),
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
remappings=[('~log', LaunchConfiguration('log_file'))],
namespace=LaunchConfiguration('agent_name')
rate_launch_arg = DeclareLaunchArgument(
'rate',
default_value='10.0',
description='Rate parameter.'
)

agent_type_launch_arg = DeclareLaunchArgument(
'agent_type',
default_value='none',
description='Agent type.'
)

plot_log_info = LogInfo(
condition=IfCondition(LaunchConfiguration('plot_log')),
msg="Enabling performance plotting..."
)

agent_node = Node(
package='rktl_autonomy',
executable='rocket_league_agent',
name=LaunchConfiguration('agent_name'),
output='screen',
parameters=[{'rate': LaunchConfiguration('rate')}],
namespace=LaunchConfiguration('agent_name')
)

sim_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(['src/rktl_launch/launch/rocket_league_sim.launch.py']), # TODO: Replace with the path to the launch file
launch_arguments={
'render': LaunchConfiguration('render'),
'sim_mode': LaunchConfiguration('sim_mode'),
'agent_type': LaunchConfiguration('agent_type'),
}.items(),
)

plotter_node = Node(
condition=IfCondition(LaunchConfiguration('plot_log')),
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
remappings=[('~log', LaunchConfiguration('log_file'))],
namespace=LaunchConfiguration('agent_name')
)

return LaunchDescription([
plot_log_launch_arg,
agent_name_launch_arg,
log_file_launch_arg,
render_launch_arg,
sim_mode_launch_arg,
rate_launch_arg,
agent_type_launch_arg,
plot_log_info,
agent_node,
sim_launch,
plotter_node
])
File renamed without changes.
3 changes: 2 additions & 1 deletion src/rktl_autonomy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
tests_require=['pytest'],
entry_points={
'console_scripts': [
'rocket_league_agent = rktl_autonomy.rocket_league_agent:main'
'rocket_league_agent = rktl_autonomy.rocket_league_agent:main',
'plotter = rktl_autonomy.plotter:main'
],
},
)
14 changes: 6 additions & 8 deletions src/rktl_launch/launch/rocket_league_sim.launch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import sys

import launch
import launch_ros.actions
from ament_index_python.packages import get_package_share_directory

from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():
ld = launch.LaunchDescription([
Expand Down Expand Up @@ -50,7 +48,7 @@ def generate_launch_description():
condition=launch.conditions.LaunchConfigurationEquals('sim_mode', 'realistic')
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory(
'rktl_sim'), 'launch', 'visualizer.launch.py')
),
Expand Down Expand Up @@ -88,7 +86,7 @@ def generate_launch_description():
'rktl_launch'), 'rqt','rktl.perspective')
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory(
'rktl_sim'), 'launch/simulator.launch.py')
),
Expand All @@ -97,7 +95,7 @@ def generate_launch_description():
}.items()
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory(
'rktl_planner'), 'launch/simple_agent.launch.py')
),
Expand All @@ -107,7 +105,7 @@ def generate_launch_description():
}.items()
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory(
'rktl_autonomy'), 'launch/rocket_league/rocket_league_agent.launch.py')
),
Expand All @@ -116,7 +114,7 @@ def generate_launch_description():
}.items()
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory(
'rktl_planner'), 'launch/patrol_agent.launch.py')
),
Expand Down

0 comments on commit 0b70021

Please sign in to comment.