Skip to content
Snippets Groups Projects
Commit a8666cea authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Fix classes to new StateBlock abstract class

parent fb921021
No related branches found
No related tags found
2 merge requests!466devel->main,!456Resolve "Migrate from StateBlock to StateDerived"
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "sensor_range_bearing.h" #include "sensor_range_bearing.h"
#include "core/state_block/state_angle.h" #include "core/state_block/state_angle.h"
#include "core/state_block/state_block_derived.h"
namespace wolf namespace wolf
{ {
...@@ -36,7 +37,7 @@ WOLF_PTR_TYPEDEFS(SensorRangeBearing); ...@@ -36,7 +37,7 @@ WOLF_PTR_TYPEDEFS(SensorRangeBearing);
SensorRangeBearing::SensorRangeBearing(const Eigen::VectorXd& _extrinsics, const Eigen::Vector2d& _noise_std) : SensorRangeBearing::SensorRangeBearing(const Eigen::VectorXd& _extrinsics, const Eigen::Vector2d& _noise_std) :
SensorBase("SensorRangeBearing", SensorBase("SensorRangeBearing",
std::make_shared<StateBlock>(_extrinsics.head<2>(), true), std::make_shared<StatePoint2d>(_extrinsics.head<2>(), true),
std::make_shared<StateAngle>(_extrinsics(2), true), std::make_shared<StateAngle>(_extrinsics(2), true),
nullptr, nullptr,
_noise_std) _noise_std)
......
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
#include "core/landmark/landmark_base.h" #include "core/landmark/landmark_base.h"
#include "core/factor/factor_base.h" #include "core/factor/factor_base.h"
#include "core/map/map_base.h" #include "core/map/map_base.h"
#include "core/state_block/state_block.h" #include "core/state_block/state_block_derived.h"
#include "core/state_block/state_angle.h" #include "core/state_block/state_angle.h"
#include "core/state_block/state_quaternion.h" #include "core/state_block/state_quaternion.h"
#include "core/state_block/factory_state_block.h"
#include "core/common/factory.h" #include "core/common/factory.h"
#include "core/yaml/yaml_conversion.h" #include "core/yaml/yaml_conversion.h"
...@@ -216,7 +217,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node) ...@@ -216,7 +217,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node)
Eigen::VectorXd pos = _node["position"] .as< Eigen::VectorXd >(); Eigen::VectorXd pos = _node["position"] .as< Eigen::VectorXd >();
bool pos_fixed = _node["position fixed"] .as< bool >(); bool pos_fixed = _node["position fixed"] .as< bool >();
StateBlockPtr pos_sb = std::make_shared<StateBlock>(pos, pos_fixed); StateBlockPtr pos_sb = FactoryStateBlock::create("P", pos, pos_fixed);
StateBlockPtr ori_sb = nullptr; StateBlockPtr ori_sb = nullptr;
if (_node["orientation"]) if (_node["orientation"])
......
...@@ -27,21 +27,23 @@ ...@@ -27,21 +27,23 @@
*/ */
#include "core/sensor/sensor_diff_drive.h" #include "core/sensor/sensor_diff_drive.h"
#include "core/state_block/state_block_derived.h"
#include "core/state_block/state_angle.h" #include "core/state_block/state_angle.h"
namespace wolf namespace wolf
{ {
SensorDiffDrive::SensorDiffDrive(const Eigen::VectorXd& _extrinsics, SensorDiffDrive::SensorDiffDrive(const Eigen::VectorXd& _extrinsics, ParamsSensorDiffDrivePtr _intrinsics)
ParamsSensorDiffDrivePtr _intrinsics) : : SensorBase("SensorDiffDrive",
SensorBase("SensorDiffDrive", std::make_shared<StatePoint2d>(_extrinsics.head(2), true),
std::make_shared<StateBlock>(_extrinsics.head(2), true), std::make_shared<StateAngle>(_extrinsics(2), true),
std::make_shared<StateAngle>(_extrinsics(2), true), std::make_shared<StateParams3>(
std::make_shared<StateBlock>(3, false, nullptr, false), 2), Vector3d(_intrinsics->radius_left, _intrinsics->radius_right, _intrinsics->wheel_separation),
params_diff_drive_(_intrinsics) false),
2),
params_diff_drive_(_intrinsics)
{ {
radians_per_tick = 2.0*M_PI / params_diff_drive_->ticks_per_wheel_revolution; radians_per_tick = 2.0*M_PI / params_diff_drive_->ticks_per_wheel_revolution;
getIntrinsic()->setState(Eigen::Vector3d(_intrinsics->radius_left,_intrinsics->radius_right,_intrinsics->wheel_separation));
unfixIntrinsics(); unfixIntrinsics();
if(params_diff_drive_->set_intrinsics_prior) if(params_diff_drive_->set_intrinsics_prior)
...@@ -53,7 +55,6 @@ SensorDiffDrive::SensorDiffDrive(const Eigen::VectorXd& _extrinsics, ...@@ -53,7 +55,6 @@ SensorDiffDrive::SensorDiffDrive(const Eigen::VectorXd& _extrinsics,
Eigen::Vector2d noise_sigma; noise_sigma << sigma_rev, sigma_rev; Eigen::Vector2d noise_sigma; noise_sigma << sigma_rev, sigma_rev;
setNoiseStd(noise_sigma); setNoiseStd(noise_sigma);
} }
SensorDiffDrive::~SensorDiffDrive() SensorDiffDrive::~SensorDiffDrive()
......
...@@ -28,14 +28,14 @@ ...@@ -28,14 +28,14 @@
#include "core/sensor/sensor_pose.h" #include "core/sensor/sensor_pose.h"
#include "core/state_block/state_block.h" #include "core/state_block/state_block_derived.h"
#include "core/state_block/state_quaternion.h" #include "core/state_block/state_quaternion.h"
#include "core/math/rotations.h" #include "core/math/rotations.h"
namespace wolf { namespace wolf {
SensorPose::SensorPose(const Eigen::VectorXd& _extrinsics_pq, const ParamsSensorPose& _intrinsics) : SensorPose::SensorPose(const Eigen::VectorXd& _extrinsics_pq, const ParamsSensorPose& _intrinsics) :
SensorBase("SensorPose", std::make_shared<StateBlock>(_extrinsics_pq.head(3), true), std::make_shared<StateQuaternion>(_extrinsics_pq.tail(4), true), nullptr, 6), SensorBase("SensorPose", std::make_shared<StatePoint3d>(_extrinsics_pq.head(3), true), std::make_shared<StateQuaternion>(_extrinsics_pq.tail(4), true), nullptr, 6),
std_p_(_intrinsics.std_p), std_p_(_intrinsics.std_p),
std_o_(_intrinsics.std_o) std_o_(_intrinsics.std_o)
{ {
......
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