Skip to content

Commit

Permalink
Merge branch 'main' into chore/occlusion_predictor
Browse files Browse the repository at this point in the history
  • Loading branch information
MasatoSaeki authored Jan 7, 2025
2 parents 23b1966 + 19f7f95 commit bb87d39
Show file tree
Hide file tree
Showing 114 changed files with 1,738 additions and 1,070 deletions.
45 changes: 0 additions & 45 deletions .github/actions/evaluate-job-result/action.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
default: humble
required: false
type: string
run-condition:
default: true
required: false
type: boolean
container-suffix:
required: false
default: ""
Expand All @@ -28,6 +32,7 @@ env:

jobs:
build-and-test-differential:
if: ${{ inputs.run-condition }}
runs-on: ${{ inputs.runner }}
container: ${{ inputs.container }}${{ inputs.container-suffix }}
steps:
Expand Down
72 changes: 9 additions & 63 deletions .github/workflows/build-test-tidy-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,98 +40,44 @@ jobs:
shell: bash

build-and-test-differential:
if: ${{ always() }}
needs:
- require-label
uses: ./.github/workflows/build-and-test-differential.yaml
with:
container: ghcr.io/autowarefoundation/autoware:universe-devel
run-condition: ${{ needs.require-label.outputs.result == 'true' }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

build-and-test-differential-cuda:
if: ${{ always() }}
needs: check-if-cuda-job-is-needed
if: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' }}
uses: ./.github/workflows/build-and-test-differential.yaml
with:
container: ghcr.io/autowarefoundation/autoware:universe-devel
container-suffix: -cuda
run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

build-test-pr:
needs:
- build-and-test-differential
- build-and-test-differential-cuda
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Initialize Summary
run: echo "### Build Test PR Results" > $GITHUB_STEP_SUMMARY
shell: bash

- name: Evaluate build-and-test-differential
uses: ./.github/actions/evaluate-job-result
with:
job_result: ${{ needs.build-and-test-differential.result }}
job_name: build-and-test-differential
expected_results: success

- name: Evaluate build-and-test-differential-cuda
if: ${{ always() }}
uses: ./.github/actions/evaluate-job-result
with:
job_result: ${{ needs.build-and-test-differential-cuda.result }}
job_name: build-and-test-differential-cuda
expected_results: success,skipped

clang-tidy-differential:
if: ${{ always() }} # always run to provide report for status check
needs:
- check-if-cuda-job-is-needed
- build-and-test-differential
if: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'false' }}
uses: ./.github/workflows/clang-tidy-differential.yaml
with:
container: ghcr.io/autowarefoundation/autoware:universe-devel
run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'false' && needs.build-and-test-differential.result == 'success' }}

clang-tidy-differential-cuda:
if: ${{ always() }} # always run to provide report for status check
needs:
- check-if-cuda-job-is-needed
- build-and-test-differential-cuda
uses: ./.github/workflows/clang-tidy-differential.yaml
with:
container: ghcr.io/autowarefoundation/autoware:universe-devel
container-suffix: -cuda

clang-tidy-pr:
needs:
- clang-tidy-differential
- clang-tidy-differential-cuda
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Initialize Summary
run: echo "### Clang Tidy PR Results" > $GITHUB_STEP_SUMMARY
shell: bash

- name: Check clang-tidy success
if: ${{ needs.clang-tidy-differential.result == 'success' || needs.clang-tidy-differential-cuda.result == 'success' }}
run: |
echo "✅ Either one of the following has succeeded:" >> $GITHUB_STEP_SUMMARY
- name: Fail if conditions not met
if: ${{ !(needs.clang-tidy-differential.result == 'success' || needs.clang-tidy-differential-cuda.result == 'success') }}
run: |
echo "::error::❌ Either one of the following should have succeeded:"
echo "::error::clang-tidy-differential: ${{ needs.clang-tidy-differential.result }}"
echo "::error::clang-tidy-differential-cuda: ${{ needs.clang-tidy-differential-cuda.result }}"
echo "❌ Either one of the following should have succeeded:" >> $GITHUB_STEP_SUMMARY
exit 1
- name: Print the results
if: ${{ always() }}
run: |
echo "- **clang-tidy-differential:** ${{ needs.clang-tidy-differential.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **clang-tidy-differential-cuda:** ${{ needs.clang-tidy-differential-cuda.result }}" >> $GITHUB_STEP_SUMMARY
run-condition: ${{ needs.check-if-cuda-job-is-needed.outputs.cuda_job_is_needed == 'true' && needs.build-and-test-differential-cuda.result == 'success' }}
5 changes: 5 additions & 0 deletions .github/workflows/clang-tidy-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ on:
default: ubuntu-24.04
required: false
type: string
run-condition:
default: true
required: false
type: boolean

