Skip to content

Commit

Permalink
Merge branch 'ros-2-sim-magic' into ros-2-complete
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrm1 committed Feb 4, 2024
2 parents 7dc06e1 + 68d7dc0 commit 6c23997
Show file tree
Hide file tree
Showing 125 changed files with 4,473 additions and 405 deletions.
20 changes: 0 additions & 20 deletions rktl_autonomy/CMakeLists.txt

This file was deleted.

44 changes: 44 additions & 0 deletions rktl_autonomy/launch/cartpole/cartpole_train.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
import sys

import launch
import launch_ros.actions


def generate_launch_description():
ld = launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(
name='agent_name',
default_value='rocket_league_agent'
),
launch.actions.DeclareLaunchArgument(
name='render',
default_value='false'
),
launch.actions.DeclareLaunchArgument(
name='rate',
default_value='30.0'
),
launch_ros.actions.Node(
package='rktl_autonomy',
executable='cartpole_env',
name='cartpole_env',
output='screen',
parameters=[
{
'/use_sim_time': 'true'
},
{
'frequency': 1/launch.substitutions.LaunchConfiguration('rate') #'$(eval 1/rate)'
},
{
'render': launch.substitutions.LaunchConfiguration('render')
}
]
)
])
return ld


if __name__ == '__main__':
generate_launch_description()
50 changes: 50 additions & 0 deletions rktl_autonomy/launch/rocket_league/rocket_league_agent.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import os
import sys

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


def generate_launch_description():
ld = launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(
name='plot_log',
default_value='false'
),
launch.actions.DeclareLaunchArgument(
name='weights_dir',
default_value='~/catkin_ws/data/rocket_league/'
),
launch.actions.DeclareLaunchArgument(
name='weights_name',
default_value='model'
),
launch_ros.actions.Node(
package='rktl_autonomy',
executable='rocket_league_agent',
name='rocket_league_agent',
output='screen',
parameters=[
{
'weights': launch.substitutions.LaunchConfiguration('weights_dir')+launch.substitutions.LaunchConfiguration('weights_name')#'$(eval weights_dir + weights_name)'
},
get_package_share_directory('rktl_autonomy') + '/config/rocket_league.yaml'
]
),
launch_ros.actions.Node(
condition=launch.conditions.LaunchConfigurationNotEquals('plot_log', 'false'),
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
parameters=[
get_package_share_directory('rktl_autonomy') + '/config/rocket_league.yaml'
]
)
])
return ld


if __name__ == '__main__':
generate_launch_description()
63 changes: 63 additions & 0 deletions rktl_autonomy/launch/rocket_league/rocket_league_train.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import os
import sys

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


def generate_launch_description():
ld = launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(
name='plot_log',
default_value='true'
),
launch.actions.DeclareLaunchArgument(
name='agent_name',
default_value='rocket_league_agent'
),
launch.actions.DeclareLaunchArgument(
name='render',
default_value='false'
),
launch.actions.DeclareLaunchArgument(
name='sim_mode',
default_value='ideal'
),
launch.actions.DeclareLaunchArgument(
name='rate',
default_value='10.0'
),
launch.actions.DeclareLaunchArgument(
name='agent_type',
default_value='none'
),
launch_ros.actions.Node(
condition=launch.conditions.LaunchConfigurationEquals('plot_log', 'true'),
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
parameters=[
{
'/use_sim_time': 'true'
},
get_package_share_directory('rktl_autonomy') + '/config/rocket_league.yaml'
]
),
launch.actions.IncludeLaunchDescription(
launch.launch_description_sources.PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('rktl_launch'), 'launch/rocket_league_sim.launch.py')
),
launch_arguments={
'render': launch.substitutions.LaunchConfiguration('render'),
'sim_mode': launch.substitutions.LaunchConfiguration('sim_mode'),
'agent_type': launch.substitutions.LaunchConfiguration('agent_type')
}.items()
)
])
return ld


if __name__ == '__main__':
generate_launch_description()
93 changes: 93 additions & 0 deletions rktl_autonomy/launch/snake/snake_eval.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import os
import sys

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


