Skip to content

Commit

Permalink
Check compile-time versus run-time version of mc_rtc
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet committed Jan 2, 2020
1 parent a8e91b6 commit e8b2319
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/MCControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <mc_rbdyn/rpy_utils.h>
#include <mc_rtc/logging.h>
#include <mc_rtc/version.h>

#include <RBDyn/FK.h>
#include <RBDyn/FV.h>
Expand Down Expand Up @@ -51,6 +52,18 @@ static const char* mccontrol_spec[] =
};
// </rtc-template>

namespace
{
bool init_controller()
{
if(mc_rtc::MC_RTC_VERSION != mc_rtc::version())
{
LOG_ERROR("MCControl was compiled with " << mc_rtc::MC_RTC_VERSION << " but mc_rtc is at version " << mc_rtc::version() << ", you might face subtle issues and should recompile mc_openrtm")
}
return false;
}
}

MCControl::MCControl(RTC::Manager* manager)
// <rtc-template block="initializer">
: RTC::DataFlowComponentBase(manager),
Expand All @@ -71,7 +84,7 @@ MCControl::MCControl(RTC::Manager* manager)
m_rpyOutOut("rpyOut", m_rpyOut),
m_MCControlServicePortPort("MCControlServicePort"),
m_service0(this),
init(false)
init(init_controller())
// </rtc-template>
// clang-format on
{
Expand Down
2 changes: 1 addition & 1 deletion src/MCControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ class MCControl : public RTC::DataFlowComponentBase
std::map<std::string, std::vector<std::pair<size_t, size_t>>> gripper_out_index;

public:
mc_control::MCGlobalController controller;
bool init;
mc_control::MCGlobalController controller;
};

extern "C"
Expand Down

0 comments on commit e8b2319

Please sign in to comment.