diff --git a/examples/client/flexxlam_client_example.cpp b/examples/client/flexxlam_client_example.cpp index d49bf0c..990b72a 100644 --- a/examples/client/flexxlam_client_example.cpp +++ b/examples/client/flexxlam_client_example.cpp @@ -5,15 +5,10 @@ #include "include/flexxlam_client_example.hpp" +#include #include -#include -#include -#include #include -#include -#include -#include namespace flexxlam { @@ -29,14 +24,14 @@ FlexXlamClientExample::FlexXlamClientExample() FlexXlamClientExample::~FlexXlamClientExample() {} -void FlexXlamClientExample::on_get_odometry( +void FlexXlamClientExample::on_push_odometry( const flexxlam_msgs::Odometry &odom) { LOG(INFO) << "[odom] x: " << odom.pose.position.x << ", y: " << odom.pose.position.y << ", z: " << odom.pose.position.z; } -void FlexXlamClientExample::on_get_pointcloud( +void FlexXlamClientExample::on_push_pointcloud( const flexxlam_msgs::PointCloud2 &pointcloud) { LOG(INFO) << "pointcloud: " << pointcloud.data.size(); flexxlam::PushPointCloudProtocol protocol(pointcloud, diff --git a/examples/client/include/flexxlam_client_example.hpp b/examples/client/include/flexxlam_client_example.hpp index a5b92a2..7f627fa 100644 --- a/examples/client/include/flexxlam_client_example.hpp +++ b/examples/client/include/flexxlam_client_example.hpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -34,12 +33,13 @@ class FlexXlamClientExample : public ParsedMessageInterface { /// @param odom Odometry message /// /// This function is called when odometry message is received. - void on_get_odometry(const flexxlam_msgs::Odometry &odom) override; + void on_push_odometry(const flexxlam_msgs::Odometry &odom) override; /// @brief Callback function for pointcloud message /// @param pointcloud Pointcloud message /// @details This function is called when pointcloud message is received. - void on_get_pointcloud(const flexxlam_msgs::PointCloud2 &pointcloud) override; + void on_push_pointcloud( + const flexxlam_msgs::PointCloud2 &pointcloud) override; /// @brief UDP port number int udp_port_; diff --git a/include/communication/flexxlam_parser.hpp b/include/communication/flexxlam_parser.hpp index 7c4e077..763b465 100644 --- a/include/communication/flexxlam_parser.hpp +++ b/include/communication/flexxlam_parser.hpp @@ -22,13 +22,13 @@ struct ParsedMessageInterface { /// @brief Get odometry callback /// @param odom odometry /// @details This function is called when odometry is parsed. - virtual void on_get_odometry(const flexxlam_msgs::Odometry &odom) {} + virtual void on_push_odometry(const flexxlam_msgs::Odometry &odom) {} /// @brief Get pointcloud callback /// @param pointcloud pointcloud /// @details This function is called when pointcloud is parsed. - virtual void on_get_pointcloud(const flexxlam_msgs::PointCloud2 &pointcloud) { - } + virtual void on_push_pointcloud( + const flexxlam_msgs::PointCloud2 &pointcloud) {} /// @brief Request communication config callback /// @param type communication type. Please refer to `protocol::kCommType*` diff --git a/include/protocol/push/push_odometry_protocol.hpp b/include/protocol/push/push_odometry_protocol.hpp index a8f5bc2..7c191c8 100644 --- a/include/protocol/push/push_odometry_protocol.hpp +++ b/include/protocol/push/push_odometry_protocol.hpp @@ -45,7 +45,7 @@ class PushOdometryProtocol : public BaseProtocol { void handle_callback( const vector &callbacks) override { for (auto callback : callbacks) { - callback->on_get_odometry(this->odom); + callback->on_push_odometry(this->odom); } } diff --git a/include/protocol/push/push_pointcloud_protocol.hpp b/include/protocol/push/push_pointcloud_protocol.hpp index 95f7c73..6a3bb5c 100644 --- a/include/protocol/push/push_pointcloud_protocol.hpp +++ b/include/protocol/push/push_pointcloud_protocol.hpp @@ -43,7 +43,7 @@ class PushPointCloudProtocol : public BaseProtocol { void handle_callback( const vector &callbacks) override { for (auto callback : callbacks) { - callback->on_get_pointcloud(this->pointcloud_); + callback->on_push_pointcloud(this->pointcloud_); } } diff --git a/tests/test_flexxlam_parser.cpp b/tests/test_flexxlam_parser.cpp index 037d35f..f6101c6 100644 --- a/tests/test_flexxlam_parser.cpp +++ b/tests/test_flexxlam_parser.cpp @@ -47,7 +47,7 @@ TEST(FlexXlamParser, PushOdometryProtocolParse) { flexxlam::FlexXlamParser parser; struct TestParsedMessageInterface : public flexxlam::ParsedMessageInterface { - void on_get_odometry(const flexxlam_msgs::Odometry &odom) override { + void on_push_odometry(const flexxlam_msgs::Odometry &odom) override { is_odometry_same(expected_odom, odom); } flexxlam_msgs::Odometry expected_odom; @@ -105,7 +105,7 @@ TEST(FlexXlamParser, PushOdometryProtocolParseBatch) { flexxlam::FlexXlamParser parser(102400); struct TestParsedMessageInterface : public flexxlam::ParsedMessageInterface { - void on_get_odometry(const flexxlam_msgs::Odometry &odom) override { + void on_push_odometry(const flexxlam_msgs::Odometry &odom) override { is_odometry_same(expected_odoms[odom_idx++], odom); } vector expected_odoms;