def generate_launch_description():
ld = launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(
name='plot_log',
default_value='false'
),
launch.actions.DeclareLaunchArgument(
name='render',
default_value='true'
),
launch.actions.DeclareLaunchArgument(
name='weights',
default_value='~/catkin_ws/data/snake/weights'
),
launch.actions.DeclareLaunchArgument(
name='rate',
default_value='10.0'
),
launch.actions.DeclareLaunchArgument(
name='snake_size',
default_value='7'
),
launch.actions.DeclareLaunchArgument(
name='arena_size',
default_value='10'
),
launch_ros.actions.Node(
package='snakesim',
executable='snake_node',
name='snake_env',
output='screen',
parameters=[
{
'render': launch.substitutions.LaunchConfiguration('render')
},
{
'snake/initial_segments': launch.substitutions.LaunchConfiguration('snake_size')
},
{
'snake/growth': '0'
},
{
'arena/bounds': launch.substitutions.LaunchConfiguration('arena_size')
},
{
'rate': launch.substitutions.LaunchConfiguration('rate')
}
]
),
launch_ros.actions.Node(
package='rktl_autonomy',
executable='snake_agent',
name='snake_agent',
output='screen',
on_exit=launch.actions.Shutdown(),
parameters=[
{
'num_segments': launch.substitutions.LaunchConfiguration('snake_size')
},
{
'field_size': launch.substitutions.LaunchConfiguration('arena_size')
},
{
'weights': launch.substitutions.LaunchConfiguration('weights')
},
get_package_share_directory(
'rktl_autonomy') + '/config/snake.yaml'
]
),
launch_ros.actions.Node(
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
parameters=[
get_package_share_directory(
'rktl_autonomy') + '/config/snake.yaml'
]
)
])
return ld


if __name__ == '__main__':
generate_launch_description()
79 changes: 79 additions & 0 deletions rktl_autonomy/launch/snake/snake_train.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import os
import sys

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


def generate_launch_description():
ld = launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(
name='plot_log',
default_value='false'
),
launch.actions.DeclareLaunchArgument(
name='agent_name',
default_value='snake_agent'
),
launch.actions.DeclareLaunchArgument(
name='render',
default_value='false'
),
launch.actions.DeclareLaunchArgument(
name='rate',
default_value='10.0'
),
launch.actions.DeclareLaunchArgument(
name='snake_size',
default_value='7'
),
launch.actions.DeclareLaunchArgument(
name='arena_size',
default_value='10'
),
launch_ros.actions.Node(
package='snakesim',
executable='snake_node',
name='snake_env',
output='screen',
parameters=[
{
'/use_sim_time': 'true'
},
{
'render': launch.substitutions.LaunchConfiguration('render')
},
{
'snake/initial_segments': launch.substitutions.LaunchConfiguration('snake_size')
},
{
'snake/growth': '0'
},
{
'arena/bounds': launch.substitutions.LaunchConfiguration('arena_size')
},
{
'rate': launch.substitutions.LaunchConfiguration('rate')
}
]
),
launch_ros.actions.Node(
package='rktl_autonomy',
executable='plotter',
name='plotter',
output='screen',
parameters=[
{
'/use_sim_time': 'true'
},
get_package_share_directory(
'rktl_autonomy') + '/config/snake.yaml'
]
)
])
return ld


if __name__ == '__main__':
generate_launch_description()
18 changes: 11 additions & 7 deletions rktl_autonomy/package.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0"?>
<package format="2">
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rktl_autonomy</name>
<version>0.0.0</version>
<version>1.0.0</version>
<description>Deep reinforcement learning for ARC Rocket League project</description>
<maintainer email="[email protected]">Autonomous Robotics Club of Purdue</maintainer>
<license>BSD 3 Clause</license>
<url type="website">http://www.purduearc.com</url>
<author email="[email protected]">James Baxter</author>
<author email="[email protected]">Meenakshi McNamara</author>
<author email="[email protected]">Haddy Alchaer</author>
<author email="[email protected]">Reuben Georgi</author>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>

<buildtool_depend>catkin</buildtool_depend>
<test_depend>rosunit</test_depend>
Expand All @@ -20,4 +21,7 @@
<exec_depend>snakesim</exec_depend>
<exec_depend>rktl_msgs</exec_depend>
<exec_depend>rktl_launch</exec_depend>
</package>
<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file.
Empty file.
Loading

0 comments on commit 6c23997

Please sign in to comment.