Skip to content

Commit

Permalink
fix: auto format
Browse files Browse the repository at this point in the history
Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp>
  • Loading branch information
isamu-takagi committed Aug 2, 2022
1 parent 0beac8d commit 3901ab4
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ MapHeightFitter::MapHeightFitter() : Node("map_height_fitter"), tf2_listener_(tf
"fit_map_height", std::bind(&MapHeightFitter::OnFit, this, _1, _2));
}

void MapHeightFitter::OnMap(const sensor_msgs::msg::PointCloud2::ConstSharedPtr msg)
void MapHeightFitter::on_map(const sensor_msgs::msg::PointCloud2::ConstSharedPtr msg)
{
map_frame_ = msg->header.frame_id;
map_cloud_ = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
pcl::fromROSMsg(*msg, *map_cloud_);
}

double MapHeightFitter::GetGroundHeight(const tf2::Vector3 & point) const
double MapHeightFitter::get_ground_height(const tf2::Vector3 & point) const
{
constexpr double radius = 1.0 * 1.0;
const double x = point.getX();
Expand All @@ -61,7 +61,7 @@ double MapHeightFitter::GetGroundHeight(const tf2::Vector3 & point) const
return std::isfinite(height) ? height : point.getZ();
}

void MapHeightFitter::OnFit(
void MapHeightFitter::on_fit(
const RequestHeightFitting::Request::SharedPtr req,
const RequestHeightFitting::Response::SharedPtr res) const
{
Expand All @@ -76,7 +76,7 @@ void MapHeightFitter::OnFit(
tf2::Transform transform{tf2::Quaternion{}, tf2::Vector3{}};
tf2::fromMsg(stamped.transform, transform);
point = transform * point;
point.setZ(GetGroundHeight(point));
point.setZ(get_ground_height(point));
point = transform.inverse() * point;
res->success = true;
} catch (tf2::TransformException & exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class MapHeightFitter : public rclcpp::Node
rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr sub_map_;
rclcpp::Service<RequestHeightFitting>::SharedPtr srv_fit_;

void OnMap(const sensor_msgs::msg::PointCloud2::ConstSharedPtr msg);
void OnFit(
void on_map(const sensor_msgs::msg::PointCloud2::ConstSharedPtr msg);
void on_fit(
const RequestHeightFitting::Request::SharedPtr req,
const RequestHeightFitting::Response::SharedPtr res) const;
double GetGroundHeight(const tf2::Vector3 & point) const;
double get_ground_height(const tf2::Vector3 & point) const;
};

#endif // MAP_HEIGHT_FITTER__MAP_HEIGHT_FITTER_CORE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <vector>

template <typename T, size_t N>
void CopyVectorToArray(const std::vector<T> & vector, std::array<T, N> & array)
void copy_vector_to_array(const std::vector<T> & vector, std::array<T, N> & array)
{
if (N != vector.size()) {
// throws the error to prevent causing an anonymous bug
Expand All @@ -37,7 +37,7 @@ void CopyVectorToArray(const std::vector<T> & vector, std::array<T, N> & array)
}

template <class NodeT>
std::array<double, 36> GetCovarianceParameter(NodeT * node, const std::string & name)
std::array<double, 36> get_covariance_parameter(NodeT * node, const std::string & name)
{
const auto parameter = node->template declare_parameter<std::vector<double>>(name);
std::array<double, 36> covariance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GnssModule::GnssModule(rclcpp::Node * node)
timeout_ = node->declare_parameter<double>("gnss_pose_timeout");
}

geometry_msgs::msg::PoseWithCovarianceStamped GnssModule::GetPose() const
geometry_msgs::msg::PoseWithCovarianceStamped GnssModule::get_pose() const
{
using Initialize = localization_interface::Initialize;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GnssModule

public:
explicit GnssModule(rclcpp::Node * node);
PoseWithCovarianceStamped GetPose() const;
PoseWithCovarianceStamped get_pose() const;

private:
rclcpp::Clock::SharedPtr clock_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NdtModule::NdtModule(rclcpp::Node * node) : logger_(node->get_logger())
cli_align_ = node->create_client<RequestPoseAlignment>("ndt_align");
}

PoseWithCovarianceStamped NdtModule::AlignPose(const PoseWithCovarianceStamped & pose)
PoseWithCovarianceStamped NdtModule::align_pose(const PoseWithCovarianceStamped & pose)
{
const auto req = std::make_shared<RequestPoseAlignment::Request>();
req->pose_with_covariance = pose;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NdtModule

public:
explicit NdtModule(rclcpp::Node * node);
PoseWithCovarianceStamped AlignPose(const PoseWithCovarianceStamped & pose);
PoseWithCovarianceStamped align_pose(const PoseWithCovarianceStamped & pose);

private:
rclcpp::Logger logger_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ PoseInitializer::~PoseInitializer()
// to delete gnss module
}

void PoseInitializer::ChangeState(State::Message::_state_type state)
void PoseInitializer::change_state(State::Message::_state_type state)
{
state_.stamp = now();
state_.state = state;
pub_state_->publish(state_);
}

void PoseInitializer::OnInitialize(
void PoseInitializer::on_initialize(
const Initialize::Service::Request::SharedPtr req,
const Initialize::Service::Response::SharedPtr res)
{
Expand All @@ -69,22 +69,22 @@ void PoseInitializer::OnInitialize(
Initialize::Service::Response::ERROR_UNSAFE, "The vehicle is not stopped.");
}
try {
ChangeState(State::Message::INITIALIZING);
change_state(State::Message::INITIALIZING);
auto pose = req->pose.empty() ? GetGnssPose() : req->pose.front();
if (ndt_) {
pose = ndt_->AlignPose(pose);
}
pose.pose.covariance = output_pose_covariance_;
pub_reset_->publish(pose);
res->status.success = true;
ChangeState(State::Message::INITIALIZED);
change_state(State::Message::INITIALIZED);
} catch (const ServiceException & error) {
res->status = error.status();
ChangeState(State::Message::UNINITIALIZED);
change_state(State::Message::UNINITIALIZED);
}
}

geometry_msgs::msg::PoseWithCovarianceStamped PoseInitializer::GetGnssPose()
geometry_msgs::msg::PoseWithCovarianceStamped PoseInitializer::get_gnss_pose()
{
if (gnss_) {
PoseWithCovarianceStamped pose = gnss_->GetPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class PoseInitializer : public rclcpp::Node
std::unique_ptr<NdtModule> ndt_;
std::unique_ptr<StopCheckModule> stop_check_;
double stop_check_duration_;
void ChangeState(State::Message::_state_type state);
void OnInitialize(
void change_state(State::Message::_state_type state);
void on_initialize(
const Initialize::Service::Request::SharedPtr req,
const Initialize::Service::Response::SharedPtr res);
PoseWithCovarianceStamped GetGnssPose();
PoseWithCovarianceStamped get_gnss_pose();
};

#endif // POSE_INITIALIZER__POSE_INITIALIZER_CORE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ StopCheckModule::StopCheckModule(rclcpp::Node * node, double buffer_duration)
"stop_check_twist", 1, std::bind(&StopCheckModule::OnTwist, this, std::placeholders::_1));
}

void StopCheckModule::OnTwist(TwistWithCovarianceStamped::ConstSharedPtr msg)
void StopCheckModule::on_twist(TwistWithCovarianceStamped::ConstSharedPtr msg)
{
TwistStamped twist;
twist.header = msg->header;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class StopCheckModule : public motion_utils::VehicleStopCheckerBase
using TwistWithCovarianceStamped = geometry_msgs::msg::TwistWithCovarianceStamped;
using TwistStamped = geometry_msgs::msg::TwistStamped;
rclcpp::Subscription<TwistWithCovarianceStamped>::SharedPtr sub_twist_;
void OnTwist(TwistWithCovarianceStamped::ConstSharedPtr msg);
void on_twist(TwistWithCovarianceStamped::ConstSharedPtr msg);
};

#endif // POSE_INITIALIZER__STOP_CHECK_MODULE_HPP_

0 comments on commit 3901ab4

Please sign in to comment.