Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Apr 1, 2024
1 parent e630e63 commit 46b9776
Show file tree
Hide file tree
Showing 22 changed files with 70 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ class NodeAdaptor
C & cli, S & srv, CallbackGroup group, std::optional<double> timeout = std::nullopt) const
{
init_cli(cli);
init_srv(
srv, [cli, timeout](auto req, auto res) { *res = *cli->call(req, timeout); }, group);
init_srv(srv, [cli, timeout](auto req, auto res) { *res = *cli->call(req, timeout); }, group);
}

/// Create a subscription wrapper.
Expand Down
3 changes: 1 addition & 2 deletions common/motion_utils/test/src/trajectory/test_trajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5379,8 +5379,7 @@ TEST(Trajectory, removeInvalidOrientationPoints)
auto traj = generateTestTrajectory<Trajectory>(10, 1.0, 1.0);

// no invalid points
testRemoveInvalidOrientationPoints(
traj, [](Trajectory &) {}, traj.points.size());
testRemoveInvalidOrientationPoints(traj, [](Trajectory &) {}, traj.points.size());

// invalid point at the end
testRemoveInvalidOrientationPoints(
Expand Down
16 changes: 5 additions & 11 deletions common/tensorrt_common/src/simple_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,10 @@ std::ostream & operator<<(std::ostream & out, SimpleProfiler & value)
{
out << "index, " << std::setw(12);
out << std::setw(maxLayerNameLength) << layerNameStr << " ";
out << std::setw(12) << "Runtime"
<< "%,"
<< " ";
out << std::setw(12) << "Invocations"
<< " , ";
out << std::setw(12) << "Runtime[ms]"
<< " , ";
out << std::setw(12) << "Avg Runtime[ms]"
<< " ,";
out << std::setw(12) << "Runtime" << "%," << " ";
out << std::setw(12) << "Invocations" << " , ";
out << std::setw(12) << "Runtime[ms]" << " , ";
out << std::setw(12) << "Avg Runtime[ms]" << " ,";
out << std::setw(12) << "Min Runtime[ms]" << std::endl;
}
int index = value.m_index;
Expand All @@ -114,8 +109,7 @@ std::ostream & operator<<(std::ostream & out, SimpleProfiler & value)
out << i << ", ";
out << std::setw(maxLayerNameLength) << elem.first << ",";
out << std::setw(12) << std::fixed << std::setprecision(1)
<< (elem.second.time * 100.0F / totalTime) << "%"
<< ",";
<< (elem.second.time * 100.0F / totalTime) << "%" << ",";
out << std::setw(12) << elem.second.count << ",";
out << std::setw(12) << std::fixed << std::setprecision(2) << elem.second.time << ", ";
out << std::setw(12) << std::fixed << std::setprecision(2)
Expand Down
6 changes: 2 additions & 4 deletions common/tensorrt_common/src/tensorrt_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ void TrtCommon::printNetworkInfo(const std::string & onnx_file_path)
total_gflops += gflops;
total_params += num_weights;
std::cout << "L" << i << " [conv " << k_dims.d[0] << "x" << k_dims.d[1] << " (" << groups
<< ") "
<< "/" << s_dims.d[0] << "] " << dim_in.d[3] << "x" << dim_in.d[2] << "x"
<< ") " << "/" << s_dims.d[0] << "] " << dim_in.d[3] << "x" << dim_in.d[2] << "x"
<< dim_in.d[1] << " -> " << dim_out.d[3] << "x" << dim_out.d[2] << "x"
<< dim_out.d[1];
std::cout << " weights:" << num_weights;
Expand Down Expand Up @@ -368,8 +367,7 @@ bool TrtCommon::buildEngineFromOnnx(
if (num_available_dla > 0) {
std::cout << "###" << num_available_dla << " DLAs are supported! ###" << std::endl;
} else {
std::cout << "###Warning : "
<< "No DLA is supported! ###" << std::endl;
std::cout << "###Warning : " << "No DLA is supported! ###" << std::endl;
}
config->setDefaultDeviceType(nvinfer1::DeviceType::kDLA);
config->setDLACore(build_config_->dla_core_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace kinematic_diagnostics
struct Parameters
{
std::array<bool, static_cast<size_t>(Metric::SIZE)> metrics{}; // default values to false
}; // struct Parameters
}; // struct Parameters

} // namespace kinematic_diagnostics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ class EvalTest : public ::testing::Test
tf_broadcaster_ = std::make_unique<tf2_ros::TransformBroadcaster>(dummy_node);
}

