Skip to content

Commit

Permalink
Merge pull request #160 from UoA-CARES/LaunchMerge
Browse files Browse the repository at this point in the history
Launch merge
  • Loading branch information
emilysteiner71 authored Apr 23, 2024
2 parents 148b0f7 + 21f25cd commit d84ebc9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/controllers/config/rl_policy.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rl_policy:
ros__parameters:
actor_path: Models/sac_actor.pht
critic_path: Models/sac_critic.pht
actor_path: training_logs/SAC-CarTrack-23_11_20_15:33:07/models/SAC_actor.pht
critic_path: training_logs/SAC-CarTrack-23_11_20_15:33:07/models/SAC_critic.pht
algorithm: 'SAC'
observation_mode: 'lidar_only'
2 changes: 1 addition & 1 deletion src/controllers/controllers/rl_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from cares_reinforcement_learning.util.helpers import denormalize
from cares_reinforcement_learning.algorithm.policy import TD3
from cares_reinforcement_learning.networks.TD3 import Actor, Critic
from cares_reinforcement_learning.util.NetworkFactory import NetworkFactory
from cares_reinforcement_learning.util.network_factory import NetworkFactory
from reinforcement_learning.parse_args import parse_args

def main():
Expand Down
24 changes: 0 additions & 24 deletions src/controllers/launch/ftg.launch.py

This file was deleted.

39 changes: 29 additions & 10 deletions src/controllers/launch/sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,9 @@ def generate_launch_description():
}.items() #TODO: this doesn't do anything
)

algorithm = IncludeLaunchDescription(
launch_description_source = PythonLaunchDescriptionSource(
os.path.join(pkg_controllers, f'{alg_launch[alg]}.launch.py')),
launch_arguments={
'car_name': TextSubstitution(text=str(config['sim']['ros__parameters']['car_name']) if 'car_name' in config['sim']['ros__parameters'] else 'f1tenth'),
}.items()
)

# Launch the Environment
main = Node(
sim = Node(
package='controllers',
executable='sim',
parameters=[
Expand All @@ -65,11 +58,37 @@ def generate_launch_description():
emulate_tty=True, # Allows python print to show
)

"""alg_config_path = os.path.join(
get_package_share_directory('controllers'),
f'{alg}_policy.yaml'
)"""

if (f'{alg}' != 'rl'):
alg = Node(
package='controllers',
executable=f'{alg}_policy',
output='screen',
parameters=[{'car_name': TextSubstitution(text=str(config['sim']['ros__parameters']['car_name']) if 'car_name' in config['sim']['ros__parameters'] else 'f1tenth')}],
)
#algorithm = 0
else:
alg = IncludeLaunchDescription(
launch_description_source = PythonLaunchDescriptionSource(
os.path.join(pkg_controllers, f'{alg_launch[alg]}.launch.py')),
launch_arguments={
'car_name': TextSubstitution(text=str(config['sim']['ros__parameters']['car_name']) if 'car_name' in config['sim']['ros__parameters'] else 'f1tenth'),
}.items()
)




return LaunchDescription([
#TODO: Find a way to remove this
SetEnvironmentVariable(name='GZ_SIM_RESOURCE_PATH', value=pkg_f1tenth_description[:-19]),
SetParameter(name='use_sim_time', value=True),
environment,
algorithm,
main
alg,
sim,
#algorithm
])

0 comments on commit d84ebc9

Please sign in to comment.