jobs:
clang-tidy-differential:
if: ${{ inputs.run-condition }}
runs-on: ${{ inputs.runner }}
container: ${{ inputs.container }}${{ inputs.container-suffix }}
steps:
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config-optional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# https://github.com/autowarefoundation/sync-file-templates
# To make changes, update the source repository and follow the guidelines in its README.

# https://pre-commit.ci/#configuration
ci:
autofix_commit_msg: "style(pre-commit-optional): autofix"
# we already have our own daily update mechanism, we set this to quarterly
autoupdate_schedule: quarterly
autoupdate_commit_msg: "ci(pre-commit-optional): quarterly autoupdate"

repos:
- repo: https://github.com/tcort/markdown-link-check
rev: v3.12.2
Expand Down
9 changes: 6 additions & 3 deletions common/autoware_test_utils/config/sample_topic_snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ fields:
- name: dynamic_object
type: PredictedObjects # autoware_perception_msgs::msg::PredictedObjects
topic: /perception/object_recognition/objects
# - name: tracked_object
# type: TrackedObjects # autoware_perception_msgs::msg::TrackedObjects
# topic: /perception/object_recognition/tracking/objects
# - name: tracked_object
# type: TrackedObjects # autoware_perception_msgs::msg::TrackedObjects
# topic: /perception/object_recognition/tracking/objects
# - name: path_with_lane_id
# type: PathWithLaneId # tier4_planning_msgs::msg::PathWithLaneId
# topic: /planning/scenario_planning/lane_driving/behavior_planning/path_with_lane_id
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ using autoware_perception_msgs::msg::TrafficLightGroupArray;
using autoware_planning_msgs::msg::LaneletPrimitive;
using autoware_planning_msgs::msg::LaneletRoute;
using autoware_planning_msgs::msg::LaneletSegment;
using autoware_planning_msgs::msg::PathPoint;
using builtin_interfaces::msg::Duration;
using builtin_interfaces::msg::Time;
using geometry_msgs::msg::Accel;
Expand Down Expand Up @@ -97,6 +98,9 @@ Duration parse(const YAML::Node & node);
template <>
Time parse(const YAML::Node & node);

template <>
Point parse(const YAML::Node & node);

template <>
std::vector<Point> parse(const YAML::Node & node);

Expand Down Expand Up @@ -145,6 +149,15 @@ std::vector<PathPointWithLaneId> parse(const YAML::Node & node);
template <>
UUID parse(const YAML::Node & node);

template <>
PathPoint parse(const YAML::Node & node);

template <>
PathPointWithLaneId parse(const YAML::Node & node);

template <>
PathWithLaneId parse(const YAML::Node & node);

template <>
PredictedPath parse(const YAML::Node & node);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

#include <autoware/pyplot/patches.hpp>
#include <autoware/pyplot/pyplot.hpp>
#include <autoware/universe_utils/geometry/geometry.hpp>

#include <tier4_planning_msgs/msg/path_with_lane_id.hpp>

#include <lanelet2_core/primitives/Lanelet.h>
#include <lanelet2_core/primitives/LineString.h>
Expand Down Expand Up @@ -150,7 +153,8 @@ inline void plot_lanelet2_object(
const auto center = (left.front().basicPoint2d() + left.back().basicPoint2d() +
right.front().basicPoint2d() + right.back().basicPoint2d()) /
4.0;
axes.text(Args(center.x(), center.y(), std::to_string(lanelet.id())));
axes.text(
Args(center.x(), center.y(), std::to_string(lanelet.id())), Kwargs("clip_on"_a = true));
}