~EvalTest() override
{ /*rclcpp::shutdown();*/
}
~EvalTest() override { /*rclcpp::shutdown();*/ }

void setTargetMetric(kinematic_diagnostics::Metric metric)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace localization_diagnostics
struct Parameters
{
std::array<bool, static_cast<size_t>(Metric::SIZE)> metrics{}; // default values to false
}; // struct Parameters
}; // struct Parameters

} // namespace localization_diagnostics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,11 @@ def launch_setup(context, *args, **kwargs):
components.extend(
pipeline.create_single_frame_obstacle_segmentation_components(
input_topic=LaunchConfiguration("input/pointcloud"),
output_topic=pipeline.single_frame_obstacle_seg_output
if pipeline.use_single_frame_filter or pipeline.use_time_series_filter
else pipeline.output_topic,
output_topic=(
pipeline.single_frame_obstacle_seg_output
if pipeline.use_single_frame_filter or pipeline.use_time_series_filter
else pipeline.output_topic
),
)
)

Expand All @@ -512,18 +514,20 @@ def launch_setup(context, *args, **kwargs):
components.extend(
pipeline.create_single_frame_outlier_filter_components(
input_topic=pipeline.single_frame_obstacle_seg_output,
output_topic=relay_topic
if pipeline.use_time_series_filter
else pipeline.output_topic,
output_topic=(
relay_topic if pipeline.use_time_series_filter else pipeline.output_topic
),
context=context,
)
)
if pipeline.use_time_series_filter:
components.extend(
pipeline.create_time_series_outlier_filter_components(
input_topic=relay_topic
if pipeline.use_single_frame_filter
else pipeline.single_frame_obstacle_seg_output,
input_topic=(
relay_topic
if pipeline.use_single_frame_filter
else pipeline.single_frame_obstacle_seg_output
),
output_topic=pipeline.output_topic,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ RoiPointCloudFusionNode::RoiPointCloudFusionNode(const rclcpp::NodeOptions & opt
cluster_debug_pub_ = this->create_publisher<sensor_msgs::msg::PointCloud2>("debug/clusters", 1);
}

void RoiPointCloudFusionNode::preprocess(__attribute__((unused))
sensor_msgs::msg::PointCloud2 & pointcloud_msg)
void RoiPointCloudFusionNode::preprocess(
__attribute__((unused)) sensor_msgs::msg::PointCloud2 & pointcloud_msg)
{
return;
}

void RoiPointCloudFusionNode::postprocess(__attribute__((unused))
sensor_msgs::msg::PointCloud2 & pointcloud_msg)
void RoiPointCloudFusionNode::postprocess(
__attribute__((unused)) sensor_msgs::msg::PointCloud2 & pointcloud_msg)
{
const auto objects_sub_count = pub_objects_ptr_->get_subscription_count() +
pub_objects_ptr_->get_intra_process_subscription_count();
Expand Down
2 changes: 1 addition & 1 deletion perception/tensorrt_yolox/src/tensorrt_yolox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ void TrtYoloX::generateYoloxProposals(
objects.push_back(obj);
}
} // class loop
} // point anchor loop
} // point anchor loop
}

