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

wip

parent 0cdf0e52
No related branches found
No related tags found
1 merge request!418Resolve "Map factory"
Pipeline #6656 failed
...@@ -155,8 +155,6 @@ namespace wolf ...@@ -155,8 +155,6 @@ namespace wolf
* *
*/ */
typedef Factory<MapBase, typedef Factory<MapBase,
const std::string&,
const Eigen::VectorXd&,
const ParamsMapBasePtr> FactoryMap; const ParamsMapBasePtr> FactoryMap;
template<> template<>
...@@ -181,7 +179,6 @@ inline std::string FactoryParamsMap::getClass() const ...@@ -181,7 +179,6 @@ inline std::string FactoryParamsMap::getClass() const
typedef Factory<MapBase, typedef Factory<MapBase,
const std::string&,
const ParamsServer&> AutoConfFactoryMap; const ParamsServer&> AutoConfFactoryMap;
template<> template<>
......
...@@ -329,6 +329,7 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -329,6 +329,7 @@ class Problem : public std::enable_shared_from_this<Problem>
// Map branch ----------------------------------------- // Map branch -----------------------------------------
MapBasePtr getMap() const; MapBasePtr getMap() const;
void setMap(MapBasePtr);
void loadMap(const std::string& _filename_dot_yaml); void loadMap(const std::string& _filename_dot_yaml);
void saveMap(const std::string& _filename_dot_yaml, // void saveMap(const std::string& _filename_dot_yaml, //
const std::string& _map_name = "Map automatically saved by Wolf"); const std::string& _map_name = "Map automatically saved by Wolf");
......
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
#include "core/hardware/hardware_base.h" #include "core/hardware/hardware_base.h"
#include "core/trajectory/trajectory_base.h" #include "core/trajectory/trajectory_base.h"
#include "core/map/map_base.h" #include "core/map/map_base.h"
#include "core/map/factory_map.h"
#include "core/sensor/sensor_base.h" #include "core/sensor/sensor_base.h"
#include "core/sensor/factory_sensor.h"
#include "core/processor/factory_processor.h"
#include "core/processor/processor_motion.h" #include "core/processor/processor_motion.h"
#include "core/processor/processor_tracker.h" #include "core/processor/processor_tracker.h"
#include "core/capture/capture_pose.h" #include "core/capture/capture_pose.h"
...@@ -11,8 +14,6 @@ ...@@ -11,8 +14,6 @@
#include "core/factor/factor_base.h" #include "core/factor/factor_base.h"
#include "core/factor/factor_block_absolute.h" #include "core/factor/factor_block_absolute.h"
#include "core/factor/factor_quaternion_absolute.h" #include "core/factor/factor_quaternion_absolute.h"
#include "core/sensor/factory_sensor.h"
#include "core/processor/factory_processor.h"
#include "core/state_block/state_block.h" #include "core/state_block/state_block.h"
#include "core/state_block/state_quaternion.h" #include "core/state_block/state_quaternion.h"
#include "core/state_block/state_angle.h" #include "core/state_block/state_angle.h"
...@@ -44,7 +45,7 @@ Problem::Problem(const std::string& _frame_structure, SizeEigen _dim) : ...@@ -44,7 +45,7 @@ Problem::Problem(const std::string& _frame_structure, SizeEigen _dim) :
tree_manager_(nullptr), tree_manager_(nullptr),
hardware_ptr_(std::make_shared<HardwareBase>()), hardware_ptr_(std::make_shared<HardwareBase>()),
trajectory_ptr_(std::make_shared<TrajectoryBase>()), trajectory_ptr_(std::make_shared<TrajectoryBase>()),
map_ptr_(std::make_shared<MapBase>()), map_ptr_(nullptr),
processor_is_motion_map_(), processor_is_motion_map_(),
frame_structure_(_frame_structure), frame_structure_(_frame_structure),
prior_options_(std::make_shared<PriorOptions>()) prior_options_(std::make_shared<PriorOptions>())
...@@ -75,6 +76,7 @@ void Problem::setup() ...@@ -75,6 +76,7 @@ void Problem::setup()
{ {
hardware_ptr_ -> setProblem(shared_from_this()); hardware_ptr_ -> setProblem(shared_from_this());
trajectory_ptr_-> setProblem(shared_from_this()); trajectory_ptr_-> setProblem(shared_from_this());
map_ptr_ = std::make_shared<MapBase>(std::make_shared<ParamsMapBase>());
map_ptr_ -> setProblem(shared_from_this()); map_ptr_ -> setProblem(shared_from_this());
} }
...@@ -200,6 +202,13 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server) ...@@ -200,6 +202,13 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
_server.getParam<VectorComposite>("problem/prior/state")); _server.getParam<VectorComposite>("problem/prior/state"));
} }
// Map
std::string map_type = _server.getParam<std::string>("problem/map/type");
WOLF_TRACE("Map Type: ", map_type);
auto map = AutoConfFactoryMap::create(map_type, _server);
map->setProblem(problem);
problem->setMap(map);
// Done // Done
return problem; return problem;
} }
...@@ -988,6 +997,13 @@ MapBasePtr Problem::getMap() const ...@@ -988,6 +997,13 @@ MapBasePtr Problem::getMap() const
return map_ptr_; return map_ptr_;
} }
void Problem::setMap(MapBasePtr _map_ptr)
{
assert(map_ptr_ == nullptr && "map has already been set");
map_ptr_ = _map_ptr;
}
TrajectoryBasePtr Problem::getTrajectory() const TrajectoryBasePtr Problem::getTrajectory() const
{ {
return trajectory_ptr_; return trajectory_ptr_;
......
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