if (config_opt && config_opt.value().label) {
Expand Down Expand Up @@ -214,16 +218,111 @@ inline void plot_lanelet2_object(
axes.add_patch(Args(poly.unwrap()));
}

struct DrivableAreaConfig
{
static DrivableAreaConfig defaults() { return {"turquoise", 2.0}; }
std::optional<std::string> color{};
std::optional<double> linewidth{};
};

struct PathWithLaneIdConfig
{
static PathWithLaneIdConfig defaults()
{
return {std::nullopt, "k", 1.0, std::nullopt, false, 1.0};
}
std::optional<std::string> label{};
std::optional<std::string> color{};
std::optional<double> linewidth{};
std::optional<DrivableAreaConfig> da{};
bool lane_id{}; //<! flag to plot lane_id text
double quiver_size{1.0}; //<! quiver color is same as `color` or "k" if it is null
};

/**
* @brief plot the point by `axes.plot()`
* @param [in] config_opt argument for plotting the point. if valid, each field is used as the
* kwargs
* @brief plot path_with_lane_id
* @param [in] config_opt if null, only the path points & quiver are plotted with "k" color.
*/
/*
void plot_lanelet2_point(
const lanelet::ConstPoint3d & point, autoware::pyplot::Axes & axes,
const std::optional<PointConfig> & config_opt = std::nullopt);
*/
inline void plot_autoware_object(
const tier4_planning_msgs::msg::PathWithLaneId & path, autoware::pyplot::Axes & axes,
const std::optional<PathWithLaneIdConfig> & config_opt = std::nullopt)
{
py::dict kwargs{};
if (config_opt) {
const auto & config = config_opt.value();
if (config.label) {
kwargs["label"] = config.label.value();
}
if (config.color) {
kwargs["color"] = config.color.value();
}
if (config.linewidth) {
kwargs["linewidth"] = config.linewidth.value();
}
}
std::vector<double> xs;
std::vector<double> ys;
std::vector<double> yaw_cos;
std::vector<double> yaw_sin;
std::vector<std::vector<lanelet::Id>> ids;
const bool plot_lane_id = config_opt ? config_opt.value().lane_id : false;
for (const auto & point : path.points) {
xs.push_back(point.point.pose.position.x);
ys.push_back(point.point.pose.position.y);
const auto th = autoware::universe_utils::getRPY(point.point.pose.orientation).z;
yaw_cos.push_back(std::cos(th));
yaw_sin.push_back(std::sin(th));
if (plot_lane_id) {
ids.emplace_back();
for (const auto & id : point.lane_ids) {
ids.back().push_back(id);
}
}
}
// plot centerline
axes.plot(Args(xs, ys), kwargs);
const auto quiver_scale =
config_opt ? config_opt.value().quiver_size : PathWithLaneIdConfig::defaults().quiver_size;
const auto quiver_color =
config_opt ? (config_opt.value().color ? config_opt.value().color.value() : "k") : "k";
axes.quiver(
Args(xs, ys, yaw_cos, yaw_sin), Kwargs(
"angles"_a = "xy", "scale_units"_a = "xy",
"scale"_a = quiver_scale, "color"_a = quiver_color));
if (plot_lane_id) {
for (size_t i = 0; i < xs.size(); ++i) {
std::stringstream ss;
const char * delimiter = "";
for (const auto id : ids[i]) {
ss << std::exchange(delimiter, ",") << id;
}
axes.text(Args(xs[i], ys[i], ss.str()), Kwargs("clip_on"_a = true));
}
}
// plot drivable area
if (config_opt && config_opt.value().da) {
auto plot_boundary = [&](const decltype(path.left_bound) & points) {
std::vector<double> xs;
std::vector<double> ys;
for (const auto & point : points) {
xs.push_back(point.x);
ys.push_back(point.y);
}
const auto & cfg = config_opt.value().da.value();
py::dict kwargs{};
if (cfg.color) {
kwargs["color"] = cfg.color.value();
}
if (cfg.linewidth) {
kwargs["linewidth"] = cfg.linewidth.value();
}
axes.plot(Args(xs, ys), kwargs);
};
plot_boundary(path.left_bound);
plot_boundary(path.right_bound);
}
}

} // namespace autoware::test_utils

#endif // AUTOWARE_TEST_UTILS__VISUALIZATION_HPP_
1 change: 1 addition & 0 deletions common/autoware_test_utils/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<maintainer email="[email protected]">Takamasa Horibe</maintainer>
<maintainer email="[email protected]">Zulfaqar Azmi</maintainer>
<maintainer email="[email protected]">Mamoru Sobue</maintainer>
<maintainer email="[email protected]">Yukinari Hisaki</maintainer>
<license>Apache License 2.0</license>

<author email="[email protected]">Kyoichi Sugahara</author>
Expand Down
Loading

0 comments on commit bb87d39

Please sign in to comment.