void TrtYoloX::qsortDescentInplace(ObjectArray & face_objects, int left, int right) const
Expand Down
3 changes: 1 addition & 2 deletions planning/behavior_path_avoidance_module/src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ MarkerArray createEgoStatusMarkerArray(
std::ostringstream string_stream;
string_stream << std::fixed << std::setprecision(2) << std::boolalpha;
string_stream << "avoid_req:" << data.avoid_required << ","
<< "yield_req:" << data.yield_required << ","
<< "safe:" << data.safe;
<< "yield_req:" << data.yield_required << "," << "safe:" << data.safe;
marker.text = string_stream.str();

msg.markers.push_back(marker);
Expand Down
6 changes: 2 additions & 4 deletions planning/behavior_path_planner/src/planner_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,15 +953,13 @@ void PlannerManager::print() const
string_stream << "\n";
string_stream << "approved modules : ";
for (const auto & m : approved_module_ptrs_) {
string_stream << "[" << m->name() << "(" << get_status(m) << ")"
<< "]->";
string_stream << "[" << m->name() << "(" << get_status(m) << ")" << "]->";
}

string_stream << "\n";
string_stream << "candidate module : ";
for (const auto & m : candidate_module_ptrs_) {
string_stream << "[" << m->name() << "(" << get_status(m) << ")"
<< "]->";
string_stream << "[" << m->name() << "(" << get_status(m) << ")" << "]->";
}

string_stream << "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ bool test_algorithm(enum AlgorithmType algo_type, bool dump_rosbag = false)
cost = algo->getWaypoints().compute_length();
}

std::cout << "plan success : " << msec << "[msec]"
<< ", solution cost : " << cost << std::endl;
std::cout << "plan success : " << msec << "[msec]" << ", solution cost : " << cost << std::endl;
const auto result = algo->getWaypoints();
geometry_msgs::msg::PoseArray trajectory;
for (const auto & pose : result.waypoints) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,7 @@ PlannerPlugin::LaneletRoute DefaultPlanner::plan(const RoutePoints & points)

