Added setters and getters for MATLAB wrapper
							parent
							
								
									71b6c1da82
								
							
						
					
					
						commit
						2c0c3d1955
					
				
							
								
								
									
										24
									
								
								gtsam.h
								
								
								
								
							
							
						
						
									
										24
									
								
								gtsam.h
								
								
								
								
							|  | @ -2489,10 +2489,30 @@ class NavState { | |||
|   gtsam::Pose3 pose() const; | ||||
| }; | ||||
| 
 | ||||
| #include <gtsam/navigation/PreintegratedRotation.h> | ||||
| virtual class PreintegratedRotationParams { | ||||
|   PreintegratedRotationParams(); | ||||
|   void setGyroscopeCovariance(Matrix cov); | ||||
|   void setOmegaCoriolis(Vector omega); | ||||
|   void setBodyPSensor(const gtsam::Pose3& pose); | ||||
| 
 | ||||
|   Matrix getGyroscopeCovariance() const; | ||||
| 
 | ||||
|   // TODO(frank): allow optional
 | ||||
|   //  boost::optional<Vector3> getOmegaCoriolis() const;
 | ||||
|   //  boost::optional<Pose3>   getBodyPSensor()   const;
 | ||||
| }; | ||||
| 
 | ||||
| #include <gtsam/navigation/PreintegrationParams.h> | ||||
| class PreintegrationParams { | ||||
| virtual class PreintegrationParams : gtsam::PreintegratedRotationParams { | ||||
|   PreintegrationParams(Vector n_gravity); | ||||
|   // TODO(frank): add setters/getters or make this MATLAB wrapper feature
 | ||||
|   void setAccelerometerCovariance(Matrix cov); | ||||
|   void setIntegrationCovariance(Matrix cov); | ||||
|   void setUse2ndOrderCoriolis(bool flag); | ||||
| 
 | ||||
|   Matrix getAccelerometerCovariance() const; | ||||
|   Matrix getIntegrationCovariance()   const; | ||||
|   bool   getUse2ndOrderCoriolis()     const; | ||||
| }; | ||||
| 
 | ||||
| #include <gtsam/navigation/PreintegrationBase.h> | ||||
|  |  | |||
|  | @ -26,24 +26,25 @@ | |||
| 
 | ||||
| namespace gtsam { | ||||
| 
 | ||||
| /**
 | ||||
|  * PreintegratedRotation is the base class for all PreintegratedMeasurements | ||||
|  * classes (in AHRSFactor, ImuFactor, and CombinedImuFactor). | ||||
|  * It includes the definitions of the preintegrated rotation. | ||||
|  */ | ||||
| class PreintegratedRotation { | ||||
|  public: | ||||
|   /// Parameters for pre-integration:
 | ||||
|   /// Usage: Create just a single Params and pass a shared pointer to the constructor
 | ||||
|   struct Params { | ||||
| /// Parameters for pre-integration:
 | ||||
| /// Usage: Create just a single Params and pass a shared pointer to the constructor
 | ||||
| struct PreintegratedRotationParams { | ||||
|   Matrix3 gyroscopeCovariance;  ///< continuous-time "Covariance" of gyroscope measurements
 | ||||
|   boost::optional<Vector3> omegaCoriolis;  ///< Coriolis constant
 | ||||
|   boost::optional<Pose3> body_P_sensor;    ///< The pose of the sensor in the body frame
 | ||||
| 
 | ||||
|     Params() : gyroscopeCovariance(I_3x3) {} | ||||
|   PreintegratedRotationParams() : gyroscopeCovariance(I_3x3) {} | ||||
| 
 | ||||
|   virtual void print(const std::string& s) const; | ||||
|     virtual bool equals(const Params& other, double tol=1e-9) const; | ||||
|   virtual bool equals(const PreintegratedRotationParams& other, double tol=1e-9) const; | ||||
| 
 | ||||
|   void setGyroscopeCovariance(const Matrix3& cov)   { gyroscopeCovariance = cov;  } | ||||
|   void setOmegaCoriolis(const Vector3& omega)       { omegaCoriolis.reset(omega); } | ||||
|   void setBodyPSensor(const Pose3& pose)            { body_P_sensor.reset(pose);  } | ||||
| 
 | ||||
|   const Matrix3& getGyroscopeCovariance()     const { return gyroscopeCovariance; } | ||||
|   boost::optional<Vector3> getOmegaCoriolis() const { return omegaCoriolis; } | ||||
|   boost::optional<Pose3>   getBodyPSensor()   const { return body_P_sensor; } | ||||
| 
 | ||||
|  private: | ||||
|   /** Serialization function */ | ||||
|  | @ -55,7 +56,16 @@ class PreintegratedRotation { | |||
|     ar & BOOST_SERIALIZATION_NVP(omegaCoriolis); | ||||
|     ar & BOOST_SERIALIZATION_NVP(body_P_sensor); | ||||
|   } | ||||
|   }; | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  * PreintegratedRotation is the base class for all PreintegratedMeasurements | ||||
|  * classes (in AHRSFactor, ImuFactor, and CombinedImuFactor). | ||||
|  * It includes the definitions of the preintegrated rotation. | ||||
|  */ | ||||
| class PreintegratedRotation { | ||||
|  public: | ||||
|   typedef PreintegratedRotationParams Params; | ||||
| 
 | ||||
|  protected: | ||||
|   /// Parameters
 | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ namespace gtsam { | |||
| 
 | ||||
| /// Parameters for pre-integration:
 | ||||
| /// Usage: Create just a single Params and pass a shared pointer to the constructor
 | ||||
| struct PreintegrationParams: PreintegratedRotation::Params { | ||||
| struct PreintegrationParams: PreintegratedRotationParams { | ||||
|   Matrix3 accelerometerCovariance; ///< continuous-time "Covariance" of accelerometer
 | ||||
|   Matrix3 integrationCovariance; ///< continuous-time "Covariance" describing integration uncertainty
 | ||||
|   bool use2ndOrderCoriolis; ///< Whether to use second order Coriolis integration
 | ||||
|  | @ -50,6 +50,14 @@ struct PreintegrationParams: PreintegratedRotation::Params { | |||
|   void print(const std::string& s) const; | ||||
|   bool equals(const PreintegratedRotation::Params& other, double tol) const; | ||||
| 
 | ||||
|   void setAccelerometerCovariance(const Matrix3& cov) { accelerometerCovariance = cov; } | ||||
|   void setIntegrationCovariance(const Matrix3& cov)   { integrationCovariance = cov; } | ||||
|   void setUse2ndOrderCoriolis(bool flag)              { use2ndOrderCoriolis = flag; } | ||||
| 
 | ||||
|   const Matrix3& getAccelerometerCovariance() const { return accelerometerCovariance; } | ||||
|   const Matrix3& getIntegrationCovariance()   const { return integrationCovariance; } | ||||
|   bool           getUse2ndOrderCoriolis()     const { return use2ndOrderCoriolis; } | ||||
| 
 | ||||
| protected: | ||||
|   /// Default constructor for serialization only: uninitialized!
 | ||||
|   PreintegrationParams() {} | ||||
|  | @ -60,7 +68,7 @@ protected: | |||
|   void serialize(ARCHIVE & ar, const unsigned int /*version*/) { | ||||
|     namespace bs = ::boost::serialization; | ||||
|     ar & boost::serialization::make_nvp("PreintegratedRotation_Params", | ||||
|          boost::serialization::base_object<PreintegratedRotation::Params>(*this)); | ||||
|          boost::serialization::base_object<PreintegratedRotationParams>(*this)); | ||||
|     ar & bs::make_nvp("accelerometerCovariance", bs::make_array(accelerometerCovariance.data(), accelerometerCovariance.size())); | ||||
|     ar & bs::make_nvp("integrationCovariance", bs::make_array(integrationCovariance.data(), integrationCovariance.size())); | ||||
|     ar & BOOST_SERIALIZATION_NVP(use2ndOrderCoriolis); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue