Skip to content

Commit

Permalink
Merge pull request #1237 from tier4/feature/perf
Browse files Browse the repository at this point in the history
Feature/perf
  • Loading branch information
HansRobo authored May 1, 2024
2 parents 1313ef5 + 31b11a0 commit 934f8f8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from launch.actions import DeclareLaunchArgument, OpaqueFunction

from launch.conditions import IfCondition
from launch.conditions import IfCondition, UnlessCondition

from launch.substitutions import LaunchConfiguration

Expand Down Expand Up @@ -65,6 +65,7 @@ def launch_setup(context, *args, **kwargs):
autoware_launch_package = LaunchConfiguration("autoware_launch_package", default=default_autoware_launch_package_of(architecture_type.perform(context)))
consider_acceleration_by_road_slope = LaunchConfiguration("consider_acceleration_by_road_slope", default=False)
consider_pose_by_road_slope = LaunchConfiguration("consider_pose_by_road_slope", default=True)
enable_perf = LaunchConfiguration("enable_perf", default=False)
global_frame_rate = LaunchConfiguration("global_frame_rate", default=30.0)
global_real_time_factor = LaunchConfiguration("global_real_time_factor", default=1.0)
global_timeout = LaunchConfiguration("global_timeout", default=180)
Expand All @@ -88,6 +89,7 @@ def launch_setup(context, *args, **kwargs):
print(f"autoware_launch_package := {autoware_launch_package.perform(context)}")
print(f"consider_acceleration_by_road_slope := {consider_acceleration_by_road_slope.perform(context)}")
print(f"consider_pose_by_road_slope := {consider_pose_by_road_slope.perform(context)}")
print(f"enable_perf := {enable_perf.perform(context)}")
print(f"global_frame_rate := {global_frame_rate.perform(context)}")
print(f"global_real_time_factor := {global_real_time_factor.perform(context)}")
print(f"global_timeout := {global_timeout.perform(context)}")
Expand All @@ -104,6 +106,12 @@ def launch_setup(context, *args, **kwargs):
print(f"use_sim_time := {use_sim_time.perform(context)}")
print(f"vehicle_model := {vehicle_model.perform(context)}")

def make_launch_prefix():
if enable_perf.perform(context) == "True":
return "perf record -F 10000"
else:
return ""

def make_parameters():
parameters = [
{"architecture_type": architecture_type},
Expand Down Expand Up @@ -143,6 +151,7 @@ def description():
DeclareLaunchArgument("autoware_launch_package", default_value=autoware_launch_package ),
DeclareLaunchArgument("consider_acceleration_by_road_slope", default_value=consider_acceleration_by_road_slope),
DeclareLaunchArgument("consider_pose_by_road_slope", default_value=consider_pose_by_road_slope ),
DeclareLaunchArgument("enable_perf", default_value=enable_perf ),
DeclareLaunchArgument("global_frame_rate", default_value=global_frame_rate ),
DeclareLaunchArgument("global_real_time_factor", default_value=global_real_time_factor ),
DeclareLaunchArgument("global_timeout", default_value=global_timeout ),
Expand Down Expand Up @@ -193,6 +202,7 @@ def description():
namespace="simulation",
output="screen",
parameters=[{"use_sim_time": use_sim_time}]+make_parameters(),
prefix=make_launch_prefix(),
on_exit=ShutdownOnce(),
),
Node(
Expand Down

0 comments on commit 934f8f8

Please sign in to comment.