node.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2021 TIER IV, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef LIDAR_CENTERPOINT__NODE_HPP_
  15. #define LIDAR_CENTERPOINT__NODE_HPP_
  16. #include <lidar_centerpoint/centerpoint_trt.hpp>
  17. #include <rclcpp/rclcpp.hpp>
  18. #include <autoware_auto_perception_msgs/msg/detected_object_kinematics.hpp>
  19. #include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
  20. #include <autoware_auto_perception_msgs/msg/object_classification.hpp>
  21. #include <autoware_auto_perception_msgs/msg/shape.hpp>
  22. #include <sensor_msgs/msg/point_cloud2.hpp>
  23. #include <memory>
  24. #include <string>
  25. #include <vector>
  26. namespace centerpoint
  27. {
  28. class LidarCenterPointNode : public rclcpp::Node
  29. {
  30. public:
  31. explicit LidarCenterPointNode(const rclcpp::NodeOptions & node_options);
  32. private:
  33. void pointCloudCallback(const sensor_msgs::msg::PointCloud2::ConstSharedPtr input_pointcloud_msg);
  34. tf2_ros::Buffer tf_buffer_;
  35. tf2_ros::TransformListener tf_listener_{tf_buffer_};
  36. rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr pointcloud_sub_;
  37. rclcpp::Publisher<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr objects_pub_;
  38. float score_threshold_{0.0};
  39. std::vector<std::string> class_names_;
  40. bool rename_car_to_truck_and_bus_{false};
  41. bool has_twist_{false};
  42. std::unique_ptr<CenterPointTRT> detector_ptr_{nullptr};
  43. };
  44. } // namespace centerpoint
  45. #endif // LIDAR_CENTERPOINT__NODE_HPP_