Skip to content

Commit

Permalink
Merge pull request #349 from tier4/sync-upstream
Browse files Browse the repository at this point in the history
chore: sync upstream
  • Loading branch information
tier4-autoware-private-bot[bot] authored Nov 22, 2022
2 parents 74798df + 5d5ebf7 commit 0a2bc84
Show file tree
Hide file tree
Showing 44 changed files with 377 additions and 585 deletions.
5 changes: 5 additions & 0 deletions .github/sync-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
- source: .github/workflows/build-and-test.yaml
- source: .github/workflows/build-and-test-differential.yaml
- source: .github/workflows/cancel-previous-workflows.yaml

- repository: autowarefoundation/autoware_launch
files:
- source: .github/update-sync-param-files.py
- source: .github/workflows/update-sync-param-files.yaml
13 changes: 13 additions & 0 deletions .github/sync-launch-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- repository: autowarefoundation/autoware_launch
files:
- source: autoware_launch/launch/autoware.launch.xml
- source: autoware_launch/launch/e2e_simulator.launch.xml
- source: autoware_launch/launch/logging_simulator.launch.xml
- source: autoware_launch/launch/planning_simulator.launch.xml
- source: autoware_launch/launch/pointcloud_container.launch.py
- source: autoware_launch/rviz/autoware.rviz
- source: autoware_launch/rviz/image/autoware.png
- source: autoware_launch/CMakeLists.txt
- source: autoware_launch/README.md
- source: autoware_launch/autoware_launch.drawio.svg
- source: autoware_launch/package.xml
80 changes: 80 additions & 0 deletions .github/update-sync-param-files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import argparse
import dataclasses
from pathlib import Path
from typing import List
from typing import Optional

import git

"""
This module updates `sync-param-files.yaml` based on the launch parameter files in `autoware.universe`.
"""

REPO_NAME = "autowarefoundation/autoware.universe"
REPO_URL = f"https://github.com/{REPO_NAME}.git"
CLONE_PATH = Path("/tmp/autoware.universe")


@dataclasses.dataclass
class FileSyncConfig:
source: str
dest: str
replace: Optional[bool] = None
delete_orphaned: Optional[bool] = None
pre_commands: Optional[str] = None
post_commands: Optional[str] = None


def create_tier4_launch_sync_configs(tier4_launch_package_path: Path) -> List[FileSyncConfig]:
launch_package_name = tier4_launch_package_path.name
launch_config_path = tier4_launch_package_path / "config"

sync_configs = []
for param_file_path in tier4_launch_package_path.glob("config/**/*.param.yaml"):
relative_param_file_path = param_file_path.relative_to(launch_config_path)

source = param_file_path.relative_to(CLONE_PATH)
dest = Path("autoware_launch/config") / launch_package_name / relative_param_file_path

sync_configs.append(FileSyncConfig(str(source), str(dest)))

return sync_configs


def dump_sync_config(section_name: str, sync_configs: List[FileSyncConfig]) -> List[str]:
indent = 4 * " "
lines = [f"{indent}# {section_name}\n"]
for sync_config in sync_configs:
lines.append(f"{indent}- source: {sync_config.source}\n")
lines.append(f"{indent} dest: {sync_config.dest}\n")
lines.append("\n")
return lines


def main():
parser = argparse.ArgumentParser()
parser.add_argument("sync_param_files_path", type=Path, help="path to sync-param-files.yaml")
args = parser.parse_args()

# Clone Autoware
if not CLONE_PATH.exists():
git.Repo.clone_from(REPO_URL, CLONE_PATH)

# Create sync config for tier4_*_launch
tier4_launch_package_paths = sorted(
CLONE_PATH.glob("launch/tier4_*_launch"), key=lambda p: p.name
)
tier4_launch_sync_configs_map = {
p.name: create_tier4_launch_sync_configs(p) for p in tier4_launch_package_paths
}

# Create sync-param-files.yaml
with open(args.sync_param_files_path, "w") as f:
f.write(f"- repository: {REPO_NAME}\n")
f.write(" files:\n")
for section_name, sync_config in tier4_launch_sync_configs_map.items():
f.writelines(dump_sync_config(section_name, sync_config))


if __name__ == "__main__":
main()
37 changes: 37 additions & 0 deletions .github/workflows/sync-launch-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: sync-launch-files

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
check-secret:
uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1
secrets:
secret: ${{ secrets.APP_ID }}

