Skip to content

Commit

Permalink
chore: sync files (autowarefoundation#3227)
Browse files Browse the repository at this point in the history
* chore: sync files

Signed-off-by: GitHub <noreply@github.com>

* style(pre-commit): autofix

---------

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: kenji-miyake <kenji-miyake@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored and ktro2828 committed Apr 7, 2023
1 parent 766bc0b commit 6adc54d
Show file tree
Hide file tree
Showing 149 changed files with 1,345 additions and 344 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BasedOnStyle: Google

AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AllowShortFunctionsOnASingleLine: InlineOnly
BraceWrapping:
AfterClass: true
AfterFunction: true
Expand Down
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/small-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

<!-- Write a brief description of this PR. -->

## Tests performed

<!-- Describe how you have tested this PR. -->
<!-- Although the default value is set to "Not Applicable.", please update this section if the type is either [feat, fix, perf], or if requested by the reviewers. -->

Not applicable.

## Pre-review checklist for the PR author

The PR author **must** check the checkboxes below when creating the PR.
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
args: [--line-length=100]
Expand Down
10 changes: 8 additions & 2 deletions common/autoware_auto_geometry/src/spatial_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ details::Index3 Config2d::index3_(const float32_t x, const float32_t y, const fl
return {x_index(x), y_index(y), Index{}}; // zero initialization
}
////////////////////////////////////////////////////////////////////////////////
Index Config2d::index_(const details::Index3 & idx) const { return bin_impl(idx.x, idx.y); }
Index Config2d::index_(const details::Index3 & idx) const
{
return bin_impl(idx.x, idx.y);
}
////////////////////////////////////////////////////////////////////////////////
Config3d::Config3d(
const float32_t min_x, const float32_t max_x, const float32_t min_y, const float32_t max_y,
Expand Down Expand Up @@ -88,7 +91,10 @@ details::Index3 Config3d::index3_(const float32_t x, const float32_t y, const fl
return {x_index(x), y_index(y), z_index(z)}; // zero initialization
}
////////////////////////////////////////////////////////////////////////////////
Index Config3d::index_(const details::Index3 & idx) const { return bin_impl(idx.x, idx.y, idx.z); }
Index Config3d::index_(const details::Index3 & idx) const
{
return bin_impl(idx.x, idx.y, idx.z);
}
////////////////////////////////////////////////////////////////////////////////
template class SpatialHash<geometry_msgs::msg::Point32, Config2d>;
template class SpatialHash<geometry_msgs::msg::Point32, Config3d>;
Expand Down
5 changes: 4 additions & 1 deletion common/autoware_auto_geometry/test/src/test_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ using TestTypes = TestTypes_<geometry_msgs::msg::Point32>;
TYPED_TEST_SUITE(AreaTest, TestTypes, );

// The empty set has zero area
TYPED_TEST(AreaTest, DegenerateZero) { EXPECT_FLOAT_EQ(0.0, this->area()); }
TYPED_TEST(AreaTest, DegenerateZero)
{
EXPECT_FLOAT_EQ(0.0, this->area());
}

// An individual point has zero area
TYPED_TEST(AreaTest, DegenerateOne)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ namespace rviz_plugins
{
namespace object_detection
{
DetectedObjectsDisplay::DetectedObjectsDisplay() : ObjectPolygonDisplayBase("detected_objects") {}
DetectedObjectsDisplay::DetectedObjectsDisplay() : ObjectPolygonDisplayBase("detected_objects")
{
}

void DetectedObjectsDisplay::processMessage(DetectedObjects::ConstSharedPtr msg)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ namespace rviz_plugins
{
namespace object_detection
{
TrackedObjectsDisplay::TrackedObjectsDisplay() : ObjectPolygonDisplayBase("tracks") {}
TrackedObjectsDisplay::TrackedObjectsDisplay() : ObjectPolygonDisplayBase("tracks")
{
}

void TrackedObjectsDisplay::processMessage(TrackedObjects::ConstSharedPtr msg)
{
Expand Down
10 changes: 8 additions & 2 deletions common/fake_test_node/src/fake_test_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ void detail::FakeNodeCore::set_up(const std::string & test_name)
std::make_shared<tf2_ros::TransformListener>(m_tf_buffer, m_fake_node, kSpinThread);
}

void detail::FakeNodeCore::tear_down() { (void)rclcpp::shutdown(); }
void detail::FakeNodeCore::tear_down()
{
(void)rclcpp::shutdown();
}

std::string detail::get_test_name(const ::testing::TestInfo * info)
{
Expand All @@ -68,7 +71,10 @@ void FakeTestNode::SetUp()
set_up(detail::get_test_name(::testing::UnitTest::GetInstance()->current_test_info()));
}

void FakeTestNode::TearDown() { tear_down(); }
void FakeTestNode::TearDown()
{
tear_down();
}

} // namespace testing
} // namespace tools
Expand Down
10 changes: 8 additions & 2 deletions common/fake_test_node/test/test_fake_test_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,18 @@ void run_test(int32_t value_in_message, FixtureT * fixture)
} // namespace

/// @test Test that we can use a non-parametrized test.
TEST_F(FakeNodeFixture, Test) { run_test(15, this); }
TEST_F(FakeNodeFixture, Test)
{
run_test(15, this);
}

INSTANTIATE_TEST_SUITE_P(
FakeNodeFixtureTests, FakeNodeFixtureParametrized,
// cppcheck-suppress syntaxError // cppcheck doesn't like the trailing comma.
::testing::Values(-5, 0, 42));

/// @test Test that we can use a parametrized test.
TEST_P(FakeNodeFixtureParametrized, Test) { run_test(GetParam(), this); }
TEST_P(FakeNodeFixtureParametrized, Test)
{
run_test(GetParam(), this);
}
5 changes: 4 additions & 1 deletion common/grid_map_utils/src/polygon_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ bool PolygonIterator::operator!=(const PolygonIterator & other) const
return current_line_ != other.current_line_ || current_col_ != other.current_col_;
}

const grid_map::Index & PolygonIterator::operator*() const { return current_index_; }
const grid_map::Index & PolygonIterator::operator*() const
{
return current_index_;
}

void PolygonIterator::goToNextLine()
{
Expand Down
58 changes: 46 additions & 12 deletions common/kalman_filter/src/kalman_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@

#include "kalman_filter/kalman_filter.hpp"

KalmanFilter::KalmanFilter() {}
KalmanFilter::KalmanFilter()
{
}
KalmanFilter::KalmanFilter(
const Eigen::MatrixXd & x, const Eigen::MatrixXd & A, const Eigen::MatrixXd & B,
const Eigen::MatrixXd & C, const Eigen::MatrixXd & Q, const Eigen::MatrixXd & R,
const Eigen::MatrixXd & P)
{
init(x, A, B, C, Q, R, P);
}
KalmanFilter::~KalmanFilter() {}
KalmanFilter::~KalmanFilter()
{
}
bool KalmanFilter::init(
const Eigen::MatrixXd & x, const Eigen::MatrixXd & A, const Eigen::MatrixXd & B,
const Eigen::MatrixXd & C, const Eigen::MatrixXd & Q, const Eigen::MatrixXd & R,
Expand Down Expand Up @@ -53,14 +57,38 @@ bool KalmanFilter::init(const Eigen::MatrixXd & x, const Eigen::MatrixXd & P0)
return true;
}

void KalmanFilter::setA(const Eigen::MatrixXd & A) { A_ = A; }
void KalmanFilter::setB(const Eigen::MatrixXd & B) { B_ = B; }
void KalmanFilter::setC(const Eigen::MatrixXd & C) { C_ = C; }
void KalmanFilter::setQ(const Eigen::MatrixXd & Q) { Q_ = Q; }
void KalmanFilter::setR(const Eigen::MatrixXd & R) { R_ = R; }
void KalmanFilter::getX(Eigen::MatrixXd & x) { x = x_; }
void KalmanFilter::getP(Eigen::MatrixXd & P) { P = P_; }
double KalmanFilter::getXelement(unsigned int i) { return x_(i); }
void KalmanFilter::setA(const Eigen::MatrixXd & A)
{
A_ = A;
}
void KalmanFilter::setB(const Eigen::MatrixXd & B)
{
B_ = B;
}
void KalmanFilter::setC(const Eigen::MatrixXd & C)
{
C_ = C;
}
void KalmanFilter::setQ(const Eigen::MatrixXd & Q)
{
Q_ = Q;
}
void KalmanFilter::setR(const Eigen::MatrixXd & R)
{
R_ = R;
}
void KalmanFilter::getX(Eigen::MatrixXd & x)
{
x = x_;
}
void KalmanFilter::getP(Eigen::MatrixXd & P)
{
P = P_;
}
double KalmanFilter::getXelement(unsigned int i)
{
return x_(i);
}

bool KalmanFilter::predict(
const Eigen::MatrixXd & x_next, const Eigen::MatrixXd & A, const Eigen::MatrixXd & Q)
Expand Down Expand Up @@ -89,7 +117,10 @@ bool KalmanFilter::predict(
const Eigen::MatrixXd x_next = A * x_ + B * u;
return predict(x_next, A, Q);
}
bool KalmanFilter::predict(const Eigen::MatrixXd & u) { return predict(u, A_, B_, Q_); }
bool KalmanFilter::predict(const Eigen::MatrixXd & u)
{
return predict(u, A_, B_, Q_);
}

bool KalmanFilter::update(
const Eigen::MatrixXd & y, const Eigen::MatrixXd & y_pred, const Eigen::MatrixXd & C,
Expand Down Expand Up @@ -121,4 +152,7 @@ bool KalmanFilter::update(
const Eigen::MatrixXd y_pred = C * x_;
return update(y, y_pred, C, R);
}
bool KalmanFilter::update(const Eigen::MatrixXd & y) { return update(y, C_, R_); }
bool KalmanFilter::update(const Eigen::MatrixXd & y)
{
return update(y, C_, R_);
}
14 changes: 11 additions & 3 deletions common/kalman_filter/src/time_delay_kalman_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

#include "kalman_filter/time_delay_kalman_filter.hpp"

TimeDelayKalmanFilter::TimeDelayKalmanFilter() {}
TimeDelayKalmanFilter::TimeDelayKalmanFilter()
{
}

void TimeDelayKalmanFilter::init(
const Eigen::MatrixXd & x, const Eigen::MatrixXd & P0, const int max_delay_step)
Expand All @@ -32,9 +34,15 @@ void TimeDelayKalmanFilter::init(
}
}

Eigen::MatrixXd TimeDelayKalmanFilter::getLatestX() const { return x_.block(0, 0, dim_x_, 1); }
Eigen::MatrixXd TimeDelayKalmanFilter::getLatestX() const
{
return x_.block(0, 0, dim_x_, 1);
}

Eigen::MatrixXd TimeDelayKalmanFilter::getLatestP() const { return P_.block(0, 0, dim_x_, dim_x_); }
Eigen::MatrixXd TimeDelayKalmanFilter::getLatestP() const
{
return P_.block(0, 0, dim_x_, dim_x_);
}

bool TimeDelayKalmanFilter::predictWithDelay(
const Eigen::MatrixXd & x_next, const Eigen::MatrixXd & A, const Eigen::MatrixXd & Q)
Expand Down
5 changes: 4 additions & 1 deletion common/motion_utils/src/vehicle/vehicle_state_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,8 @@ bool VehicleArrivalChecker::isVehicleStoppedAtStopPoint(const double stop_durati
th_arrived_distance_m;
}

void VehicleArrivalChecker::onTrajectory(const Trajectory::SharedPtr msg) { trajectory_ptr_ = msg; }
void VehicleArrivalChecker::onTrajectory(const Trajectory::SharedPtr msg)
{
trajectory_ptr_ = msg;
}
} // namespace motion_utils
5 changes: 4 additions & 1 deletion common/osqp_interface/src/osqp_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ void OSQPInterface::updateAlpha(const double alpha)
}
}

