diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index 219668403aaaf2dc5db0f39398faded44bdf1cb7..f92d39c8bdf99d7536695913df603a9a890dd1e0 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -42,6 +42,13 @@ class Problem : public std::enable_shared_from_this<Problem> friend ProcessorBase; friend ProcessorMotion; + // TODO move somewhere below + public: + StateComposite getStateComposite() const; + StateComposite getStateComposite(const TimeStamp& _ts) const; + + + protected: TreeManagerBasePtr tree_manager_; HardwareBasePtr hardware_ptr_; @@ -279,9 +286,6 @@ class Problem : public std::enable_shared_from_this<Problem> // Perturb state void perturb(double amplitude = 0.01); - const StateComposite& getStateComposite() const; - const StateComposite& getStateComposite(const TimeStamp& _ts) const; - // Map branch ----------------------------------------- MapBasePtr getMap() const; void loadMap(const std::string& _filename_dot_yaml); diff --git a/include/core/processor/is_motion.h b/include/core/processor/is_motion.h index 8655f4d78ecd84313f6bd1a8795e63fad525ea48..25ded4c220ff100aca93995f35605cc15ca414ca 100644 --- a/include/core/processor/is_motion.h +++ b/include/core/processor/is_motion.h @@ -22,6 +22,14 @@ class IsMotion { public: + // TODO move somewhere below + virtual bool getStateComposite(StateComposite& _state) const = 0; + virtual bool getStateComposite(const TimeStamp& _ts, StateComposite& _state) const = 0; + + StateComposite getStateComposite() const; + StateComposite getStateComposite(const TimeStamp& _ts) const; + + virtual ~IsMotion(); // Queries to the processor: @@ -44,9 +52,6 @@ class IsMotion TimeStamp getCurrentTimeStamp() const; Eigen::VectorXd getState(const TimeStamp& _ts) const; - StateComposite getStateComposite() const; - StateComposite getStateComposite(const TimeStamp& _ts) const; - const StateStructure& getStateStructure(){return state_structure_;}; void setStateStructure(const StateStructure& _state_structure){state_structure_ = _state_structure;}; @@ -80,6 +85,20 @@ inline TimeStamp IsMotion::getCurrentTimeStamp() const return ts; } +inline StateComposite IsMotion::getStateComposite() const +{ + StateComposite state; + getStateComposite(state); + return state; +} + +inline StateComposite IsMotion::getStateComposite(const TimeStamp &_ts) const +{ + StateComposite state; + getStateComposite(_ts, state); + return state; +} + inline Eigen::VectorXd IsMotion::getState(const TimeStamp& _ts) const { Eigen::VectorXd x; diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index 81a9184ad4798ccbaac1ebd61a194f6e287331b4..e69d1f55bd3ffd145426dc65dac644c89f56259a 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -133,6 +133,17 @@ struct ProcessorParamsMotion : public ProcessorParamsBase class ProcessorMotion : public ProcessorBase, public IsMotion { public: + + + + // TODO move somewhere below + virtual bool getStateComposite(StateComposite& _state) const override; + virtual bool getStateComposite(const TimeStamp& _ts, StateComposite& _state) const override; + using IsMotion::getStateComposite; + + + + typedef enum { RUNNING_WITHOUT_PACK, RUNNING_WITH_PACK_BEFORE_ORIGIN, diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 7788f8419164daec510776518452839ff9046d3a..b7565f35c1751f7506137984f6fa40a1e655d43b 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -376,7 +376,7 @@ void Problem::getCurrentStateAndStamp(Eigen::VectorXd& _state, TimeStamp& _ts) c _state = zeroState(); } -inline const StateComposite& Problem::getStateComposite() const +inline StateComposite Problem::getStateComposite() const { StateComposite state;