From 1485094d995b76fc12837654e96229d0d782949d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Fri, 25 Nov 2016 20:29:41 +0100 Subject: [PATCH] New macros for pointers and lists to classes --- src/capture_fix.h | 6 +- src/capture_gps.h | 6 +- src/capture_gps_fix.h | 6 +- src/capture_image.cpp | 2 +- src/capture_image.h | 9 +- src/capture_imu.h | 9 +- src/capture_laser_2D.h | 8 +- src/capture_motion.h | 6 +- src/capture_void.h | 6 +- src/constraint_AHP.h | 6 +- src/constraint_analytic.h | 6 +- src/constraint_container.h | 6 +- src/constraint_corner_2D.h | 6 +- src/constraint_epipolar.h | 6 +- src/constraint_fix.h | 6 +- src/constraint_fix_3D.h | 9 +- src/constraint_gps_2D.h | 6 +- src/constraint_gps_pseudorange_2D.h | 6 +- src/constraint_gps_pseudorange_3D.h | 7 +- src/constraint_imu.h | 6 +- src/constraint_odom_2D.h | 6 +- src/constraint_odom_2D_analytic.h | 6 +- src/constraint_odom_3D.h | 6 +- src/constraint_point_2D.h | 6 +- src/constraint_point_to_line_2D.h | 6 +- src/constraint_relative_2D_analytic.h | 6 +- src/examples/test_mpu.cpp | 2 +- .../test_processor_image_landmark.cpp | 4 +- src/examples/test_simple_AHP.cpp | 2 +- src/feature_corner_2D.h | 6 +- src/feature_fix.h | 6 +- src/feature_gps_fix.h | 6 +- src/feature_gps_pseudorange.h | 6 +- src/feature_imu.h | 6 +- src/feature_line_2D.h | 6 +- src/feature_odom_2D.h | 6 +- src/feature_point_image.h | 6 +- src/feature_polyline_2D.h | 6 +- src/frame_imu.h | 6 +- src/landmark_AHP.h | 6 +- src/landmark_container.h | 6 +- src/landmark_corner_2D.h | 6 +- src/landmark_line_2D.h | 6 +- src/landmark_point_3d.h | 6 +- src/landmark_polyline_2D.h | 6 +- src/processor_gps.h | 6 +- src/processor_image_feature.cpp | 2 +- src/processor_image_feature.h | 8 +- src/processor_image_landmark.cpp | 2 +- src/processor_image_landmark.h | 9 +- src/processor_imu.h | 6 +- src/processor_motion.h | 6 - src/processor_odom_2D.h | 6 +- src/processor_odom_3D.cpp | 6 +- src/processor_odom_3D.h | 10 +- src/processor_tracker.h | 7 +- src/processor_tracker_feature.h | 7 +- src/processor_tracker_feature_corner.h | 6 +- src/processor_tracker_feature_dummy.h | 6 +- src/processor_tracker_landmark.h | 6 +- src/processor_tracker_landmark_corner.h | 7 +- src/processor_tracker_landmark_dummy.h | 9 +- src/processor_tracker_landmark_polyline.h | 9 +- src/sensor_camera.h | 6 +- src/sensor_gps.h | 6 +- src/sensor_gps_fix.h | 2 + src/sensor_imu.h | 1 + src/sensor_laser_2D.cpp | 2 +- src/sensor_laser_2D.h | 3 +- src/sensor_odom_2D.h | 5 +- src/sensor_odom_3D.h | 5 +- src/test/gtest_frame_base.cpp | 2 +- src/wolf.h | 124 ++++++------------ 73 files changed, 126 insertions(+), 416 deletions(-) diff --git a/src/capture_fix.h b/src/capture_fix.h index f4aa579f0..a9f90944f 100644 --- a/src/capture_fix.h +++ b/src/capture_fix.h @@ -12,11 +12,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureFix; -typedef std::shared_ptr<CaptureFix> CaptureFixPtr; -typedef std::shared_ptr<const CaptureFix> CaptureFixConstPtr; -typedef std::weak_ptr<CaptureFix> CaptureFixWPtr; +WOLF_PTR_TYPEDEFS(CaptureFix); //class CaptureFix class CaptureFix : public CaptureBase diff --git a/src/capture_gps.h b/src/capture_gps.h index 1f3055a28..946619527 100644 --- a/src/capture_gps.h +++ b/src/capture_gps.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureGPS; -typedef std::shared_ptr<CaptureGPS> CaptureGPSPtr; -typedef std::shared_ptr<const CaptureGPS> CaptureGPSConstPtr; -typedef std::weak_ptr<CaptureGPS> CaptureGPSWPtr; +WOLF_PTR_TYPEDEFS(CaptureGPS); class CaptureGPS : public CaptureBase { diff --git a/src/capture_gps_fix.h b/src/capture_gps_fix.h index 93b4777bb..3747eefaf 100644 --- a/src/capture_gps_fix.h +++ b/src/capture_gps_fix.h @@ -10,11 +10,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureGPSFix; -typedef std::shared_ptr<CaptureGPSFix> CaptureGPSFixPtr; -typedef std::shared_ptr<const CaptureGPSFix> CaptureGPSFixConstPtr; -typedef std::weak_ptr<CaptureGPSFix> CaptureGPSFixWPtr; +WOLF_PTR_TYPEDEFS(CaptureGPSFix); //class CaptureGPSFix class CaptureGPSFix : public CaptureBase diff --git a/src/capture_image.cpp b/src/capture_image.cpp index ef9dba573..35d71f730 100644 --- a/src/capture_image.cpp +++ b/src/capture_image.cpp @@ -3,7 +3,7 @@ namespace wolf { -CaptureImage::CaptureImage(const TimeStamp& _ts, SensorCamera::Ptr _camera_ptr, cv::Mat _data_cv) : +CaptureImage::CaptureImage(const TimeStamp& _ts, SensorCameraPtr _camera_ptr, cv::Mat _data_cv) : CaptureBase("IMAGE", _ts, _camera_ptr), image_(_data_cv) { // diff --git a/src/capture_image.h b/src/capture_image.h index 6c8fae652..d1feeedc3 100644 --- a/src/capture_image.h +++ b/src/capture_image.h @@ -14,11 +14,8 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureImage; -typedef std::shared_ptr<CaptureImage> CaptureImagePtr; -typedef std::shared_ptr<const CaptureImage> CaptureImageConstPtr; -typedef std::weak_ptr<CaptureImage> CaptureImageWPtr; +// Set ClassPtr, ClassConstPtr and ClassWPtr typedefs; +WOLF_PTR_TYPEDEFS(CaptureImage); /** * \brief class CaptureImage @@ -34,7 +31,7 @@ class CaptureImage : public CaptureBase std::vector<cv::KeyPoint> keypoints_; public: - CaptureImage(const TimeStamp& _ts, SensorCamera::Ptr _camera_ptr, cv::Mat _data_cv); + CaptureImage(const TimeStamp& _ts, SensorCameraPtr _camera_ptr, cv::Mat _data_cv); virtual ~CaptureImage(); virtual const cv::Mat& getImage() const; diff --git a/src/capture_imu.h b/src/capture_imu.h index c4c6a6cd3..55e8d8848 100644 --- a/src/capture_imu.h +++ b/src/capture_imu.h @@ -6,17 +6,10 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureIMU; -typedef std::shared_ptr<CaptureIMU> CaptureIMUPtr; -typedef std::shared_ptr<const CaptureIMU> CaptureIMUConstPtr; -typedef std::weak_ptr<CaptureIMU> CaptureIMUWPtr; +WOLF_PTR_TYPEDEFS(CaptureIMU); class CaptureIMU : public CaptureMotion { - public: - typedef std::shared_ptr<CaptureIMU> Ptr; - public: CaptureIMU(const TimeStamp& _init_ts, SensorBasePtr _sensor_ptr, const Eigen::Vector6s& _data); diff --git a/src/capture_laser_2D.h b/src/capture_laser_2D.h index c6ac10e07..3a0612860 100644 --- a/src/capture_laser_2D.h +++ b/src/capture_laser_2D.h @@ -16,11 +16,7 @@ class SensorLaser2D; namespace wolf { -//forward declaration to typedef class pointers -class CaptureLaser2D; -typedef std::shared_ptr<CaptureLaser2D> CaptureLaser2DPtr; -typedef std::shared_ptr<const CaptureLaser2D> CaptureLaser2DConstPtr; -typedef std::weak_ptr<CaptureLaser2D> CaptureLaser2DWPtr; +WOLF_PTR_TYPEDEFS(CaptureLaser2D); class CaptureLaser2D : public CaptureBase @@ -36,7 +32,7 @@ class CaptureLaser2D : public CaptureBase void setSensorPtr(const SensorBasePtr sensor_ptr); private: - SensorLaser2D::Ptr laser_ptr_; //specific pointer to sensor laser 2D object + SensorLaser2DPtr laser_ptr_; //specific pointer to sensor laser 2D object laserscanutils::LaserScan scan_; }; diff --git a/src/capture_motion.h b/src/capture_motion.h index bebdccbb7..f3d325a7a 100644 --- a/src/capture_motion.h +++ b/src/capture_motion.h @@ -20,11 +20,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureMotion; -typedef std::shared_ptr<CaptureMotion> CaptureMotionPtr; -typedef std::shared_ptr<const CaptureMotion> CaptureMotionConst; -typedef std::weak_ptr<CaptureMotion> CaptureMotionWPtr; +WOLF_PTR_TYPEDEFS(CaptureMotion); /** \brief Base class for motion Captures. diff --git a/src/capture_void.h b/src/capture_void.h index 1d50d88eb..50b3b3c7d 100644 --- a/src/capture_void.h +++ b/src/capture_void.h @@ -7,11 +7,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class CaptureVoid; -typedef std::shared_ptr<CaptureVoid> CaptureVoidPtr; -typedef std::shared_ptr<const CaptureVoid> CaptureVoidConstPtr; -typedef std::weak_ptr<CaptureVoid> CaptureVoidWPtr; +WOLF_PTR_TYPEDEFS(CaptureVoid); //class CaptureVoid diff --git a/src/constraint_AHP.h b/src/constraint_AHP.h index 87e7d164d..dc4df1914 100644 --- a/src/constraint_AHP.h +++ b/src/constraint_AHP.h @@ -12,11 +12,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintAHP; -typedef std::shared_ptr<ConstraintAHP> ConstraintAHPPtr; -typedef std::shared_ptr<const ConstraintAHP> ConstraintAHPConstPtr; -typedef std::weak_ptr<ConstraintAHP> ConstraintAHPWPtr; +WOLF_PTR_TYPEDEFS(ConstraintAHP); //class class ConstraintAHP : public ConstraintSparse<2, 3, 4, 3, 4, 4> diff --git a/src/constraint_analytic.h b/src/constraint_analytic.h index 3b1414f32..a7c1f28d6 100644 --- a/src/constraint_analytic.h +++ b/src/constraint_analytic.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintAnalytic; -typedef std::shared_ptr<ConstraintAnalytic> ConstraintAnalyticPtr; -typedef std::shared_ptr<const ConstraintAnalytic> ConstraintAnalyticConstPtr; -typedef std::weak_ptr<ConstraintAnalytic> ConstraintAnalyticWPtr; +WOLF_PTR_TYPEDEFS(ConstraintAnalytic); class ConstraintAnalytic: public ConstraintBase { diff --git a/src/constraint_container.h b/src/constraint_container.h index f0303c987..35fd158c7 100644 --- a/src/constraint_container.h +++ b/src/constraint_container.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintContainer; -typedef std::shared_ptr<ConstraintContainer> ConstraintContainerPtr; -typedef std::shared_ptr<const ConstraintContainer> ConstraintContainerConstPtr; -typedef std::weak_ptr<ConstraintContainer> ConstraintContainerWPtr; +WOLF_PTR_TYPEDEFS(ConstraintContainer); class ConstraintContainer: public ConstraintSparse<3,2,1,2,1> { diff --git a/src/constraint_corner_2D.h b/src/constraint_corner_2D.h index 4721ebf6f..1e6a4c8ac 100644 --- a/src/constraint_corner_2D.h +++ b/src/constraint_corner_2D.h @@ -7,11 +7,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintCorner2D; -typedef std::shared_ptr<ConstraintCorner2D> ConstraintCorner2DPtr; -typedef std::shared_ptr<const ConstraintCorner2D> ConstraintCorner2DConstPtr; -typedef std::weak_ptr<ConstraintCorner2D> ConstraintCorner2DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintCorner2D); class ConstraintCorner2D: public ConstraintSparse<3,2,1,2,1> { diff --git a/src/constraint_epipolar.h b/src/constraint_epipolar.h index 9c02fa395..373579d04 100644 --- a/src/constraint_epipolar.h +++ b/src/constraint_epipolar.h @@ -5,11 +5,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintEpipolar; -typedef std::shared_ptr<ConstraintEpipolar> ConstraintEpipolarPtr; -typedef std::shared_ptr<const ConstraintEpipolar> ConstraintEpipolarConstPtr; -typedef std::weak_ptr<ConstraintEpipolar> ConstraintEpipolarWPtr; +WOLF_PTR_TYPEDEFS(ConstraintEpipolar); class ConstraintEpipolar : public ConstraintBase diff --git a/src/constraint_fix.h b/src/constraint_fix.h index ae3656de8..484f87791 100644 --- a/src/constraint_fix.h +++ b/src/constraint_fix.h @@ -9,11 +9,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintFix; -typedef std::shared_ptr<ConstraintFix> ConstraintFixPtr; -typedef std::shared_ptr<const ConstraintFix> ConstraintFixConstPtr; -typedef std::weak_ptr<ConstraintFix> ConstraintFixWPtr; +WOLF_PTR_TYPEDEFS(ConstraintFix); //class class ConstraintFix: public ConstraintSparse<3,2,1> diff --git a/src/constraint_fix_3D.h b/src/constraint_fix_3D.h index 9e8c43f0e..9f3f5fec9 100644 --- a/src/constraint_fix_3D.h +++ b/src/constraint_fix_3D.h @@ -10,18 +10,11 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintFix3D; -typedef std::shared_ptr<ConstraintFix3D> ConstraintFix3DPtr; -typedef std::shared_ptr<const ConstraintFix3D> ConstraintFix3DConstPtr; -typedef std::weak_ptr<ConstraintFix3D> ConstraintFix3DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintFix3D); //class class ConstraintFix3D: public ConstraintSparse<6,3,4> { - public: - typedef std::shared_ptr<ConstraintFix3D> Ptr; - public: ConstraintFix3D(FeatureBasePtr _ftr_ptr, bool _apply_loss_function = false, ConstraintStatus _status = CTR_ACTIVE) : diff --git a/src/constraint_gps_2D.h b/src/constraint_gps_2D.h index f2490e2a1..0f3f011c5 100644 --- a/src/constraint_gps_2D.h +++ b/src/constraint_gps_2D.h @@ -9,11 +9,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintGPS2D; -typedef std::shared_ptr<ConstraintGPS2D> ConstraintGPS2DPtr; -typedef std::shared_ptr<const ConstraintGPS2D> ConstraintGPS2DConstPtr; -typedef std::weak_ptr<ConstraintGPS2D> ConstraintGPS2DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintGPS2D); class ConstraintGPS2D : public ConstraintSparse<2, 2> { diff --git a/src/constraint_gps_pseudorange_2D.h b/src/constraint_gps_pseudorange_2D.h index 6db67cb28..b2e2a2cdd 100644 --- a/src/constraint_gps_pseudorange_2D.h +++ b/src/constraint_gps_pseudorange_2D.h @@ -14,11 +14,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintGPSPseudorange2D; -typedef std::shared_ptr<ConstraintGPSPseudorange2D> ConstraintGPSPseudorange2DPtr; -typedef std::shared_ptr<const ConstraintGPSPseudorange2D> ConstraintGPSPseudorange2DConstPtr; -typedef std::weak_ptr<ConstraintGPSPseudorange2D> ConstraintGPSPseudorange2DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintGPSPseudorange2D); /* * NB: diff --git a/src/constraint_gps_pseudorange_3D.h b/src/constraint_gps_pseudorange_3D.h index 86a2e2b2d..e7d7c93e6 100644 --- a/src/constraint_gps_pseudorange_3D.h +++ b/src/constraint_gps_pseudorange_3D.h @@ -10,11 +10,8 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintGPSPseudorange3D; -typedef std::shared_ptr<ConstraintGPSPseudorange3D> ConstraintGPSPseudorange3DPtr; -typedef std::shared_ptr<const ConstraintGPSPseudorange3D> ConstraintGPSPseudorange3DConstPtr; -typedef std::weak_ptr<ConstraintGPSPseudorange3D> ConstraintGPSPseudorange3DWPtr; +// Set ClassPtr, ClassConstPtr and ClassWPtr typedefs; +WOLF_PTR_TYPEDEFS(ConstraintGPSPseudorange3D); /* * NB: diff --git a/src/constraint_imu.h b/src/constraint_imu.h index c7320a3fc..205e5b7ab 100644 --- a/src/constraint_imu.h +++ b/src/constraint_imu.h @@ -10,11 +10,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintIMU; -typedef std::shared_ptr<ConstraintIMU> ConstraintIMUPtr; -typedef std::shared_ptr<const ConstraintIMU> ConstraintIMUConstPtr; -typedef std::weak_ptr<ConstraintIMU> ConstraintIMUWPtr; +WOLF_PTR_TYPEDEFS(ConstraintIMU); //class class ConstraintIMU : public ConstraintSparse<9, 3, 4, 3, 3, 3, 3, 4, 3> diff --git a/src/constraint_odom_2D.h b/src/constraint_odom_2D.h index fb89f42ee..d133448cc 100644 --- a/src/constraint_odom_2D.h +++ b/src/constraint_odom_2D.h @@ -7,11 +7,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintOdom2D; -typedef std::shared_ptr<ConstraintOdom2D> ConstraintOdom2DPtr; -typedef std::shared_ptr<const ConstraintOdom2D> ConstraintOdom2DConstPtr; -typedef std::weak_ptr<ConstraintOdom2D> ConstraintOdom2DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintOdom2D); //class class ConstraintOdom2D : public ConstraintSparse<3, 2, 1, 2, 1> diff --git a/src/constraint_odom_2D_analytic.h b/src/constraint_odom_2D_analytic.h index ba0a0abaf..74fbb56a5 100644 --- a/src/constraint_odom_2D_analytic.h +++ b/src/constraint_odom_2D_analytic.h @@ -7,11 +7,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintOdom2DAnalytic; -typedef std::shared_ptr<ConstraintOdom2DAnalytic> ConstraintOdom2DAnalyticPtr; -typedef std::shared_ptr<const ConstraintOdom2DAnalytic> ConstraintOdom2DAnalyticConstPtr; -typedef std::weak_ptr<ConstraintOdom2DAnalytic> ConstraintOdom2DAnalyticWPtr; +WOLF_PTR_TYPEDEFS(ConstraintOdom2DAnalytic); //class class ConstraintOdom2DAnalytic : public ConstraintRelative2DAnalytic diff --git a/src/constraint_odom_3D.h b/src/constraint_odom_3D.h index c90f5a378..f2492f77f 100644 --- a/src/constraint_odom_3D.h +++ b/src/constraint_odom_3D.h @@ -14,11 +14,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintOdom3D; -typedef std::shared_ptr<ConstraintOdom3D> ConstraintOdom3DPtr; -typedef std::shared_ptr<const ConstraintOdom3D> ConstraintOdom3DConstPtr; -typedef std::weak_ptr<ConstraintOdom3D> ConstraintOdom3DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintOdom3D); //class class ConstraintOdom3D : public ConstraintSparse<6,3,4,3,4> diff --git a/src/constraint_point_2D.h b/src/constraint_point_2D.h index 9e921c9b2..7cd35e284 100644 --- a/src/constraint_point_2D.h +++ b/src/constraint_point_2D.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintPoint2D; -typedef std::shared_ptr<ConstraintPoint2D> ConstraintPoint2DPtr; -typedef std::shared_ptr<const ConstraintPoint2D> ConstraintPoint2DConstPtr; -typedef std::weak_ptr<ConstraintPoint2D> ConstraintPoint2DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintPoint2D); //class class ConstraintPoint2D: public ConstraintSparse<2,2,1,2,1,2> diff --git a/src/constraint_point_to_line_2D.h b/src/constraint_point_to_line_2D.h index 63920a1c1..11dcae8a2 100644 --- a/src/constraint_point_to_line_2D.h +++ b/src/constraint_point_to_line_2D.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintPointToLine2D; -typedef std::shared_ptr<ConstraintPointToLine2D> ConstraintPointToLine2DPtr; -typedef std::shared_ptr<const ConstraintPointToLine2D> ConstraintPointToLine2DConstPtr; -typedef std::weak_ptr<ConstraintPointToLine2D> ConstraintPointToLine2DWPtr; +WOLF_PTR_TYPEDEFS(ConstraintPointToLine2D); //class class ConstraintPointToLine2D: public ConstraintSparse<1,2,1,2,1,2,2> diff --git a/src/constraint_relative_2D_analytic.h b/src/constraint_relative_2D_analytic.h index c363d5a75..b960d2e9b 100644 --- a/src/constraint_relative_2D_analytic.h +++ b/src/constraint_relative_2D_analytic.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ConstraintRelative2DAnalytic; -typedef std::shared_ptr<ConstraintRelative2DAnalytic> ConstraintRelative2DAnalyticPtr; -typedef std::shared_ptr<const ConstraintRelative2DAnalytic> ConstraintRelative2DAnalyticConstPtr; -typedef std::weak_ptr<ConstraintRelative2DAnalytic> ConstraintRelative2DAnalyticWPtr; +WOLF_PTR_TYPEDEFS(ConstraintRelative2DAnalytic); //class class ConstraintRelative2DAnalytic : public ConstraintAnalytic diff --git a/src/examples/test_mpu.cpp b/src/examples/test_mpu.cpp index 8d8a92535..61f1cf37a 100644 --- a/src/examples/test_mpu.cpp +++ b/src/examples/test_mpu.cpp @@ -123,7 +123,7 @@ int main(int argc, char** argv) wolf_problem_ptr_->getProcessorMotionPtr()->setOrigin(x0, t); // Create one capture to store the IMU data arriving from (sensor / callback / file / etc.) - CaptureIMU::Ptr imu_ptr( std::make_shared<CaptureIMU>(t, sensor_ptr, data_) ); + CaptureIMUPtr imu_ptr( std::make_shared<CaptureIMU>(t, sensor_ptr, data_) ); // main loop using namespace std; diff --git a/src/examples/test_processor_image_landmark.cpp b/src/examples/test_processor_image_landmark.cpp index 910edb433..8cfe8a230 100644 --- a/src/examples/test_processor_image_landmark.cpp +++ b/src/examples/test_processor_image_landmark.cpp @@ -105,11 +105,11 @@ int main(int argc, char** argv) // ODOM SENSOR AND PROCESSOR SensorBasePtr sen_ptr = wolf_problem_ptr_->installSensor("ODOM 3D", "odom", (Vector7s()<<0,0,0,0,0,0,1).finished(), wolf_root + "/src/examples/sensor_odom_3D.yaml"); ProcessorBasePtr prc_ptr = wolf_problem_ptr_->installProcessor("ODOM 3D", "odometry integrator", "odom", wolf_root + "/src/examples/processor_odom_3D.yaml"); - SensorOdom3D::Ptr sen_odo_ptr = std::static_pointer_cast<SensorOdom3D>(sen_ptr); + SensorOdom3DPtr sen_odo_ptr = std::static_pointer_cast<SensorOdom3D>(sen_ptr); // CAMERA SENSOR AND PROCESSOR SensorBasePtr sensor_ptr = wolf_problem_ptr_->installSensor("CAMERA", "PinHole", (Vector7s()<<0,0,0,0,0,0,1).finished(), wolf_root + "/src/examples/camera_params_ueye_sim.yaml"); - SensorCamera::Ptr camera_ptr = std::static_pointer_cast<SensorCamera>(sensor_ptr); + SensorCameraPtr camera_ptr = std::static_pointer_cast<SensorCamera>(sensor_ptr); camera_ptr->setImgWidth(img_width); camera_ptr->setImgHeight(img_height); wolf_problem_ptr_->installProcessor("IMAGE LANDMARK", "ORB", "PinHole", wolf_root + "/src/examples/processor_image_ORB.yaml"); diff --git a/src/examples/test_simple_AHP.cpp b/src/examples/test_simple_AHP.cpp index 541a603b2..032d1dab3 100644 --- a/src/examples/test_simple_AHP.cpp +++ b/src/examples/test_simple_AHP.cpp @@ -112,7 +112,7 @@ int main(int argc, char** argv) /* 2 */ std::string wolf_root = _WOLF_ROOT_DIR; SensorBasePtr sensor_ptr = problem->installSensor("CAMERA", "PinHole", (Vector7s()<<0,0,0,-0.5,0.5,-0.5,0.5).finished(), wolf_root + "/src/examples/camera_params_ueye_sim.yaml"); - SensorCamera::Ptr camera = std::static_pointer_cast<SensorCamera>(sensor_ptr); + SensorCameraPtr camera = std::static_pointer_cast<SensorCamera>(sensor_ptr); // ============================================================================================================ // ============================================================================================================ diff --git a/src/feature_corner_2D.h b/src/feature_corner_2D.h index dbeee2588..d43b82025 100644 --- a/src/feature_corner_2D.h +++ b/src/feature_corner_2D.h @@ -9,11 +9,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureCorner2D; -typedef std::shared_ptr<FeatureCorner2D> FeatureCorner2DPtr; -typedef std::shared_ptr<const FeatureCorner2D> FeatureCorner2DConstPtr; -typedef std::weak_ptr<FeatureCorner2D> FeatureCorner2DWPtr; +WOLF_PTR_TYPEDEFS(FeatureCorner2D); //class FeatureCorner2D class FeatureCorner2D : public FeatureBase diff --git a/src/feature_fix.h b/src/feature_fix.h index 2672c152b..d7649bcc3 100644 --- a/src/feature_fix.h +++ b/src/feature_fix.h @@ -10,11 +10,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureFix; -typedef std::shared_ptr<FeatureFix> FeatureFixPtr; -typedef std::shared_ptr<const FeatureFix> FeatureFixConstPtr; -typedef std::weak_ptr<FeatureFix> FeatureFixWPtr; +WOLF_PTR_TYPEDEFS(FeatureFix); //class FeatureFix class FeatureFix : public FeatureBase diff --git a/src/feature_gps_fix.h b/src/feature_gps_fix.h index 9e81309af..71fd098f1 100644 --- a/src/feature_gps_fix.h +++ b/src/feature_gps_fix.h @@ -9,11 +9,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureGPSFix; -typedef std::shared_ptr<FeatureGPSFix> FeatureGPSFixPtr; -typedef std::shared_ptr<const FeatureGPSFix> FeatureGPSFixConstPtr; -typedef std::weak_ptr<FeatureGPSFix> FeatureGPSFixWPtr; +WOLF_PTR_TYPEDEFS(FeatureGPSFix); //class FeatureGPSFix class FeatureGPSFix : public FeatureBase diff --git a/src/feature_gps_pseudorange.h b/src/feature_gps_pseudorange.h index e68293b68..5adaa5b6c 100644 --- a/src/feature_gps_pseudorange.h +++ b/src/feature_gps_pseudorange.h @@ -11,11 +11,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureGPSPseudorange; -typedef std::shared_ptr<FeatureGPSPseudorange> FeatureGPSPseudorangePtr; -typedef std::shared_ptr<const FeatureGPSPseudorange> FeatureGPSPseudorangeConstPtr; -typedef std::weak_ptr<FeatureGPSPseudorange> FeatureGPSPseudorangeWPtr; +WOLF_PTR_TYPEDEFS(FeatureGPSPseudorange); // TODO manage covariance class FeatureGPSPseudorange : public FeatureBase diff --git a/src/feature_imu.h b/src/feature_imu.h index f4a412498..a19336857 100644 --- a/src/feature_imu.h +++ b/src/feature_imu.h @@ -9,11 +9,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureIMU; -typedef std::shared_ptr<FeatureIMU> FeatureIMUPtr; -typedef std::shared_ptr<const FeatureIMU> FeatureIMUConstPtr; -typedef std::weak_ptr<FeatureIMU> FeatureIMUWPtr; +WOLF_PTR_TYPEDEFS(FeatureIMU); //class FeatureIMU class FeatureIMU : public FeatureBase diff --git a/src/feature_line_2D.h b/src/feature_line_2D.h index 39cda0be8..cd99621a0 100644 --- a/src/feature_line_2D.h +++ b/src/feature_line_2D.h @@ -6,11 +6,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureLine2D; -typedef std::shared_ptr<FeatureLine2D> FeatureLine2DPtr; -typedef std::shared_ptr<const FeatureLine2D> FeatureLine2DConstPtr; -typedef std::weak_ptr<FeatureLine2D> FeatureLine2DWPtr; +WOLF_PTR_TYPEDEFS(FeatureLine2D); /** \brief class FeatureLine2D diff --git a/src/feature_odom_2D.h b/src/feature_odom_2D.h index 9241fcd4c..812f34567 100644 --- a/src/feature_odom_2D.h +++ b/src/feature_odom_2D.h @@ -11,11 +11,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeatureOdom2D; -typedef std::shared_ptr<FeatureOdom2D> FeatureOdom2DPtr; -typedef std::shared_ptr<const FeatureOdom2D> FeatureOdom2DConstPtr; -typedef std::weak_ptr<FeatureOdom2D> FeatureOdom2DWPtr; +WOLF_PTR_TYPEDEFS(FeatureOdom2D); //class FeatureOdom2D class FeatureOdom2D : public FeatureBase diff --git a/src/feature_point_image.h b/src/feature_point_image.h index e7514bd09..5535b3ce8 100644 --- a/src/feature_point_image.h +++ b/src/feature_point_image.h @@ -11,11 +11,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeaturePointImage; -typedef std::shared_ptr<FeaturePointImage> FeaturePointImagePtr; -typedef std::shared_ptr<const FeaturePointImage> FeaturePointImageConstPtr; -typedef std::weak_ptr<FeaturePointImage> FeaturePointImageWPtr; +WOLF_PTR_TYPEDEFS(FeaturePointImage); //class FeaturePointImage class FeaturePointImage : public FeatureBase diff --git a/src/feature_polyline_2D.h b/src/feature_polyline_2D.h index 0b16e29e2..60f3258f5 100644 --- a/src/feature_polyline_2D.h +++ b/src/feature_polyline_2D.h @@ -12,11 +12,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class FeaturePolyline2D; -typedef std::shared_ptr<FeaturePolyline2D> FeaturePolyline2DPtr; -typedef std::shared_ptr<const FeaturePolyline2D> FeaturePolyline2DConstPtr; -typedef std::weak_ptr<FeaturePolyline2D> FeaturePolyline2DWPtr; +WOLF_PTR_TYPEDEFS(FeaturePolyline2D); //class class FeaturePolyline2D : public FeatureBase diff --git a/src/frame_imu.h b/src/frame_imu.h index 61e3a89d8..4b6ddb9a0 100644 --- a/src/frame_imu.h +++ b/src/frame_imu.h @@ -15,11 +15,7 @@ class StateQuaternion; namespace wolf { -//forward declaration to typedef class pointers -class FrameIMU; -typedef std::shared_ptr<FrameIMU> FrameIMUPtr; -typedef std::shared_ptr<const FrameIMU> FrameIMUConstPtr; -typedef std::weak_ptr<FrameIMU> FrameIMUWPtr; +WOLF_PTR_TYPEDEFS(FrameIMU); //class class FrameIMU : public FrameBase diff --git a/src/landmark_AHP.h b/src/landmark_AHP.h index caacc21f6..0a31b8992 100644 --- a/src/landmark_AHP.h +++ b/src/landmark_AHP.h @@ -12,11 +12,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class LandmarkAHP; -typedef std::shared_ptr<LandmarkAHP> LandmarkAHPPtr; -typedef std::shared_ptr<const LandmarkAHP> LandmarkAHPConstPtr; -typedef std::weak_ptr<LandmarkAHP> LandmarkAHPWPtr; +WOLF_PTR_TYPEDEFS(LandmarkAHP); /* Landmark - Anchored Homogeneous Point*/ class LandmarkAHP : public LandmarkBase diff --git a/src/landmark_container.h b/src/landmark_container.h index 7bc6964ef..0f51f3c5a 100644 --- a/src/landmark_container.h +++ b/src/landmark_container.h @@ -10,11 +10,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class LandmarkContainer; -typedef std::shared_ptr<LandmarkContainer> LandmarkContainerPtr; -typedef std::shared_ptr<const LandmarkContainer> LandmarkContainerConstPtr; -typedef std::weak_ptr<LandmarkContainer> LandmarkContainerWPtr; +WOLF_PTR_TYPEDEFS(LandmarkContainer); //class LandmarkContainer class LandmarkContainer : public LandmarkBase diff --git a/src/landmark_corner_2D.h b/src/landmark_corner_2D.h index 0cb9b12b0..1eb99a975 100644 --- a/src/landmark_corner_2D.h +++ b/src/landmark_corner_2D.h @@ -10,11 +10,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class LandmarkCorner2D; -typedef std::shared_ptr<LandmarkCorner2D> LandmarkCorner2DPtr; -typedef std::shared_ptr<const LandmarkCorner2D> LandmarkCorner2DConstPtr; -typedef std::weak_ptr<LandmarkCorner2D> LandmarkCorner2DWPtr; +WOLF_PTR_TYPEDEFS(LandmarkCorner2D); //class LandmarkCorner2D class LandmarkCorner2D : public LandmarkBase diff --git a/src/landmark_line_2D.h b/src/landmark_line_2D.h index 30508c01e..514cd550b 100644 --- a/src/landmark_line_2D.h +++ b/src/landmark_line_2D.h @@ -11,11 +11,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class LandmarkLine2D; -typedef std::shared_ptr<LandmarkLine2D> LandmarkLine2DPtr; -typedef std::shared_ptr<const LandmarkLine2D> LandmarkLine2DConstPtr; -typedef std::weak_ptr<LandmarkLine2D> LandmarkLine2DWPtr; +WOLF_PTR_TYPEDEFS(LandmarkLine2D); //class LandmarkLine2D diff --git a/src/landmark_point_3d.h b/src/landmark_point_3d.h index 8f26cdfa4..531346c94 100644 --- a/src/landmark_point_3d.h +++ b/src/landmark_point_3d.h @@ -12,11 +12,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class LandmarkPoint3D; -typedef std::shared_ptr<LandmarkPoint3D> LandmarkPoint3DPtr; -typedef std::shared_ptr<const LandmarkPoint3D> LandmarkPoint3DConstPtr; -typedef std::weak_ptr<LandmarkPoint3D> LandmarkPoint3DWPtr; +WOLF_PTR_TYPEDEFS(LandmarkPoint3D); //class class LandmarkPoint3D : public LandmarkBase diff --git a/src/landmark_polyline_2D.h b/src/landmark_polyline_2D.h index a35c6f51f..d2b8fb8f9 100644 --- a/src/landmark_polyline_2D.h +++ b/src/landmark_polyline_2D.h @@ -29,11 +29,7 @@ typedef enum PALLET, ///< A pallet box 0.9 x 1.2 (m) } LandmarkClassification; -//forward declaration to typedef class pointers -class LandmarkPolyline2D; -typedef std::shared_ptr<LandmarkPolyline2D> LandmarkPolyline2DPtr; -typedef std::shared_ptr<const LandmarkPolyline2D> LandmarkPolyline2DConstPtr; -typedef std::weak_ptr<LandmarkPolyline2D> LandmarkPolyline2DWPtr; +WOLF_PTR_TYPEDEFS(LandmarkPolyline2D); //class class LandmarkPolyline2D : public LandmarkBase diff --git a/src/processor_gps.h b/src/processor_gps.h index f9ea51a8e..d89ff86b4 100644 --- a/src/processor_gps.h +++ b/src/processor_gps.h @@ -14,11 +14,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorGPS; -typedef std::shared_ptr<ProcessorGPS> ProcessorGPSPtr; -typedef std::shared_ptr<const ProcessorGPS> ProcessorGPSConstPtr; -typedef std::weak_ptr<ProcessorGPS> ProcessorGPSWPtr; +WOLF_PTR_TYPEDEFS(ProcessorGPS); //class class ProcessorGPS : public ProcessorBase diff --git a/src/processor_image_feature.cpp b/src/processor_image_feature.cpp index ce411c18a..a514feb06 100644 --- a/src/processor_image_feature.cpp +++ b/src/processor_image_feature.cpp @@ -65,7 +65,7 @@ ProcessorImageFeature::~ProcessorImageFeature() // } -void ProcessorImageFeature::setup(SensorCamera::Ptr _camera_ptr) +void ProcessorImageFeature::setup(SensorCameraPtr _camera_ptr) { image_.width_ = _camera_ptr->getImgWidth(); image_.height_ = _camera_ptr->getImgHeight(); diff --git a/src/processor_image_feature.h b/src/processor_image_feature.h index b73f1065e..a26e85b6a 100644 --- a/src/processor_image_feature.h +++ b/src/processor_image_feature.h @@ -26,11 +26,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorImageFeature; -typedef std::shared_ptr<ProcessorImageFeature> ProcessorImageFeaturePtr; -typedef std::shared_ptr<const ProcessorImageFeature> ProcessorImageFeatureConstPtr; -typedef std::weak_ptr<ProcessorImageFeature> ProcessorImageFeatureWPtr; +WOLF_PTR_TYPEDEFS(ProcessorImageFeature); //class class ProcessorImageFeature : public ProcessorTrackerFeature @@ -66,7 +62,7 @@ class ProcessorImageFeature : public ProcessorTrackerFeature ProcessorImageFeature(ProcessorParamsImage _params); virtual ~ProcessorImageFeature(); - virtual void setup(SensorCamera::Ptr _camera_ptr); + virtual void setup(SensorCameraPtr _camera_ptr); protected: diff --git a/src/processor_image_landmark.cpp b/src/processor_image_landmark.cpp index 5912ca5fb..c725355c1 100644 --- a/src/processor_image_landmark.cpp +++ b/src/processor_image_landmark.cpp @@ -72,7 +72,7 @@ ProcessorImageLandmark::~ProcessorImageLandmark() // } -void ProcessorImageLandmark::setup(SensorCamera::Ptr _camera_ptr) +void ProcessorImageLandmark::setup(SensorCameraPtr _camera_ptr) { image_.width_ = _camera_ptr->getImgWidth(); image_.height_ = _camera_ptr->getImgHeight(); diff --git a/src/processor_image_landmark.h b/src/processor_image_landmark.h index 3c22dc2c7..23fc48e97 100644 --- a/src/processor_image_landmark.h +++ b/src/processor_image_landmark.h @@ -26,11 +26,8 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorImageFeature; -typedef std::shared_ptr<ProcessorImageFeature> ProcessorImageFeaturePtr; -typedef std::shared_ptr<const ProcessorImageFeature> ProcessorImageFeatureConstPtr; -typedef std::weak_ptr<ProcessorImageFeature> ProcessorImageFeatureWPtr; + +WOLF_PTR_TYPEDEFS(ProcessorImageFeature); //Class class ProcessorImageLandmark : public ProcessorTrackerLandmark @@ -82,7 +79,7 @@ class ProcessorImageLandmark : public ProcessorTrackerLandmark ProcessorImageLandmark(const ProcessorParamsImage& _params); virtual ~ProcessorImageLandmark(); - virtual void setup(SensorCamera::Ptr _camera_ptr); + virtual void setup(SensorCameraPtr _camera_ptr); protected: diff --git a/src/processor_imu.h b/src/processor_imu.h index 84e75ff46..c20f141b1 100644 --- a/src/processor_imu.h +++ b/src/processor_imu.h @@ -8,11 +8,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorIMU; -typedef std::shared_ptr<ProcessorIMU> ProcessorIMUPtr; -typedef std::shared_ptr<const ProcessorIMU> ProcessorIMUConstPtr; -typedef std::weak_ptr<ProcessorIMU> ProcessorIMUWPtr; +WOLF_PTR_TYPEDEFS(ProcessorIMU); //class class ProcessorIMU : public ProcessorMotion{ diff --git a/src/processor_motion.h b/src/processor_motion.h index 08b053c5b..943c0fe0e 100644 --- a/src/processor_motion.h +++ b/src/processor_motion.h @@ -19,12 +19,6 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorMotion; -typedef std::shared_ptr<ProcessorMotion> ProcessorMotionPtr; -typedef std::shared_ptr<const ProcessorMotion> ProcessorMotionConstPtr; -typedef std::weak_ptr<ProcessorMotion> ProcessorMotionWPtr; - /** \brief class for Motion processors * * This processor integrates motion data into vehicle states. diff --git a/src/processor_odom_2D.h b/src/processor_odom_2D.h index 009812cd0..657f5b84a 100644 --- a/src/processor_odom_2D.h +++ b/src/processor_odom_2D.h @@ -14,11 +14,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorOdom2D; -typedef std::shared_ptr<ProcessorOdom2D> ProcessorOdom2DPtr; -typedef std::shared_ptr<const ProcessorOdom2D> ProcessorOdom2DConstPtr; -typedef std::weak_ptr<ProcessorOdom2D> ProcessorOdom2DWPtr; +WOLF_PTR_TYPEDEFS(ProcessorOdom2D); struct ProcessorParamsOdom2D : public ProcessorParamsBase diff --git a/src/processor_odom_3D.cpp b/src/processor_odom_3D.cpp index 04184e891..9273590e9 100644 --- a/src/processor_odom_3D.cpp +++ b/src/processor_odom_3D.cpp @@ -2,7 +2,7 @@ namespace wolf { -ProcessorOdom3D::ProcessorOdom3D(ProcessorOdom3DParams::Ptr _params, SensorOdom3D::Ptr _sensor_ptr) : +ProcessorOdom3D::ProcessorOdom3D(ProcessorOdom3DParams::Ptr _params, SensorOdom3DPtr _sensor_ptr) : ProcessorMotion("ODOM 3D", 7, 7, 6, 6), max_time_span_ (_params ? _params ->max_time_span : 1.0 ), max_buff_length_(_params ? _params ->max_buff_length : 10 ), @@ -21,7 +21,7 @@ ProcessorOdom3D::~ProcessorOdom3D() { } -void ProcessorOdom3D::setup(SensorOdom3D::Ptr sen_ptr) +void ProcessorOdom3D::setup(SensorOdom3DPtr sen_ptr) { if (sen_ptr) { @@ -249,7 +249,7 @@ ProcessorBasePtr ProcessorOdom3D::create(const std::string& _unique_name, const // cast inputs to the correct type std::shared_ptr<ProcessorOdom3DParams> prc_odo_params = std::static_pointer_cast<ProcessorOdom3DParams>(_params); - SensorOdom3D::Ptr sen_odo =std::static_pointer_cast<SensorOdom3D>(_sen_ptr); + SensorOdom3DPtr sen_odo =std::static_pointer_cast<SensorOdom3D>(_sen_ptr); // construct processor std::shared_ptr<ProcessorOdom3D> prc_odo = std::make_shared<ProcessorOdom3D>(prc_odo_params, sen_odo); diff --git a/src/processor_odom_3D.h b/src/processor_odom_3D.h index f5ec56a73..cfd26737b 100644 --- a/src/processor_odom_3D.h +++ b/src/processor_odom_3D.h @@ -17,11 +17,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorOdom3D; -typedef std::shared_ptr<ProcessorOdom3D> ProcessorOdom3DPtr; -typedef std::shared_ptr<const ProcessorOdom3D> ProcessorOdom3DConstPtr; -typedef std::weak_ptr<ProcessorOdom3D> ProcessorOdom3DWPtr; +WOLF_PTR_TYPEDEFS(ProcessorOdom3D); struct ProcessorOdom3DParams : public ProcessorParamsBase @@ -70,9 +66,9 @@ struct ProcessorOdom3DParams : public ProcessorParamsBase class ProcessorOdom3D : public ProcessorMotion { public: - ProcessorOdom3D(ProcessorOdom3DParams::Ptr _params = nullptr, SensorOdom3D::Ptr _sensor_ptr = nullptr); + ProcessorOdom3D(ProcessorOdom3DParams::Ptr _params = nullptr, SensorOdom3DPtr _sensor_ptr = nullptr); virtual ~ProcessorOdom3D(); - void setup(SensorOdom3D::Ptr sen_ptr); + void setup(SensorOdom3DPtr sen_ptr); public: virtual void data2delta(const Eigen::VectorXs& _data, diff --git a/src/processor_tracker.h b/src/processor_tracker.h index 8259de2b1..fb1029d72 100644 --- a/src/processor_tracker.h +++ b/src/processor_tracker.h @@ -13,12 +13,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorTracker; -typedef std::shared_ptr<ProcessorTracker> ProcessorTrackerPtr; -typedef std::shared_ptr<const ProcessorTracker> ProcessorTrackerConstPtr; -typedef std::weak_ptr<ProcessorTracker> ProcessorTrackerWPtr; - +WOLF_PTR_TYPEDEFS(ProcessorTracker); struct ProcessorParamsTracker : public ProcessorParamsBase { diff --git a/src/processor_tracker_feature.h b/src/processor_tracker_feature.h index c5cfb1c5d..032af6e3d 100644 --- a/src/processor_tracker_feature.h +++ b/src/processor_tracker_feature.h @@ -17,12 +17,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorTrackerFeature; -typedef std::shared_ptr<ProcessorTrackerFeature> ProcessorTrackerFeaturePtr; -typedef std::shared_ptr<const ProcessorTrackerFeature> ProcessorTrackerFeatureConstPtr; -typedef std::weak_ptr<ProcessorTrackerFeature> ProcessorTrackerFeatureWPtr; - +WOLF_PTR_TYPEDEFS(ProcessorTrackerFeature); /** \brief Feature tracker processor * diff --git a/src/processor_tracker_feature_corner.h b/src/processor_tracker_feature_corner.h index 7dc7304b6..3c63a4827 100644 --- a/src/processor_tracker_feature_corner.h +++ b/src/processor_tracker_feature_corner.h @@ -29,11 +29,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorTrackerFeatureCorner; -typedef std::shared_ptr<ProcessorTrackerFeatureCorner> ProcessorTrackerFeatureCornerPtr; -typedef std::shared_ptr<const ProcessorTrackerFeatureCorner> ProcessorTrackerFeatureCornerConstPtr; -typedef std::weak_ptr<ProcessorTrackerFeatureCorner> ProcessorTrackerFeatureCornerWPtr; +WOLF_PTR_TYPEDEFS(ProcessorTrackerFeatureCorner); //some consts.. TODO: this tuning params should be grouped in a struct and passed to the class from ros node, at constructor level diff --git a/src/processor_tracker_feature_dummy.h b/src/processor_tracker_feature_dummy.h index 5a1900255..ee52ca5b1 100644 --- a/src/processor_tracker_feature_dummy.h +++ b/src/processor_tracker_feature_dummy.h @@ -15,11 +15,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorTrackerFeatureDummy; -typedef std::shared_ptr<ProcessorTrackerFeatureDummy> ProcessorTrackerFeatureDummyPtr; -typedef std::shared_ptr<const ProcessorTrackerFeatureDummy> ProcessorTrackerFeatureDummyConstPtr; -typedef std::weak_ptr<ProcessorTrackerFeatureDummy> ProcessorTrackerFeatureDummyWPtr; +WOLF_PTR_TYPEDEFS(ProcessorTrackerFeatureDummy); //Class class ProcessorTrackerFeatureDummy : public ProcessorTrackerFeature diff --git a/src/processor_tracker_landmark.h b/src/processor_tracker_landmark.h index de52a2b0e..2fc24f49d 100644 --- a/src/processor_tracker_landmark.h +++ b/src/processor_tracker_landmark.h @@ -16,11 +16,7 @@ namespace wolf { -//forward declaration to typedef class pointers -class ProcessorTrackerLandmark; -typedef std::shared_ptr<ProcessorTrackerLandmark> ProcessorTrackerLandmarkPtr; -typedef std::shared_ptr<const ProcessorTrackerLandmark> ProcessorTrackerLandmarkConstPtr; -typedef std::weak_ptr<ProcessorTrackerLandmark> ProcessorTrackerLandmarkWPtr; +WOLF_PTR_TYPEDEFS(ProcessorTrackerLandmark); /** \brief Landmark tracker processor * diff --git a/src/processor_tracker_landmark_corner.h b/src/processor_tracker_landmark_corner.h index 57afb9d48..c4469f418 100644 --- a/src/processor_tracker_landmark_corner.h +++ b/src/processor_tracker_landmark_corner.h @@ -39,12 +39,7 @@ const Scalar min_features_ratio_th_ = 0.5; struct ProcessorParamsLaser; typedef std::shared_ptr<ProcessorParamsLaser> ProcessorParamsLaserPtr; -//forward declaration to typedef class pointers -class ProcessorTrackerLandmarkCorner; -typedef std::shared_ptr<ProcessorTrackerLandmarkCorner> ProcessorTrackerLandmarkCornerPtr; -typedef std::shared_ptr<const ProcessorTrackerLandmarkCorner> ProcessorTrackerLandmarkCornerConstPtr; -typedef std::weak_ptr<ProcessorTrackerLandmarkCorner> ProcessorTrackerLandmarkCornerWPtr; - +WOLF_PTR_TYPEDEFS(ProcessorTrackerLandmarkCorner); struct ProcessorParamsLaser : public ProcessorParamsBase { diff --git a/src/processor_tracker_landmark_dummy.h b/src/processor_tracker_landmark_dummy.h index 4e233ae06..4c8a2b8c8 100644 --- a/src/processor_tracker_landmark_dummy.h +++ b/src/processor_tracker_landmark_dummy.h @@ -12,13 +12,8 @@ namespace wolf { - -//forward declaration to typedef class pointers -class ProcessorTrackerLandmarkDummy; -typedef std::shared_ptr<ProcessorTrackerLandmarkDummy> ProcessorTrackerLandmarkDummyPtr; -typedef std::shared_ptr<const ProcessorTrackerLandmarkDummy> ProcessorTrackerLandmarkDummyConstPtr; -typedef std::weak_ptr<ProcessorTrackerLandmarkDummy> ProcessorTrackerLandmarkDummyWPtr; - + +WOLF_PTR_TYPEDEFS(ProcessorTrackerLandmarkDummy); class ProcessorTrackerLandmarkDummy : public ProcessorTrackerLandmark { diff --git a/src/processor_tracker_landmark_polyline.h b/src/processor_tracker_landmark_polyline.h index 3417b8fd8..11d74666a 100644 --- a/src/processor_tracker_landmark_polyline.h +++ b/src/processor_tracker_landmark_polyline.h @@ -40,12 +40,8 @@ typedef std::shared_ptr<LandmarkPolylineMatch> LandmarkPolylineMatchPtr; struct ProcessorParamsPolyline; typedef std::shared_ptr<ProcessorParamsPolyline> ProcessorParamsPolylinePtr; -//forward declaration to typedef class pointers -class ProcessorTrackerLandmarkPolyline; -typedef std::shared_ptr<ProcessorTrackerLandmarkPolyline> ProcessorTrackerLandmarkPolylinePtr; -typedef std::shared_ptr<const ProcessorTrackerLandmarkPolyline> ProcessorTrackerLandmarkPolylineConstPtr; -typedef std::weak_ptr<ProcessorTrackerLandmarkPolyline> ProcessorTrackerLandmarkPolylineWPtr; +WOLF_PTR_TYPEDEFS(ProcessorTrackerLandmarkPolyline); // Match Feature - Landmark @@ -99,9 +95,6 @@ struct ProcessorParamsPolyline : public ProcessorParamsBase class ProcessorTrackerLandmarkPolyline : public ProcessorTrackerLandmark { - public: - typedef std::shared_ptr<ProcessorTrackerLandmarkPolyline> Ptr; - private: laserscanutils::LineFinderIterative line_finder_; ProcessorParamsPolyline params_; diff --git a/src/sensor_camera.h b/src/sensor_camera.h index 051bf5730..7c61c98e2 100644 --- a/src/sensor_camera.h +++ b/src/sensor_camera.h @@ -17,14 +17,12 @@ struct IntrinsicsCamera : public IntrinsicsBase Eigen::VectorXs distortion; ///< d = [d_1, d_2, d_3, ...] radial distortion coefficients }; +WOLF_PTR_TYPEDEFS(SensorCamera); + /**Pin-hole camera sensor */ class SensorCamera : public SensorBase { - public: - typedef std::shared_ptr<SensorCamera> Ptr; - typedef std::weak_ptr<SensorCamera> WPtr; - public: /** \brief Constructor with arguments * diff --git a/src/sensor_gps.h b/src/sensor_gps.h index 95b9c56af..b36d09ae0 100644 --- a/src/sensor_gps.h +++ b/src/sensor_gps.h @@ -22,12 +22,10 @@ struct IntrinsicsGPS : public IntrinsicsBase // add GPS parameters here }; +WOLF_PTR_TYPEDEFS(SensorGPS); + class SensorGPS : public SensorBase { - public: - typedef std::shared_ptr<SensorGPS> Ptr; - typedef std::weak_ptr<SensorGPS> WPtr; - public: //pointer to sensor position, orientation, bias, init vehicle position and orientation SensorGPS(StateBlockPtr _p_ptr, StateBlockPtr _o_ptr, StateBlockPtr _bias_ptr, StateBlockPtr _map_position_ptr, StateBlockPtr _map_orientation_ptr); diff --git a/src/sensor_gps_fix.h b/src/sensor_gps_fix.h index a2dc9a012..9cb5583a0 100644 --- a/src/sensor_gps_fix.h +++ b/src/sensor_gps_fix.h @@ -17,6 +17,8 @@ struct IntrinsicsGPSFix : public IntrinsicsBase // Empty -- it acts only as a typedef for IntrinsicsBase, but allows future extension with parameters }; +WOLF_PTR_TYPEDEFS(SensorGPSFix); + class SensorGPSFix : public SensorBase { public: diff --git a/src/sensor_imu.h b/src/sensor_imu.h index cb78f919b..c81d1047d 100644 --- a/src/sensor_imu.h +++ b/src/sensor_imu.h @@ -11,6 +11,7 @@ struct IntrinsicsIMU : public IntrinsicsBase // add IMU parameters here }; +WOLF_PTR_TYPEDEFS(SensorIMU); class SensorIMU : public SensorBase { diff --git a/src/sensor_laser_2D.cpp b/src/sensor_laser_2D.cpp index c0e4a1f62..28b74f041 100644 --- a/src/sensor_laser_2D.cpp +++ b/src/sensor_laser_2D.cpp @@ -61,7 +61,7 @@ SensorBasePtr SensorLaser2D::create(const std::string& _unique_name, const Eigen StateBlockPtr ori_ptr = std::make_shared<StateBlock>(_extrinsics_po.tail(1), true); // cast intrinsics into derived type IntrinsicsLaser2D::Ptr params = std::static_pointer_cast<IntrinsicsLaser2D>(_intrinsics); - SensorLaser2D::Ptr sen = std::make_shared<SensorLaser2D>(pos_ptr, ori_ptr, params->scan_params); + SensorLaser2DPtr sen = std::make_shared<SensorLaser2D>(pos_ptr, ori_ptr, params->scan_params); sen->setName(_unique_name); return sen; } diff --git a/src/sensor_laser_2D.h b/src/sensor_laser_2D.h index 5c6060624..65906be99 100644 --- a/src/sensor_laser_2D.h +++ b/src/sensor_laser_2D.h @@ -19,11 +19,10 @@ struct IntrinsicsLaser2D : public IntrinsicsBase laserscanutils::LaserScanParams scan_params; }; +WOLF_PTR_TYPEDEFS(SensorLaser2D); class SensorLaser2D : public SensorBase { - public: - typedef std::shared_ptr<SensorBase> Ptr; protected: laserscanutils::LaserScanParams scan_params_; diff --git a/src/sensor_odom_2D.h b/src/sensor_odom_2D.h index c148bf262..6cd2ad336 100644 --- a/src/sensor_odom_2D.h +++ b/src/sensor_odom_2D.h @@ -13,11 +13,10 @@ struct IntrinsicsOdom2D : public IntrinsicsBase Scalar k_rot_to_rot; ///< ratio of rotation variance to rotation, for odometry noise calculation }; +WOLF_PTR_TYPEDEFS(SensorOdom2D); + class SensorOdom2D : public SensorBase { - public: - typedef std::shared_ptr<SensorOdom2D> Ptr; - protected: Scalar k_disp_to_disp_; ///< ratio of displacement variance to displacement, for odometry noise calculation Scalar k_rot_to_rot_; ///< ratio of rotation variance to rotation, for odometry noise calculation diff --git a/src/sensor_odom_3D.h b/src/sensor_odom_3D.h index f77ce2359..50a7c357f 100644 --- a/src/sensor_odom_3D.h +++ b/src/sensor_odom_3D.h @@ -32,11 +32,10 @@ struct IntrinsicsOdom3D : public IntrinsicsBase {} }; +WOLF_PTR_TYPEDEFS(SensorOdom3D); + class SensorOdom3D : public SensorBase { - public: - typedef std::shared_ptr<SensorOdom3D> Ptr; - protected: Scalar k_disp_to_disp_; ///< ratio of displacement variance to displacement, for odometry noise calculation Scalar k_disp_to_rot_; ///< ratio of displacement variance to rotation, for odometry noise calculation diff --git a/src/test/gtest_frame_base.cpp b/src/test/gtest_frame_base.cpp index ef6e14c69..55432ae25 100644 --- a/src/test/gtest_frame_base.cpp +++ b/src/test/gtest_frame_base.cpp @@ -67,7 +67,7 @@ TEST(FrameBase, LinksToTree) // Problem with 2 frames and one motion constraint between them ProblemPtr P = Problem::create(FRM_PO_2D); TrajectoryBasePtr T = P->getTrajectoryPtr(); - SensorOdom2D::Ptr S = make_shared<SensorOdom2D>(make_shared<StateBlock>(2), make_shared<StateBlock>(1), 1,1); + SensorOdom2DPtr S = make_shared<SensorOdom2D>(make_shared<StateBlock>(2), make_shared<StateBlock>(1), 1,1); P->getHardwarePtr()->addSensor(S); FrameBasePtr F1 = make_shared<FrameBase>(1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); T->addFrame(F1); diff --git a/src/wolf.h b/src/wolf.h index 28d259f64..01fca0638 100644 --- a/src/wolf.h +++ b/src/wolf.h @@ -195,131 +195,81 @@ typedef enum // TYPEDEFS FOR POINTERS, LISTS AND ITERATORS IN THE WOLF TREE ///////////////////////////////////////////////////////////////////////// -// - forwards for pointers -class NodeBase; -class Problem; -class HardwareBase; -class SensorBase; -struct IntrinsicsBase; -class ProcessorBase; -class ProcessorMotion; -struct ProcessorParamsBase; -class TrajectoryBase; -class FrameBase; -class CaptureBase; -class CaptureMotion; -class FeatureBase; -class ConstraintBase; -class MapBase; -class LandmarkBase; -class StateBlock; -class StateQuaternion; -class LocalParametrizationBase; +#define WOLF_PTR_TYPEDEFS(ClassName) \ + class ClassName; \ + typedef std::shared_ptr<ClassName> ClassName##Ptr; \ + typedef std::shared_ptr<const ClassName> ClassName##ConstPtr; \ + typedef std::weak_ptr<ClassName> ClassName##WPtr; + +#define WOLF_LIST_TYPEDEFS(ClassName) \ + class ClassName; \ + typedef std::list<ClassName##Ptr> ClassName##List; \ + typedef ClassName##List::iterator ClassName##Iter; + // NodeBase -typedef std::shared_ptr<NodeBase> NodeBasePtr; -typedef std::shared_ptr<const NodeBase> NodeBaseConstPtr; -typedef std::weak_ptr<NodeBase> NodeBaseWPtr; +WOLF_PTR_TYPEDEFS(NodeBase); // Problem -typedef std::shared_ptr<Problem> ProblemPtr; -typedef std::shared_ptr<const Problem> ProblemConstPtr; -typedef std::weak_ptr<Problem> ProblemWPtr; +WOLF_PTR_TYPEDEFS(Problem); // Hardware -typedef std::shared_ptr<HardwareBase> HardwareBasePtr; -typedef std::shared_ptr<const HardwareBase> HardwareBaseConstPtr; -typedef std::weak_ptr<HardwareBase> HardwareBaseWPtr; +WOLF_PTR_TYPEDEFS(HardwareBase); // - Sensors -typedef std::shared_ptr<SensorBase> SensorBasePtr; -typedef std::shared_ptr<const SensorBase> SensorBaseConstPtr; -typedef std::weak_ptr<SensorBase> SensorBaseWPtr; -typedef std::list<SensorBasePtr> SensorBaseList; -typedef SensorBaseList::iterator SensorBaseIter; +WOLF_PTR_TYPEDEFS(SensorBase); +WOLF_LIST_TYPEDEFS(SensorBase); // - - Intrinsics +struct IntrinsicsBase; typedef std::shared_ptr<IntrinsicsBase> IntrinsicsBasePtr; typedef std::shared_ptr<const IntrinsicsBase> IntrinsicsBaseConstPtr; // - Processors -typedef std::shared_ptr<ProcessorBase> ProcessorBasePtr; -typedef std::shared_ptr<const ProcessorBase> ProcessorBaseConstPtr; -typedef std::weak_ptr<ProcessorBase> ProcessorBaseWPtr; -typedef std::list<ProcessorBasePtr> ProcessorBaseList; -typedef ProcessorBaseList::iterator ProcessorBaseIter; +WOLF_PTR_TYPEDEFS(ProcessorBase); +WOLF_LIST_TYPEDEFS(ProcessorBase); // - ProcessorMotion -typedef std::shared_ptr<ProcessorMotion> ProcessorMotionPtr; -typedef std::shared_ptr<const ProcessorMotion> ProcessorMotionConstPtr; -typedef std::weak_ptr<ProcessorMotion> ProcessorMotionWPtr; +WOLF_PTR_TYPEDEFS(ProcessorMotion); // - - Processor params +struct ProcessorParamsBase; typedef std::shared_ptr<ProcessorParamsBase> ProcessorParamsBasePtr; typedef std::shared_ptr<const ProcessorParamsBase> ProcessorParamsBaseConstPtr; // Trajectory -typedef std::shared_ptr<TrajectoryBase> TrajectoryBasePtr; -typedef std::shared_ptr<const TrajectoryBase> TrajectoryBaseConstPtr; -typedef std::weak_ptr<TrajectoryBase> TrajectoryBaseWPtr; +WOLF_PTR_TYPEDEFS(TrajectoryBase); // - Frame -typedef std::shared_ptr<FrameBase> FrameBasePtr; -typedef std::shared_ptr<const FrameBase> FrameBaseConstPtr; -typedef std::weak_ptr<FrameBase> FrameBaseWPtr; -typedef std::list<FrameBasePtr> FrameBaseList; -typedef FrameBaseList::iterator FrameBaseIter; +WOLF_PTR_TYPEDEFS(FrameBase); +WOLF_LIST_TYPEDEFS(FrameBase); // - Capture -typedef std::shared_ptr<CaptureBase> CaptureBasePtr; -typedef std::shared_ptr<const CaptureBase> CaptureBaseConstPtr; -typedef std::weak_ptr<CaptureBase> CaptureBaseWPtr; -typedef std::list<CaptureBasePtr> CaptureBaseList; -typedef CaptureBaseList::iterator CaptureBaseIter; - -// - CaptureMotion -typedef std::shared_ptr<CaptureMotion> CaptureMotionPtr; -typedef std::weak_ptr<CaptureMotion> CaptureMotionWPtr; +WOLF_PTR_TYPEDEFS(CaptureBase); +WOLF_LIST_TYPEDEFS(CaptureBase); // - Feature -typedef std::shared_ptr<FeatureBase> FeatureBasePtr; -typedef std::shared_ptr<const FeatureBase> FeatureBaseConstPtr; -typedef std::weak_ptr<FeatureBase> FeatureBaseWPtr; -typedef std::list<FeatureBasePtr> FeatureBaseList; -typedef FeatureBaseList::iterator FeatureBaseIter; +WOLF_PTR_TYPEDEFS(FeatureBase); +WOLF_LIST_TYPEDEFS(FeatureBase); // - Constraint -typedef std::shared_ptr<ConstraintBase> ConstraintBasePtr; -typedef std::shared_ptr<const ConstraintBase> ConstraintBaseConstPtr; -typedef std::weak_ptr<ConstraintBase> ConstraintBaseWPtr; -typedef std::list<ConstraintBasePtr> ConstraintBaseList; -typedef ConstraintBaseList::iterator ConstraintBaseIter; +WOLF_PTR_TYPEDEFS(ConstraintBase); +WOLF_LIST_TYPEDEFS(ConstraintBase); // Map -typedef std::shared_ptr<MapBase> MapBasePtr; -typedef std::shared_ptr<const MapBase> MapBaseConstPtr; -typedef std::weak_ptr<MapBase> MapBaseWPtr; -typedef std::list<MapBasePtr> MapBaseList; -typedef MapBaseList::iterator MapBaseIter; +WOLF_PTR_TYPEDEFS(MapBase); // - Landmark -typedef std::shared_ptr<LandmarkBase> LandmarkBasePtr; -typedef std::shared_ptr<const LandmarkBase> LandmarkBaseConstPtr; -typedef std::weak_ptr<LandmarkBase> LandmarkBaseWPtr; -typedef std::list<LandmarkBasePtr> LandmarkBaseList; -typedef LandmarkBaseList::iterator LandmarkBaseIter; +WOLF_PTR_TYPEDEFS(LandmarkBase); +WOLF_LIST_TYPEDEFS(LandmarkBase); // - - State blocks -typedef std::shared_ptr<StateBlock> StateBlockPtr; -typedef std::shared_ptr<const StateBlock> StateBlockConstPtr; -typedef std::weak_ptr<StateBlock> StateBlockWPtr; -typedef std::list<StateBlockPtr> StateBlockList; -typedef StateBlockList::iterator StateBlockIter; -typedef std::shared_ptr<StateQuaternion> StateQuaternionPtr; +WOLF_PTR_TYPEDEFS(StateBlock); +WOLF_LIST_TYPEDEFS(StateBlock); +WOLF_PTR_TYPEDEFS(StateQuaternion); // - - Local Parametrization -typedef std::shared_ptr<LocalParametrizationBase> LocalParametrizationBasePtr; -typedef std::shared_ptr<const LocalParametrizationBase> LocalParametrizationBaseConstPtr; +WOLF_PTR_TYPEDEFS(LocalParametrizationBase); // ================================================== -- GitLab