sync-files:
needs: check-secret
if: ${{ needs.check-secret.outputs.set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run sync-files
uses: autowarefoundation/autoware-github-actions/sync-files@v1
with:
token: ${{ steps.generate-token.outputs.token }}
config: .github/sync-launch-files.yaml
pr-branch: sync-launch-files
pr-title: "chore: sync launch files"
pr-commit-message: "chore: sync launch files"
pr-labels: |
bot
sync-launch-files
auto-merge-method: squash
54 changes: 54 additions & 0 deletions .github/workflows/update-sync-param-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: update-sync-param-files

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
update-sync-param-files:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Check out repository
uses: actions/checkout@v3

- name: Install GitPython
run: |
pip3 install GitPython
shell: bash

- name: Generate sync-param-files.yaml
run: |
python3 .github/update-sync-param-files.py .github/sync-param-files.yaml
- name: Create PR
id: create-pr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ steps.generate-token.outputs.token }}
base: ${{ github.event.repository.default_branch }}
branch: update-sync-param-files
title: "chore: update sync-param-files.yaml"
commit-message: "chore: update sync-param-files.yaml"
body: ${{ steps.create-pr-body.outputs.body }}

- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}"
shell: bash

- name: Enable auto-merge
if: ${{ steps.create-pr.outputs.pull-request-operation == 'created' }}
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ steps.generate-token.outputs.token }}
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
merge-method: squash
7 changes: 6 additions & 1 deletion autoware_launch/launch/autoware.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
<arg name="map_path" description="point cloud and lanelet2 map directory path"/>
<arg name="vehicle_model" description="vehicle model name"/>
<arg name="sensor_model" description="sensor model name"/>
<arg name="vehicle_id" default="$(env VEHICLE_ID default)" description="vehicle specific ID"/>

<!-- Optional parameters -->
<arg name="rviz" default="true" description="launch rviz"/>
<arg name="use_pointcloud_container" default="true" description="launch pointcloud container"/>
<arg name="perception_mode" default="camera_lidar_fusion" description="select perception mode. camera_lidar_radar_fusion, camera_lidar_fusion, lidar_radar_fusion, lidar, radar"/>
<arg name="pointcloud_container_name" default="pointcloud_container"/>
<arg name="lanelet2_map_file" default="lanelet2_map.osm" description="lanelet2 map file name"/>
<arg name="pointcloud_map_file" default="pointcloud_map.pcd" description="pointcloud map file name"/>
<arg name="cruise_planner_type" default="obstacle_cruise_planner" description="type of cruise planner"/>
<arg name="use_foa" default="false"/>
<arg name="use_perfect_lane_change" default="false" />

Expand All @@ -30,10 +33,11 @@

<!-- Vehicle -->
<group>
<include file="$(find-pkg-share vehicle_launch)/launch/vehicle.launch.xml">
<include file="$(find-pkg-share tier4_vehicle_launch)/launch/vehicle.launch.xml">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
<arg name="sensor_model" value="$(var sensor_model)"/>
<arg name="launch_vehicle_interface" value="true"/>
<arg name="config_dir" value="$(find-pkg-share individual_params)/config/$(var vehicle_id)/$(var sensor_model)"/>
</include>
</group>

Expand Down Expand Up @@ -84,6 +88,7 @@
<include file="$(find-pkg-share planning_launch)/launch/planning.launch.xml">
<arg name="use_pointcloud_container" value="$(var use_pointcloud_container)"/>
<arg name="pointcloud_container_name" value="$(var pointcloud_container_name)"/>
<arg name="cruise_planner_type" value="$(var cruise_planner_type)"/>
<arg name="use_foa" value="$(var use_foa)" />
</include>
</group>
Expand Down
3 changes: 2 additions & 1 deletion autoware_launch/launch/logging_simulator.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@

<!-- Vehicle -->
<group>
<include file="$(find-pkg-share vehicle_launch)/launch/vehicle.launch.xml" if="$(var vehicle)">
<include file="$(find-pkg-share tier4_vehicle_launch)/launch/vehicle.launch.xml" if="$(var vehicle)">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
<arg name="sensor_model" value="$(var sensor_model)"/>
<arg name="vehicle_id" value="$(var vehicle_id)"/>
<arg name="launch_vehicle_interface" value="$(var launch_vehicle_interface)"/>
<arg name="config_dir" value="$(find-pkg-share individual_params)/config/$(var vehicle_id)/$(var sensor_model)"/>
</include>
</group>

