Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update absl, add codeql action, fix bugs introduced when extracting c… #3

Merged
merged 2 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -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}}"
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
path = "third_party/x-edr-genit",
)
1 change: 1 addition & 0 deletions third_party/x-edr-eigenmath
Submodule x-edr-eigenmath added at 5b55b5
1 change: 1 addition & 0 deletions third_party/x-edr-genit
Submodule x-edr-genit added at 542a05
3 changes: 2 additions & 1 deletion trajectory_planning/path_timing_trajectory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
1 change: 0 additions & 1 deletion trajectory_planning/path_timing_trajectory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion trajectory_planning/timeable_path_cartesian_spline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ absl::Status TimeableCartesianSplinePath::SwitchToWaypointPath(
std::vector<eigenmath::Vector3d> 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<const eigenmath::Vector3d>(translation_waypoints),
switch_translation);
Expand Down
4 changes: 2 additions & 2 deletions trajectory_planning/trajectory_buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down