diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index 6f37d56a539008cc34ba37b6227756d392900677..6aca54c5d7109822c26aede36da25ecbe58e5491 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -74,7 +74,6 @@ class Problem : public std::enable_shared_from_this<Problem> // Hardware branch ------------------------------------ HardwareBasePtr getHardware(); - void addSensor(SensorBasePtr _sen_ptr); /** \brief Factory method to install (create and add) sensors only from its properties * \param _sen_type type of sensor diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index cab9b32cd98474de4dc98e087c2f77cc005c2ea1..d590892a8d7137552074fa01e61f69feb78c7431 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -111,19 +111,13 @@ Problem::~Problem() // WOLF_DEBUG("destructed -P"); } -void Problem::addSensor(SensorBasePtr _sen_ptr) -{ - // getHardware()->addSensor(_sen_ptr); - _sen_ptr->link(getHardware()); -} - SensorBasePtr Problem::installSensor(const std::string& _sen_type, // const std::string& _unique_sensor_name, // const Eigen::VectorXs& _extrinsics, // IntrinsicsBasePtr _intrinsics) { SensorBasePtr sen_ptr = SensorFactory::get().create(uppercase(_sen_type), _unique_sensor_name, _extrinsics, _intrinsics); - addSensor(sen_ptr); + sen_ptr->link(getHardware()); return sen_ptr; } @@ -149,7 +143,7 @@ SensorBasePtr Problem::installSensor(const std::string& _sen_type, // const paramsServer& _server) { SensorBasePtr sen_ptr = AutoConfSensorFactory::get().create(uppercase(_sen_type), _unique_sensor_name, _server); - addSensor(sen_ptr); + sen_ptr->link(getHardware()); return sen_ptr; } @@ -169,6 +163,14 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // prc_ptr->configure(_corresponding_sensor_ptr); prc_ptr->link(_corresponding_sensor_ptr); + // setting the origin in all processor motion if origin already setted + if (prc_ptr->isMotion() && prior_is_set_) + (std::static_pointer_cast<ProcessorMotion>(prc_ptr))->setOrigin(getLastKeyFrame()); + + // setting the main processor motion + if (prc_ptr->isMotion() && processor_motion_ptr_ == nullptr) + processor_motion_ptr_ = std::static_pointer_cast<ProcessorMotion>(prc_ptr); + return prc_ptr; } @@ -201,7 +203,6 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // ProcessorBasePtr prc_ptr = AutoConfProcessorFactory::get().create(uppercase(_prc_type), _unique_processor_name, _server, sen_ptr); prc_ptr->configure(sen_ptr); prc_ptr->link(sen_ptr); - // sen_ptr->addProcessor(prc_ptr); // setting the origin in all processor motion if origin already setted if (prc_ptr->isMotion() && prior_is_set_)