Expand Down
5 changes: 4 additions & 1 deletion autoware_launch/launch/planning_simulator.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<arg name="map_path" description="point cloud and lanelet2 map directory path"/>
<arg name="vehicle_model" description="vehicle model name"/>
<arg name="sensor_model" description="sensor model name"/>
<arg name="vehicle_id" default="$(env VEHICLE_ID default)" description="vehicle specific ID"/>

<!-- Optional parameters -->
<arg name="rviz" default="true" description="launch rviz"/>
<arg name="rviz_config" default="$(find-pkg-share autoware_launch)/rviz/autoware.rviz" description="rviz config"/>
Expand Down Expand Up @@ -32,10 +34,11 @@
<let name="launch_vehicle_interface" value="false" if="$(var vehicle_simulation)"/>
<let name="launch_vehicle_interface" value="true" unless="$(var vehicle_simulation)"/>

<include file="$(find-pkg-share vehicle_launch)/launch/vehicle.launch.xml">
<include file="$(find-pkg-share tier4_vehicle_launch)/launch/vehicle.launch.xml">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
<arg name="sensor_model" value="$(var sensor_model)"/>
<arg name="launch_vehicle_interface" value="$(var launch_vehicle_interface)"/>
<arg name="config_dir" value="$(find-pkg-share individual_params)/config/$(var vehicle_id)/$(var sensor_model)"/>
</include>
</group>

Expand Down
2 changes: 1 addition & 1 deletion autoware_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<exec_depend>system_launch</exec_depend>
<exec_depend>tier4_map_launch</exec_depend>
<exec_depend>tier4_sensing_launch</exec_depend>
<exec_depend>vehicle_launch</exec_depend>
<exec_depend>tier4_vehicle_launch</exec_depend>
<exec_depend>web_controller</exec_depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/**:
ros__parameters:
transition_timeout: 3.0
frequency_hz: 10.0
engage_acceptable_limits:
allow_autonomous_in_stopped: true # no check if the velocity is zero, always allowed.
Expand Down
5 changes: 2 additions & 3 deletions control_launch/launch/control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def launch_setup(context, *args, **kwargs):
remappings=[
("input/emergency_state", "/system/emergency/emergency_state"),
("input/steering", "/vehicle/status/steering_status"),
("input/operation_mode", "/control/operation_mode"),
("input/operation_mode", "/system/operation_mode/state"),
("input/auto/control_cmd", "/control/trajectory_follower/control_cmd"),
("input/auto/turn_indicators_cmd", "/planning/turn_indicators_cmd"),
("input/auto/hazard_lights_cmd", "/planning/hazard_lights_cmd"),
Expand All @@ -148,6 +148,7 @@ def launch_setup(context, *args, **kwargs):
("input/emergency/control_cmd", "/system/emergency/control_cmd"),
("input/emergency/hazard_lights_cmd", "/system/emergency/hazard_lights_cmd"),
("input/emergency/gear_cmd", "/system/emergency/gear_cmd"),
("input/mrm_state", "/system/fail_safe/mrm_state"),
("output/vehicle_cmd_emergency", "/control/command/emergency_cmd"),
("output/control_cmd", "/control/command/control_cmd"),
("output/gear_cmd", "/control/command/gear_cmd"),
Expand Down Expand Up @@ -188,10 +189,8 @@ def launch_setup(context, *args, **kwargs):
("control_cmd", "/control/command/control_cmd"),
("control_mode_report", "/vehicle/status/control_mode"),
("gate_operation_mode", "/control/vehicle_cmd_gate/operation_mode"),
("operation_mode_request", "/system/operation_mode_request"),
# output
("is_autonomous_available", "/control/is_autonomous_available"),
("operation_mode", "/control/operation_mode"),
("control_mode_request", "/control/control_mode_request"),
],
parameters=[
Expand Down
16 changes: 0 additions & 16 deletions integration_launch/CMakeLists.txt

This file was deleted.

14 changes: 0 additions & 14 deletions integration_launch/README.md

This file was deleted.

Loading

0 comments on commit 0a2bc84

Please sign in to comment.