Skip to content
Snippets Groups Projects
Commit 421c7733 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

added dim_ and getDim() in problem

parent 54855703
No related branches found
No related tags found
1 merge request!240Added Problem::dim_ and Problem::getDim()
Pipeline #2454 passed
...@@ -36,25 +36,26 @@ Problem::Problem(const std::string& _frame_structure) : ...@@ -36,25 +36,26 @@ Problem::Problem(const std::string& _frame_structure) :
trajectory_ptr_(std::make_shared<TrajectoryBase>(_frame_structure)), trajectory_ptr_(std::make_shared<TrajectoryBase>(_frame_structure)),
map_ptr_(std::make_shared<MapBase>()), map_ptr_(std::make_shared<MapBase>()),
processor_motion_ptr_(), processor_motion_ptr_(),
state_size_(0),
state_cov_size_(0),
prior_is_set_(false) prior_is_set_(false)
{ {
if (_frame_structure == "PO 2D") if (_frame_structure == "PO 2D")
{ {
state_size_ = 3; state_size_ = 3;
state_cov_size_ = 3; state_cov_size_ = 3;
dim_ = 2;
} }
else if (_frame_structure == "PO 3D") else if (_frame_structure == "PO 3D")
{ {
state_size_ = 7; state_size_ = 7;
state_cov_size_ = 6; state_cov_size_ = 6;
dim_ = 3;
} }
else if (_frame_structure == "POV 3D") else if (_frame_structure == "POV 3D")
{ {
state_size_ = 10; state_size_ = 10;
state_cov_size_ = 9; state_cov_size_ = 9;
dim_ = 3;
} }
else std::runtime_error( else std::runtime_error(
"Problem::Problem(): Unknown frame structure. Add appropriate frame structure to the switch statement."); "Problem::Problem(): Unknown frame structure. Add appropriate frame structure to the switch statement.");
...@@ -315,6 +316,11 @@ void Problem::getFrameStructureSize(SizeEigen& _x_size, SizeEigen& _cov_size) co ...@@ -315,6 +316,11 @@ void Problem::getFrameStructureSize(SizeEigen& _x_size, SizeEigen& _cov_size) co
_cov_size = state_cov_size_; _cov_size = state_cov_size_;
} }
SizeEigen Problem::getDim() const
{
return dim_;
}
Eigen::VectorXs Problem::zeroState() Eigen::VectorXs Problem::zeroState()
{ {
Eigen::VectorXs state = Eigen::VectorXs::Zero(getFrameStructureSize()); Eigen::VectorXs state = Eigen::VectorXs::Zero(getFrameStructureSize());
......
...@@ -42,7 +42,7 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -42,7 +42,7 @@ class Problem : public std::enable_shared_from_this<Problem>
ProcessorMotionPtr processor_motion_ptr_; ProcessorMotionPtr processor_motion_ptr_;
StateBlockList state_block_list_; StateBlockList state_block_list_;
std::map<std::pair<StateBlockPtr, StateBlockPtr>, Eigen::MatrixXs> covariances_; std::map<std::pair<StateBlockPtr, StateBlockPtr>, Eigen::MatrixXs> covariances_;
SizeEigen state_size_, state_cov_size_; SizeEigen state_size_, state_cov_size_, dim_;
std::map<ConstraintBasePtr, Notification> constraint_notification_map_; std::map<ConstraintBasePtr, Notification> constraint_notification_map_;
std::map<StateBlockPtr, Notification> state_block_notification_map_; std::map<StateBlockPtr, Notification> state_block_notification_map_;
bool prior_is_set_; bool prior_is_set_;
...@@ -58,6 +58,7 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -58,6 +58,7 @@ class Problem : public std::enable_shared_from_this<Problem>
// Properties ----------------------------------------- // Properties -----------------------------------------
SizeEigen getFrameStructureSize() const; SizeEigen getFrameStructureSize() const;
void getFrameStructureSize(SizeEigen& _x_size, SizeEigen& _cov_size) const; void getFrameStructureSize(SizeEigen& _x_size, SizeEigen& _cov_size) const;
SizeEigen getDim() const;
// Hardware branch ------------------------------------ // Hardware branch ------------------------------------
HardwareBasePtr getHardwarePtr(); HardwareBasePtr getHardwarePtr();
......
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