void OSQPInterface::updateScaling(const int scaling) { m_settings->scaling = scaling; }
void OSQPInterface::updateScaling(const int scaling)
{
m_settings->scaling = scaling;
}

void OSQPInterface::updatePolish(const bool polish)
{
Expand Down
40 changes: 32 additions & 8 deletions common/rtc_manager_rviz_plugin/src/rtc_manager_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@

namespace rviz_plugins
{
inline std::string Bool2String(const bool var) { return var ? "True" : "False"; }
inline bool uint2bool(uint8_t var) { return var == static_cast<uint8_t>(0) ? false : true; }
inline std::string Bool2String(const bool var)
{
return var ? "True" : "False";
}
inline bool uint2bool(uint8_t var)
{
return var == static_cast<uint8_t>(0) ? false : true;
}
using std::placeholders::_1;
using std::placeholders::_2;

Expand Down Expand Up @@ -326,12 +332,30 @@ void RTCManagerPanel::onClickCommandRequest(const uint8_t command)
client_rtc_commands_->async_send_request(executable_cooperate_commands_request);
}

void RTCManagerPanel::onClickExecuteVelChange() { onClickChangeRequest(false, Command::ACTIVATE); }
void RTCManagerPanel::onClickWaitVelChange() { onClickChangeRequest(false, Command::DEACTIVATE); }
void RTCManagerPanel::onClickExecutePathChange() { onClickChangeRequest(true, Command::ACTIVATE); }
void RTCManagerPanel::onClickWaitPathChange() { onClickChangeRequest(true, Command::DEACTIVATE); }
void RTCManagerPanel::onClickExecution() { onClickCommandRequest(Command::ACTIVATE); }
void RTCManagerPanel::onClickWait() { onClickCommandRequest(Command::DEACTIVATE); }
void RTCManagerPanel::onClickExecuteVelChange()
{
onClickChangeRequest(false, Command::ACTIVATE);
}
void RTCManagerPanel::onClickWaitVelChange()
{
onClickChangeRequest(false, Command::DEACTIVATE);
}
void RTCManagerPanel::onClickExecutePathChange()
{
onClickChangeRequest(true, Command::ACTIVATE);
}
void RTCManagerPanel::onClickWaitPathChange()
{
onClickChangeRequest(true, Command::DEACTIVATE);
}
void RTCManagerPanel::onClickExecution()
{
onClickCommandRequest(Command::ACTIVATE);
}
void RTCManagerPanel::onClickWait()
{
onClickCommandRequest(Command::DEACTIVATE);
}

void RTCManagerPanel::onRTCStatus(const CooperateStatusArray::ConstSharedPtr msg)
{
Expand Down
30 changes: 24 additions & 6 deletions common/signal_processing/src/butterworth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ void ButterworthFilter::Buttord(
setCutOffFrequency(right_lim);
}

void ButterworthFilter::setOrder(const int & N) { filter_specs_.N = N; }
void ButterworthFilter::setOrder(const int & N)
{
filter_specs_.N = N;
}

void ButterworthFilter::setCutOffFrequency(const double & Wc) { filter_specs_.Wc_rad_sec = Wc; }
void ButterworthFilter::setCutOffFrequency(const double & Wc)
{
filter_specs_.Wc_rad_sec = Wc;
}

/**
* @brief Sets the cut-off and sampling frequencies.
Expand All @@ -76,7 +82,10 @@ void ButterworthFilter::setCutOffFrequency(const double & fc, const double & fs)
filter_specs_.fs = fs;
}

sOrderCutOff ButterworthFilter::getOrderCutOff() const { return filter_specs_; }
sOrderCutOff ButterworthFilter::getOrderCutOff() const
{
return filter_specs_;
}

/**
* @brief Matlab equivalent : [b, a] = butter(n, Wn, 's')
Expand Down Expand Up @@ -306,9 +315,18 @@ void ButterworthFilter::printDiscreteTimeTF() const

RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[%s]", stream.str().c_str());
}
std::vector<double> ButterworthFilter::getAn() const { return AnBn_.An; }
std::vector<double> ButterworthFilter::getBn() const { return AnBn_.Bn; }
sDifferenceAnBn ButterworthFilter::getAnBn() const { return AnBn_; }
std::vector<double> ButterworthFilter::getAn() const
{
return AnBn_.An;
}
std::vector<double> ButterworthFilter::getBn() const
{
return AnBn_.Bn;
}
sDifferenceAnBn ButterworthFilter::getAnBn() const
{
return AnBn_;
}

void ButterworthFilter::printFilterSpecs() const
{
Expand Down
Loading

0 comments on commit 6adc54d

Please sign in to comment.