std::stringstream log_ss;
for (const auto & point : points) {
log_ss << "x: " << point.position.x << " "
<< "y: " << point.position.y << std::endl;
log_ss << "x: " << point.position.x << " " << "y: " << point.position.y << std::endl;
}
RCLCPP_DEBUG_STREAM(
logger, "start planning route with check points: " << std::endl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ struct Trajectory : sampler_common::Trajectory
inline std::ostream & operator<<(std::ostream & os, const SamplingParameter & sp)
{
const auto & s = sp.target_state;
return os << "["
<< "T=" << sp.target_duration << ", s=" << s.position.s << ", d=" << s.position.d
return os << "[" << "T=" << sp.target_duration << ", s=" << s.position.s << ", d=" << s.position.d
<< ", s'=" << s.longitudinal_velocity << ", d'=" << s.lateral_velocity
<< ", s\"=" << s.longitudinal_acceleration << ", d\"=" << s.lateral_acceleration << "]";
}
Expand Down
3 changes: 1 addition & 2 deletions planning/sampling_based_planner/path_sampler/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ std::vector<TrajectoryPoint> PathSampler::generatePath(const PlannerData & plann
size_t reuse_idx = 0;
for (reuse_idx = 0; reuse_idx + 1 < prev_path_->lengths.size() &&
prev_path_->lengths[reuse_idx] < reuse_length;
++reuse_idx)
;
++reuse_idx);
if (reuse_idx == 0UL) continue;
const auto reused_path = *prev_path_->subset(0UL, reuse_idx);
reuse_state.curvature = reused_path.curvatures.back();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void pcl::PassThroughUInt16<pcl::PCLPointCloud2>::applyFilter(PCLPointCloud2 & o
nr_p++;
}
output.width = nr_p;
} // !keep_organized_
} // !keep_organized_
} else { // No distance filtering, process all data.
// No need to check for is_organized here as we did it above
for (int cp = 0; cp < nr_points; ++cp, xyz_offset += input_->point_step) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ void Lanelet2MapFilterComponent::pointcloudCallback(const PointCloud2ConstPtr cl
if (!transformPointCloud("map", cloud_msg, input_transformed_cloud_ptr.get())) {
RCLCPP_ERROR_STREAM_THROTTLE(
this->get_logger(), *this->get_clock(), std::chrono::milliseconds(10000).count(),
"Failed transform from "
<< "map"
<< " to " << cloud_msg->header.frame_id);
"Failed transform from " << "map" << " to " << cloud_msg->header.frame_id);
return;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void pcl::VoxelGridNearestCentroid<PointT>::applyFilter(PointCloud & output)
&rgb, reinterpret_cast<const char *>(&input_->points[cp]) + rgba_index, sizeof(int));
centroid[centroid_size - 3] = static_cast<float>((rgb >> 16) & 0x0000ff);
centroid[centroid_size - 2] = static_cast<float>((rgb >> 8) & 0x0000ff);
centroid[centroid_size - 1] = static_cast<float>((rgb)&0x0000ff);
centroid[centroid_size - 1] = static_cast<float>((rgb) & 0x0000ff);
}
pcl::for_each_type<FieldList>(
NdCopyPointEigenFunctor<PointT>(input_->points[cp], centroid));
Expand Down Expand Up @@ -272,7 +272,7 @@ void pcl::VoxelGridNearestCentroid<PointT>::applyFilter(PointCloud & output)
&rgb, reinterpret_cast<const char *>(&input_->points[cp]) + rgba_index, sizeof(int));
centroid[centroid_size - 3] = static_cast<float>((rgb >> 16) & 0x0000ff);
centroid[centroid_size - 2] = static_cast<float>((rgb >> 8) & 0x0000ff);
centroid[centroid_size - 1] = static_cast<float>((rgb)&0x0000ff);
centroid[centroid_size - 1] = static_cast<float>((rgb) & 0x0000ff);
}
pcl::for_each_type<FieldList>(
NdCopyPointEigenFunctor<PointT>(input_->points[cp], centroid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@

#define raspiThermalThrottlingMask (raspiCurrentlyThrottled | raspiSoftTemperatureLimitActive)

#define throttledToString(X) \
(((X)&raspiUnderVoltageDetected) ? "Under-voltage detected" \
: ((X)&raspiArmFrequencyCapped) ? "Arm frequency capped" \
: ((X)&raspiCurrentlyThrottled) ? "Currently throttled" \
: ((X)&raspiSoftTemperatureLimitActive) ? "Soft temperature limit active" \
: ((X)&raspiUnderVoltageHasOccurred) ? "Under-voltage has occurred" \
: ((X)&raspiArmFrequencyCappedHasOccurred) ? "Arm frequency capped has occurred" \
: ((X)&raspiThrottlingHasOccurred) ? "Throttling has occurred" \
: ((X)&raspiSoftTemperatureLimitHasOccurred) ? "Soft temperature limit has occurred" \
: "UNKNOWN")
#define throttledToString(X) \
(((X) & raspiUnderVoltageDetected) ? "Under-voltage detected" \
: ((X) & raspiArmFrequencyCapped) ? "Arm frequency capped" \
: ((X) & raspiCurrentlyThrottled) ? "Currently throttled" \
: ((X) & raspiSoftTemperatureLimitActive) ? "Soft temperature limit active" \
: ((X) & raspiUnderVoltageHasOccurred) ? "Under-voltage has occurred" \
: ((X) & raspiArmFrequencyCappedHasOccurred) ? "Arm frequency capped has occurred" \
: ((X) & raspiThrottlingHasOccurred) ? "Throttling has occurred" \
: ((X) & raspiSoftTemperatureLimitHasOccurred) ? "Soft temperature limit has occurred" \
: "UNKNOWN")

class CPUMonitor : public CPUMonitorBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
#include <string>
#include <vector>

#define reasonToString(X) \
(((X)&nvmlClocksThrottleReasonGpuIdle) ? "GpuIdle" \
: ((X)&nvmlClocksThrottleReasonApplicationsClocksSetting) ? "ApplicationsClocksSetting" \
: ((X)&nvmlClocksThrottleReasonSwPowerCap) ? "SwPowerCap" \
: ((X)&nvmlClocksThrottleReasonHwSlowdown) ? "HwSlowdown" \
: ((X)&nvmlClocksThrottleReasonSyncBoost) ? "SyncBoost" \
: ((X)&nvmlClocksThrottleReasonSwThermalSlowdown) ? "SwThermalSlowdown" \
: ((X)&nvmlClocksThrottleReasonHwThermalSlowdown) ? "HwThermalSlowdown" \
: ((X)&nvmlClocksThrottleReasonHwPowerBrakeSlowdown) ? "HwPowerBrakeSlowdown" \
: ((X)&nvmlClocksThrottleReasonDisplayClockSetting) ? "DisplayClockSetting" \
: "UNKNOWN")
#define reasonToString(X) \
(((X) & nvmlClocksThrottleReasonGpuIdle) ? "GpuIdle" \
: ((X) & nvmlClocksThrottleReasonApplicationsClocksSetting) ? "ApplicationsClocksSetting" \
: ((X) & nvmlClocksThrottleReasonSwPowerCap) ? "SwPowerCap" \
: ((X) & nvmlClocksThrottleReasonHwSlowdown) ? "HwSlowdown" \
: ((X) & nvmlClocksThrottleReasonSyncBoost) ? "SyncBoost" \
: ((X) & nvmlClocksThrottleReasonSwThermalSlowdown) ? "SwThermalSlowdown" \
: ((X) & nvmlClocksThrottleReasonHwThermalSlowdown) ? "HwThermalSlowdown" \
: ((X) & nvmlClocksThrottleReasonHwPowerBrakeSlowdown) ? "HwPowerBrakeSlowdown" \
: ((X) & nvmlClocksThrottleReasonDisplayClockSetting) ? "DisplayClockSetting" \
: "UNKNOWN")

/**
* @brief GPU information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,14 @@ void AccelBrakeMapCalibrator::timerCallback()
"map updating... count: " << update_success_count_ << " / " << update_count_ << "\n\t"
<< "lack_of_data_count: " << lack_of_data_count_ << "\n\t"
<< " failed_to_get_pitch_count: " << failed_to_get_pitch_count_
<< "\n\t" << "too_large_pitch_count: " << too_large_pitch_count_
<< "\n\t" << " too_low_speed_count: " << too_low_speed_count_
<< "\n\t" << "too_large_steer_count: " << too_large_steer_count_
<< "\n\t" << "too_large_jerk_count: " << too_large_jerk_count_
<< "\n\t" << "invalid_acc_brake_count: " << invalid_acc_brake_count_
<< "\n\t"
<< "too_large_pitch_count: " << too_large_pitch_count_ << "\n\t"
<< " too_low_speed_count: " << too_low_speed_count_ << "\n\t"
<< "too_large_steer_count: " << too_large_steer_count_ << "\n\t"
<< "too_large_jerk_count: " << too_large_jerk_count_ << "\n\t"
<< "invalid_acc_brake_count: " << invalid_acc_brake_count_ << "\n\t"
<< "too_large_pedal_spd_count: " << too_large_pedal_spd_count_
<< "\n\t"
<< "update_fail_count_: " << update_fail_count_ << "\n");
<< "\n\t" << "update_fail_count_: " << update_fail_count_ << "\n");

/* valid check */

Expand Down Expand Up @@ -1031,8 +1030,7 @@ bool AccelBrakeMapCalibrator::updateEachValOffset(
RCLCPP_DEBUG_STREAM(
get_logger(), "index: " << ped_idx << ", " << vel_idx
<< ": map_offset_ = " << map_offset_vec_.at(ped_idx).at(vel_idx)
<< " -> " << map_offset << "\t"
<< " covariance = " << covariance);
<< " -> " << map_offset << "\t" << " covariance = " << covariance);

/* input calculated result and update map */
map_offset_vec_.at(ped_idx).at(vel_idx) = map_offset;
Expand Down Expand Up @@ -1060,8 +1058,7 @@ void AccelBrakeMapCalibrator::updateTotalMapOffset(const double measured_acc, co
map_offset_ = map_offset_ + coef * error_map_offset;

RCLCPP_DEBUG_STREAM(
get_logger(), "map_offset_ = " << map_offset_ << "\t"
<< "covariance = " << covariance_);
get_logger(), "map_offset_ = " << map_offset_ << "\t" << "covariance = " << covariance_);

/* update map */
for (std::size_t ped_idx = 0; ped_idx < update_accel_map_value_.size() - 1; ped_idx++) {
Expand Down

0 comments on commit 46b9776

Please sign in to comment.