Skip to content

Commit

Permalink
Merge branch 'main' into feat/tcp-unit-tests
Browse files Browse the repository at this point in the history
Signed-off-by: Max SCHMELLER <[email protected]>
  • Loading branch information
mojomex committed Nov 27, 2024
2 parents 2f6e8cd + 3d42cd0 commit 8f02df4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
5 changes: 0 additions & 5 deletions nebula_common/include/nebula_common/loggers/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ namespace nebula::drivers::loggers
class Logger
{
public:
Logger() = default;
Logger(const Logger &) = default;
Logger(Logger &&) = delete;
Logger & operator=(const Logger &) = default;
Logger & operator=(Logger &&) = delete;
virtual ~Logger() = default;

virtual void debug(const std::string & message) = 0;
Expand Down
6 changes: 0 additions & 6 deletions nebula_ros/include/nebula_ros/hesai/hesai_ros_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "nebula_common/hesai/hesai_common.hpp"
#include "nebula_common/nebula_common.hpp"
#include "nebula_common/nebula_status.hpp"
#include "nebula_ros/common/mt_queue.hpp"
#include "nebula_ros/hesai/decoder_wrapper.hpp"
#include "nebula_ros/hesai/hw_interface_wrapper.hpp"
#include "nebula_ros/hesai/hw_monitor_wrapper.hpp"
Expand Down Expand Up @@ -98,11 +97,6 @@ class HesaiRosWrapper final : public rclcpp::Node

std::shared_ptr<const nebula::drivers::HesaiSensorConfiguration> sensor_cfg_ptr_{};

/// @brief Stores received packets that have not been processed yet by the decoder thread
MtQueue<std::unique_ptr<nebula_msgs::msg::NebulaPacket>> packet_queue_;
/// @brief Thread to isolate decoding from receiving
std::thread decoder_thread_;

rclcpp::Subscription<pandar_msgs::msg::PandarScan>::SharedPtr packets_sub_{};

bool launch_hw_;
Expand Down
13 changes: 2 additions & 11 deletions nebula_ros/src/hesai/hesai_ros_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ HesaiRosWrapper::HesaiRosWrapper(const rclcpp::NodeOptions & options)
: rclcpp::Node("hesai_ros_wrapper", rclcpp::NodeOptions(options).use_intra_process_comms(true)),
wrapper_status_(Status::NOT_INITIALIZED),
sensor_cfg_ptr_(nullptr),
packet_queue_(3000),
hw_interface_wrapper_(),
hw_monitor_wrapper_(),
decoder_wrapper_()
Expand Down Expand Up @@ -82,12 +81,6 @@ HesaiRosWrapper::HesaiRosWrapper(const rclcpp::NodeOptions & options)

RCLCPP_DEBUG(get_logger(), "Starting stream");

decoder_thread_ = std::thread([this]() {
while (true) {
decoder_wrapper_->process_cloud_packet(packet_queue_.pop());
}
});

if (launch_hw_) {
hw_interface_wrapper_->hw_interface()->RegisterScanCallback(
std::bind(&HesaiRosWrapper::receive_cloud_packet_callback, this, std::placeholders::_1));
Expand Down Expand Up @@ -289,7 +282,7 @@ void HesaiRosWrapper::receive_scan_message_callback(
nebula_pkt_ptr->stamp = pkt.stamp;
std::copy(pkt.data.begin(), pkt.data.end(), std::back_inserter(nebula_pkt_ptr->data));

packet_queue_.push(std::move(nebula_pkt_ptr));
decoder_wrapper_->process_cloud_packet(std::move(nebula_pkt_ptr));
}
}

Expand Down Expand Up @@ -428,9 +421,7 @@ void HesaiRosWrapper::receive_cloud_packet_callback(std::vector<uint8_t> & packe
msg_ptr->stamp.nanosec = static_cast<int>(timestamp_ns % 1'000'000'000);
msg_ptr->data.swap(packet);

if (!packet_queue_.try_push(std::move(msg_ptr))) {
RCLCPP_ERROR_THROTTLE(get_logger(), *get_clock(), 500, "Packet(s) dropped");
}
decoder_wrapper_->process_cloud_packet(std::move(msg_ptr));
}

std::string HesaiRosWrapper::get_calibration_parameter_name(drivers::SensorModel model) const
Expand Down
3 changes: 2 additions & 1 deletion nebula_ros/src/hesai/hw_interface_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

#include "nebula_ros/hesai/hw_interface_wrapper.hpp"

#include "nebula_hw_interfaces/nebula_hw_interfaces_hesai/hesai_hw_interface.hpp"
#include "nebula_ros/common/parameter_descriptors.hpp"
#include "nebula_ros/common/rclcpp_logger.hpp"

#include <nebula_hw_interfaces/nebula_hw_interfaces_hesai/hesai_hw_interface.hpp>

#include <memory>

namespace nebula::ros
Expand Down

0 comments on commit 8f02df4

Please sign in to comment.