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 Dec 27, 2023
1 parent a37e310 commit 86d3069
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions tools/reaction_analyzer/include/reaction_analyzer_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ using autoware_auto_planning_msgs::msg::Trajectory;
using geometry_msgs::msg::Pose;
using nav_msgs::msg::Odometry;
using sensor_msgs::msg::PointCloud2;
using ControlBuffer = std::pair<std::vector<AckermannControlCommand>, std::optional<AckermannControlCommand>>;
using ControlBuffer =
std::pair<std::vector<AckermannControlCommand>, std::optional<AckermannControlCommand>>;

using BufferVariant = std::variant<
ControlBuffer
// , std::vector<OtherMessageType> // Add other message types here
>;
using BufferVariant =
std::variant<ControlBuffer
// , std::vector<OtherMessageType> // Add other message types here
>;

enum class MessageType
{
enum class MessageType {
Unknown = 0,
AckermannControlCommand = 1,
};
Expand Down Expand Up @@ -118,7 +118,8 @@ class ReactionAnalyzerNode : public rclcpp::Node
private:
void initObservers(const ChainModules & modules);
std::vector<rclcpp::SubscriptionBase::SharedPtr> subscribers_;
void controlCommandOutputCallback(const std::string & node_name, const AckermannControlCommand::ConstSharedPtr msg_ptr);
void controlCommandOutputCallback(
const std::string & node_name, const AckermannControlCommand::ConstSharedPtr msg_ptr);

std::unordered_map<std::string, BufferVariant> messageBuffers_;

Expand Down Expand Up @@ -164,8 +165,7 @@ class ReactionAnalyzerNode : public rclcpp::Node
void onTimer();
void setControlCommandToBuffer(
std::vector<AckermannControlCommand> & buffer, const AckermannControlCommand & cmd);
std::optional<size_t> findFirstBrakeIdx(
const std::vector<AckermannControlCommand> & cmd_array);
std::optional<size_t> findFirstBrakeIdx(const std::vector<AckermannControlCommand> & cmd_array);

// Callbacks
void vehiclePoseCallback(const Odometry::ConstSharedPtr msg_ptr);
Expand All @@ -183,8 +183,8 @@ class ReactionAnalyzerNode : public rclcpp::Node
std::optional<rclcpp::Time> last_initialize_test_time_;

// measurement for control cmd
// std::optional<ControlCommandWithSeenTime> trajectory_follower_brake_cmd;
// std::optional<ControlCommandWithSeenTime> vehicle_cmd_gate_brake_cmd;
// std::optional<ControlCommandWithSeenTime> trajectory_follower_brake_cmd;
// std::optional<ControlCommandWithSeenTime> vehicle_cmd_gate_brake_cmd;

// Timer
rclcpp::TimerBase::SharedPtr timer_;
Expand Down
14 changes: 7 additions & 7 deletions tools/reaction_analyzer/src/reaction_analyzer_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void ReactionAnalyzerNode::onTimer()
all_topics_reacted_ = false;
const auto brake_start_idx = findFirstBrakeIdx(message->first);
if (brake_start_idx) {
// std::cout << "found brake idx" <<std::endl;
// std::cout << "found brake idx" <<std::endl;
mutex_.lock();
auto * tmp = std::get_if<ControlBuffer>(&messageBuffers_[key]);
if (tmp) tmp->second = message->first.at(brake_start_idx.value());
Expand Down Expand Up @@ -451,7 +451,7 @@ void ReactionAnalyzerNode::controlCommandOutputCallback(
ControlBuffer buffer(std::vector<AckermannControlCommand>{*msg_ptr}, std::nullopt);
variant = buffer;
}
// std::cout << node_name << std::endl;
// std::cout << node_name << std::endl;
setControlCommandToBuffer(std::get<ControlBuffer>(variant).first, *msg_ptr);
}

Expand Down Expand Up @@ -520,17 +520,17 @@ void ReactionAnalyzerNode::setControlCommandToBuffer(
itr++;
}
}
// std::cout << "buffer size: " << buffer.size() << std::endl;
// std::cout << "buffer size: " << buffer.size() << std::endl;
buffer.emplace_back(cmd);
}

std::optional<size_t> ReactionAnalyzerNode::findFirstBrakeIdx(
const std::vector<AckermannControlCommand> & cmd_array)
{
// for (size_t k = 0; k < cmd_array.size(); ++k) {
// std::cout << cmd_array.at(k).longitudinal.acceleration << " ";
// }
// std::cout << std::endl;
// for (size_t k = 0; k < cmd_array.size(); ++k) {
// std::cout << cmd_array.at(k).longitudinal.acceleration << " ";
// }
// std::cout << std::endl;

if (
cmd_array.size() < static_cast<size_t>(node_params_.min_number_descending_order_control_cmd) ||
Expand Down

0 comments on commit 86d3069

Please sign in to comment.