Skip to content

Commit

Permalink
Merge branch 'ros-2-complete' of github.com:purdue-arc/rocket_league …
Browse files Browse the repository at this point in the history
…into ros-2-complete
  • Loading branch information
rtjord committed Feb 25, 2024
2 parents 018dd25 + f66d673 commit d8299fa
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/rktl_control/launch/ball.launch.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import os
import sys

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

from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare

def generate_launch_description():
ld = launch.LaunchDescription([
Expand All @@ -16,7 +13,7 @@ def generate_launch_description():
output='screen',
parameters=[
{
launch.substitutions.PathJoinSubstitution(launch_ros.substitutions.FindPackageShare('rktl_control'), '/config/mean_odom_filter.yaml')
PathJoinSubstitution([FindPackageShare('rktl_control'), '/config/mean_odom_filter.yaml'])
}
]
)
Expand Down
28 changes: 16 additions & 12 deletions src/rktl_control/launch/car.launch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import sys

import launch
import launch_ros.actions
from launch.substitutions import *
from launch.conditions import IfCondition

from launch_ros.substitutions import FindPackageShare

def generate_launch_description():
ld = launch.LaunchDescription([
Expand All @@ -17,20 +17,22 @@ def generate_launch_description():
),
launch.actions.GroupAction(
actions=[
launch_ros.actions.PushRosNamespace("cars/" + launch.substitutions.LaunchConfiguration("car_name")),
#launch_ros.actions.PushRosNamespace("cars/" + launch.substitutions.LaunchConfiguration("car_name")),

launch_ros.actions.Node(
package='rktl_control',
executable='particle_odom_filter',
name='particle_odom_filter',
output='screen',
condition=launch.conditions.LaunchConfigurationEquals('use_particle_filter', True),
condition=IfCondition(
EqualsSubstitution(LaunchConfiguration('use_particle_filter'), 'true')
),
parameters=[
{
launch.substitutions.PathJoinSubstitution(launch_ros.substitutions.FindPackageShare('rktl_control'), '/config/particle_odom_filter.yaml')
PathJoinSubstitution([FindPackageShare('rktl_control'), '/config/particle_odom_filter.yaml'])
},
{
'frame_ids/body': launch.substitutions.LaunchConfiguration('car_name')
'frame_ids/body': LaunchConfiguration('car_name')
}
]
),
Expand All @@ -40,13 +42,15 @@ def generate_launch_description():
executable='mean_odom_filter',
name='mean_odom_filter',
output='screen',
condition=launch.conditions.LaunchConfigurationNotEquals('use_particle_filter', True),
condition=IfCondition(
EqualsSubstitution(LaunchConfiguration('use_particle_filter'), 'true')
),
parameters=[
{
launch.substitutions.PathJoinSubstitution(launch_ros.substitutions.FindPackageShare('rktl_control'), '/config/mean_odom_filter.yaml')
PathJoinSubstitution([FindPackageShare('rktl_control'), '/config/mean_odom_filter.yaml'])
},
{
'frame_ids/body': launch.substitutions.LaunchConfiguration('car_name')
'frame_ids/body': LaunchConfiguration('car_name')
}
]
),
Expand All @@ -58,8 +62,8 @@ def generate_launch_description():
output='screen',
parameters=[
{
launch.substitutions.PathJoinSubstitution(launch_ros.substitutions.FindPackageShare('rktl_control'), '/config/controller.yaml')
},
PathJoinSubstitution([FindPackageShare('rktl_control'), '/config/controller.yaml'])
}
]
)
]
Expand Down
31 changes: 31 additions & 0 deletions src/rktl_control/rktl_control/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
This package manipulates a ROS network so that it provides an enviornment to
train an AI. In short, it uses the sim time mechanism used to replay bag files
to mess with how time progresses, so that an arbitrary ROS network can be used
as an environment, specifically, an OpenAI Gym environment.
This can be used for both training and evaluation purposes. When training, it
manipulates time so that the network gets what it needs. It evaluation, it
runs the network as fast as real time is progressing.
License:
BSD 3-Clause License
Copyright (c) 2023, Autonomous Robotics Club of Purdue (Purdue ARC)
All rights reserved.
"""

from ._ros_interface import ROSInterface
# from .cartpole_interface import CartpoleInterface
# from .cartpole_direct_interface import CartpoleDirectInterface
# from .snake_interface import SnakeInterface
from .rocket_league_interface import RocketLeagueInterface
# from .env_counter import EnvCounter

__all__ = [
"ROSInterface",
# "CartpoleInterface",
# "CartpoleDirectInterface",
# "SnakeInterface",
"RocketLeagueInterface"
# "EnvCounter"
]
4 changes: 3 additions & 1 deletion src/rktl_control/rktl_control/mean_odom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def sample_velocity(self):

return (avg_vx, avg_vy, avg_omega)

def main():
MeanOdomFilter()

if __name__ == "__main__":
MeanOdomFilter()
main()
4 changes: 3 additions & 1 deletion src/rktl_control/rktl_control/particle_odom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ def particle_init(self, num_particles):
random_internal),
axis=1)

def main():
ParticleOdomFilter()

if __name__ == "__main__":
ParticleOdomFilter()
main()
4 changes: 3 additions & 1 deletion src/rktl_control/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
tests_require=['pytest'],
entry_points={
'console_scripts': [
"controller_node = rktl_control2.controller:main"
"controller = rktl_control.controller:main",
"mean_odom_filter = rktl_control.mean_odom_filter:main",
"particle_odom_filter = rktl_control.particle_odom_filter:main"
],
},
)

0 comments on commit d8299fa

Please sign in to comment.