From 1160fe3033ee8d895fe26edd1baa943c5b2023dc Mon Sep 17 00:00:00 2001 From: Thomas Buschmann Date: Mon, 22 May 2023 16:49:04 +0200 Subject: [PATCH 1/2] Update absl, add codeql action, fix bugs introduced when extracting code, add git submodules. --- .github/workflows/codeql.yml | 57 +++++++++++++++++++ .gitmodules | 6 ++ WORKSPACE | 10 ++-- third_party/x-edr-eigenmath | 1 + third_party/x-edr-genit | 1 + trajectory_planning/path_timing_trajectory.cc | 3 +- .../path_timing_trajectory_test.cc | 3 +- .../timeable_path_cartesian_spline.cc | 3 +- trajectory_planning/trajectory_buffer_test.cc | 4 +- 9 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/codeql.yml create mode 100644 .gitmodules create mode 160000 third_party/x-edr-eigenmath create mode 160000 third_party/x-edr-genit diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..58ad513 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,57 @@ +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '00 16 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp'] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + token: ${{secrets.X_EDR_REPO_PAK}} + submodules: 'true' + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Build and Test + run: | + bazel build -c opt --config=libc++ trajectory_planning:all + bazel test -c opt --config=libc++ trajectory_planning:all + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bba6918 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "third_party/x-edr-eigenmath"] + path = third_party/x-edr-eigenmath + url = https://github.com/theteamatx/x-edr-eigenmath.git +[submodule "third_party/x-edr-genit"] + path = third_party/x-edr-genit + url = https://github.com/theteamatx/x-edr-genit.git diff --git a/WORKSPACE b/WORKSPACE index 6a1ba2f..9a12272 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -22,20 +22,20 @@ http_archive( ) abseil_ref = "refs/tags" -abseil_ver = "20230125.0" +abseil_ver = "20230125.3" http_archive( name = "com_google_absl", - sha256 = "3ea49a7d97421b88a8c48a0de16c16048e17725c7ec0f1d3ea2683a2a75adc21", + sha256 = "5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36", strip_prefix = "abseil-cpp-%s" % abseil_ver, url = "https://github.com/abseil/abseil-cpp/archive/%s/%s.tar.gz" % (abseil_ref, abseil_ver), ) local_repository( name = "eigenmath", - path = "third_party/eigenmath", + path = "third_party/x-edr-eigenmath", ) local_repository( name = "genit", - path = "third_party/genit", -) \ No newline at end of file + path = "third_party/x-edr-genit", +) diff --git a/third_party/x-edr-eigenmath b/third_party/x-edr-eigenmath new file mode 160000 index 0000000..5b55b55 --- /dev/null +++ b/third_party/x-edr-eigenmath @@ -0,0 +1 @@ +Subproject commit 5b55b55368350d0e5bb4e6fcc47e0ab9fa5bcf4e diff --git a/third_party/x-edr-genit b/third_party/x-edr-genit new file mode 160000 index 0000000..542a055 --- /dev/null +++ b/third_party/x-edr-genit @@ -0,0 +1 @@ +Subproject commit 542a05502bf8b0e94c7b756aead336dbcf2c7471 diff --git a/trajectory_planning/path_timing_trajectory.cc b/trajectory_planning/path_timing_trajectory.cc index 1a1894c..8988076 100644 --- a/trajectory_planning/path_timing_trajectory.cc +++ b/trajectory_planning/path_timing_trajectory.cc @@ -206,7 +206,8 @@ int PathTimingTrajectoryOptions::GetMaxPlanningIterations() const { PathTimingTrajectory::PathTimingTrajectory( const PathTimingTrajectoryOptions& options) : options_(options), - time_step_sec_(options.GetTimeStep() / absl::Seconds(1)) { + time_step_sec_(TimeToSec(absl::time_internal::FromUnixDuration( + options.GetTimeStep()))) { Reset(); } diff --git a/trajectory_planning/path_timing_trajectory_test.cc b/trajectory_planning/path_timing_trajectory_test.cc index 9347b2d..3dbc52e 100644 --- a/trajectory_planning/path_timing_trajectory_test.cc +++ b/trajectory_planning/path_timing_trajectory_test.cc @@ -57,7 +57,6 @@ using ::testing::ElementsAreArray; using ::testing::Pointwise; constexpr bool kVerboseDebugPrinting = true; -constexpr double kSmall = 1e-4; constexpr size_t kNDof = 3; constexpr size_t kNumSamples = 1000; constexpr absl::Duration kTimeStep = absl::Milliseconds(4); @@ -870,7 +869,7 @@ TEST_P(PathTimingTrajectoryTest, SwitchToNewCartesianWaypointPathWorks) { // Modify existing path. ASSERT_OK(path->SwitchToWaypointPath( stopping_path_parameter, new_pose_waypoints, new_joint_waypoints)); - // Set initial velocity such that the trajectory's velocity is continuous. + // Set initial velsocity such that the trajectory's velocity is continuous. ASSERT_OK_AND_ASSIGN(const VectorXd initial_velocity, trajectory->GetVelocityAtTime(start_time)); ASSERT_OK(path->SetInitialVelocity(initial_velocity)); diff --git a/trajectory_planning/timeable_path_cartesian_spline.cc b/trajectory_planning/timeable_path_cartesian_spline.cc index cb1cae8..099398b 100644 --- a/trajectory_planning/timeable_path_cartesian_spline.cc +++ b/trajectory_planning/timeable_path_cartesian_spline.cc @@ -229,7 +229,8 @@ absl::Status TimeableCartesianSplinePath::SwitchToWaypointPath( std::vector translation_waypoints; translation_waypoints.reserve(pose_waypoints.size()); std::transform(pose_waypoints.begin(), pose_waypoints.end(), - translation_waypoints.begin(), kExtractTranslation); + std::back_inserter(translation_waypoints), + kExtractTranslation); const auto translation_projection_status = ProjectPointOnPath( absl::Span(translation_waypoints), switch_translation); diff --git a/trajectory_planning/trajectory_buffer_test.cc b/trajectory_planning/trajectory_buffer_test.cc index f7298ad..9172934 100644 --- a/trajectory_planning/trajectory_buffer_test.cc +++ b/trajectory_planning/trajectory_buffer_test.cc @@ -513,14 +513,14 @@ TEST(TrajectorBuffer, GetPositionAtTime) { // appended above. for (int i = 0; i < trajectory.times.size(); ++i) { ASSERT_OK_AND_ASSIGN( - const VectorXd& position, + const VectorXd position, buffer->GetPositionAtTime(TimeFromSec(trajectory.times[i]))); EXPECT_THAT(position, IsApprox(trajectory.positions[i], 1e-10)) << " i= " << i << " trajectory size: " << trajectory.times.size(); ASSERT_OK_AND_ASSIGN( - const VectorXd& velocity, + const VectorXd velocity, buffer->GetVelocityAtTime(TimeFromSec(trajectory.times[i]))); EXPECT_THAT(velocity, IsApprox(trajectory.velocities[i], 1e-10)) << " i= " << i << " trajectory size: " << trajectory.times.size(); From 980aa29c1a893884970ff9cccfe920c6be76f8de Mon Sep 17 00:00:00 2001 From: Mario Prats Date: Mon, 22 May 2023 18:05:31 -0700 Subject: [PATCH 2/2] fix typo --- trajectory_planning/path_timing_trajectory_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trajectory_planning/path_timing_trajectory_test.cc b/trajectory_planning/path_timing_trajectory_test.cc index 3dbc52e..df9c2db 100644 --- a/trajectory_planning/path_timing_trajectory_test.cc +++ b/trajectory_planning/path_timing_trajectory_test.cc @@ -869,7 +869,7 @@ TEST_P(PathTimingTrajectoryTest, SwitchToNewCartesianWaypointPathWorks) { // Modify existing path. ASSERT_OK(path->SwitchToWaypointPath( stopping_path_parameter, new_pose_waypoints, new_joint_waypoints)); - // Set initial velsocity such that the trajectory's velocity is continuous. + // Set initial velocity such that the trajectory's velocity is continuous. ASSERT_OK_AND_ASSIGN(const VectorXd initial_velocity, trajectory->GetVelocityAtTime(start_time)); ASSERT_OK(path->SetInitialVelocity(initial_velocity));