Skip to content
Snippets Groups Projects
Commit abb5b67b authored by Médéric Fourmy's avatar Médéric Fourmy
Browse files

Fix segfault

parent 10ef25c4
No related branches found
No related tags found
1 merge request!339Adapting to multiple processor motion 285
Pipeline #4967 failed
...@@ -358,16 +358,15 @@ void Problem::getState(const TimeStamp& _ts, Eigen::VectorXd& _state) const ...@@ -358,16 +358,15 @@ void Problem::getState(const TimeStamp& _ts, Eigen::VectorXd& _state) const
{ {
// if _ts is too recent, for some of the processor is motion, they return the state corresponding to their last frame timestamp // if _ts is too recent, for some of the processor is motion, they return the state corresponding to their last frame timestamp
FrameBasePtr closest_frame = trajectory_ptr_->closestKeyOrAuxFrameToTimeStamp(_ts); FrameBasePtr closest_frame = trajectory_ptr_->closestKeyOrAuxFrameToTimeStamp(_ts);
Eigen::VectorXd closest_frame_state = closest_frame->getState();
if (processor_is_motion_list_.empty()){ if (processor_is_motion_list_.empty()){
if (closest_frame != nullptr) if (closest_frame != nullptr)
_state = closest_frame_state; _state = closest_frame->getState();
else else
_state = zeroState(); _state = zeroState();
} }
// RETRIEVE FROM PROCESSOR MOTION // RETRIEVE FROM PROCESSOR MOTION
// TODO: current implementation really messy, would be much easier with a state being an std::unordered_map // TODO: current implementation messy, would be much easier with a state being an std::unordered_map
else { else {
// Iterate over the problem state structure and get the corresponding state // Iterate over the problem state structure and get the corresponding state
// in the first processor is motion that provides it // in the first processor is motion that provides it
...@@ -383,7 +382,7 @@ void Problem::getState(const TimeStamp& _ts, Eigen::VectorXd& _state) const ...@@ -383,7 +382,7 @@ void Problem::getState(const TimeStamp& _ts, Eigen::VectorXd& _state) const
// not already there // not already there
if (states_to_concat_map.find(sb_name) == states_to_concat_map.end()){ if (states_to_concat_map.find(sb_name) == states_to_concat_map.end()){
if (sb_name == 'O'){ if (sb_name == 'O'){
int size_sb = dim_ == 3 ? 4 : 1; // really bad... int size_sb = dim_ == 3 ? 4 : 1; // really bad: should be more transparent
states_to_concat_map[sb_name] = proc_state.segment(idx, size_sb); states_to_concat_map[sb_name] = proc_state.segment(idx, size_sb);
idx += size_sb; idx += size_sb;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment