Skip to content

Commit

Permalink
add support for events executor
Browse files Browse the repository at this point in the history
Signed-off-by: VictorLee <lzs_1993@qq.com>
  • Loading branch information
ZhenshengLee committed Jul 22, 2021
1 parent c2eb11c commit c71666d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions performance_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ if(PERFORMANCE_TEST_RCLCPP_ENABLED)
add_definitions(-DPERFORMANCE_TEST_RCLCPP_ENABLED)
endif()

# ROS2 rclcpp events executor plugin
option(PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED "" OFF)
if(PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED)
add_definitions(-DPERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED)
endif()

set(${PROJECT_NAME}_SOURCES
src/experiment_execution/analyze_runner.cpp)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define COMMUNICATION_ABSTRACTIONS__RCLCPP_CALLBACK_COMMUNICATOR_HPP_

#include <rclcpp/rclcpp.hpp>
#include "rclcpp/executors/events_executor.hpp"

#include <memory>
#include <atomic>
Expand Down Expand Up @@ -67,5 +68,11 @@ template<class Msg>
using RclcppStaticSingleThreadedExecutorCommunicator =
RclcppCallbackCommunicator<Msg, rclcpp::executors::StaticSingleThreadedExecutor>;

#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
template<class Msg>
using RclcppEventsExecutorCommunicator =
RclcppCallbackCommunicator<Msg, rclcpp::executors::EventsExecutor>;
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED

} // namespace performance_test
#endif // COMMUNICATION_ABSTRACTIONS__RCLCPP_CALLBACK_COMMUNICATOR_HPP_
5 changes: 5 additions & 0 deletions performance_test/src/data_running/data_runner_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ std::shared_ptr<DataRunnerBase> DataRunnerFactory::get(
if (com_mean == CommunicationMean::RCLCPP_WAITSET) {
ptr = std::make_shared<DataRunner<RclcppWaitsetCommunicator<T>>>(run_type);
}
#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
if (com_mean == CommunicationMean::RCLCPP_EVENTS_EXECUTOR) {
ptr = std::make_shared<DataRunner<RclcppEventsExecutorCommunicator<T>>>(run_type);
}
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
#endif
#ifdef PERFORMANCE_TEST_FASTRTPS_ENABLED
if (com_mean == CommunicationMean::FASTRTPS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ enum class CommunicationMean
RCLCPP_SINGLE_THREADED_EXECUTOR,
RCLCPP_STATIC_SINGLE_THREADED_EXECUTOR,
RCLCPP_WAITSET,
#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
RCLCPP_EVENTS_EXECUTOR,
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
#endif
#ifdef PERFORMANCE_TEST_FASTRTPS_ENABLED
FASTRTPS,
Expand Down Expand Up @@ -62,6 +65,11 @@ inline std::ostream & operator<<(std::ostream & stream, const CommunicationMean
if (cm == CommunicationMean::RCLCPP_WAITSET) {
return stream << "RCLCPP_WAITSET";
}
#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
if (cm == CommunicationMean::RCLCPP_EVENTS_EXECUTOR) {
return stream << "RCLCPP_EVENTS_EXECUTOR";
}
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
#endif
#ifdef PERFORMANCE_TEST_FASTRTPS_ENABLED
if (cm == CommunicationMean::FASTRTPS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void ExperimentConfiguration::setup(int argc, char ** argv)
allowedCommunications.push_back("rclcpp-single-threaded-executor");
allowedCommunications.push_back("rclcpp-static-single-threaded-executor");
allowedCommunications.push_back("rclcpp-waitset");
#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
allowedCommunications.push_back("rclcpp-events-executor");
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
#endif
#ifdef PERFORMANCE_TEST_FASTRTPS_ENABLED
allowedCommunications.push_back("FastRTPS");
Expand Down Expand Up @@ -291,6 +294,14 @@ void ExperimentConfiguration::setup(int argc, char ** argv)
m_com_mean_str = "RCLCPP_WAITSET";
#endif
}
#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
if (comm_str == "rclcpp-events-executor") {
m_com_mean = CommunicationMean::RCLCPP_EVENTS_EXECUTOR;
#ifdef PERFORMANCE_TEST_ODB_FOR_SQL_ENABLED
m_com_mean_str = "RCLCPP_EVENTS_EXECUTOR";
#endif
}
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
#endif
#ifdef PERFORMANCE_TEST_FASTRTPS_ENABLED
if (comm_str == "FastRTPS") {
Expand Down Expand Up @@ -456,6 +467,12 @@ bool ExperimentConfiguration::use_ros2_layers() const
return true;
}
#endif
#ifdef PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
if (m_com_mean == CommunicationMean::RCLCPP_EVENTS_EXECUTOR)
{
return true;
}
#endif // PERFORMANCE_TEST_RCLCPP_EVENTS_EXECUTOR_ENABLED
return false;
}
uint32_t ExperimentConfiguration::dds_domain_id() const
Expand Down

0 comments on commit c71666d

Please sign in to comment.