Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate 3D models #5

Merged
merged 25 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
31e8310
Update devel to build on Ubuntu Jammy (22.04) (#326)
svwilliams May 12, 2023
6a9a61d
Tailor: Updating Jenkinsfile
locus-services Jun 3, 2023
8a6f010
Tailor: Updating Jenkinsfile
locus-services Jun 7, 2023
05812c3
Derive the fixed landmarks from the standard landmarks (#259)
svwilliams Jul 5, 2023
1069e3e
Minor header fixes (#266)
efernandez Jul 5, 2023
d7de264
Add missed geometry_msgs package (#272)
efernandez Jul 5, 2023
bb25c35
Print graph & transaction on optimization failure (#321)
efernandez Jul 5, 2023
ed21f99
add missing tf timeout at differential mode of IMU, odometry, and pos…
fabianhirmann Jul 10, 2023
6814698
[RST-7809] Fix optimization errors when the orientation is initialize…
svwilliams Aug 16, 2023
602d436
Tailor: Updating Jenkinsfile
locus-services Aug 30, 2023
082786d
Update changelogs
garyservin Sep 25, 2023
c8ab2f6
0.7.0
garyservin Sep 25, 2023
a0f039b
Tailor: Updating Jenkinsfile
locus-services Oct 21, 2023
6bb6233
Add ROS1 CI (#347)
paulbovbel Nov 15, 2023
75ea820
Vision constraints (#349)
oscarmendezm Dec 5, 2023
27423b0
Fix tests (#348)
paulbovbel Dec 11, 2023
feb29fc
Tailor: Updating Jenkinsfile
locus-services Dec 27, 2023
6ae3a51
Merge remote-tracking branch 'upstream/devel' into devel
fabianhirmann Jan 23, 2024
86001a7
add 3D models for motion model (Unicycle3D), publisher (Odometry3DPub…
fabianhirmann Feb 16, 2024
2132be6
add sensor model for IMU3D; extend fuse_models::common with variants …
fabianhirmann Feb 27, 2024
d4be009
deduplicate code at unicycle_3d_predict.h
fabianhirmann Feb 28, 2024
7db9351
port sensor model Odometry2D to 3D; fix typo in comment (still TODO: …
fabianhirmann Sep 2, 2024
ef21b5d
integrate sensor processing with differential Pose in 3D (including n…
fabianhirmann Sep 27, 2024
5257333
add proper copyright notice for ARTI
fabianhirmann Oct 1, 2024
90c9443
NormalDeltaOrientation3DEulerCostFunctor and NormalDeltaPose3DEulerCo…
fabianhirmann Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fuse_constraints/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ add_library(${PROJECT_NAME}
src/absolute_orientation_3d_stamped_euler_constraint.cpp
src/absolute_pose_2d_stamped_constraint.cpp
src/absolute_pose_3d_stamped_constraint.cpp
src/absolute_pose_3d_stamped_euler_constraint.cpp
src/fixed_3d_landmark_constraint.cpp
src/marginal_constraint.cpp
src/marginal_cost_function.cpp
Expand Down
30 changes: 30 additions & 0 deletions fuse_constraints/fuse_plugins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
the 2D linear acceleration.
</description>
</class>
<class type="fuse_constraints::AbsoluteAccelerationAngular3DStampedConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 3D angular acceleration, or a direct measurement of
the 3D angular acceleration.
</description>
</class>
<class type="fuse_constraints::AbsoluteAccelerationLinear3DStampedConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 3D linear acceleration, or a direct measurement of
the 3D linear acceleration.
</description>
</class>
<class type="fuse_constraints::AbsoluteOrientation2DStampedConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 2D orientation, or a direct measurement of the
Expand Down Expand Up @@ -41,6 +53,18 @@
the 2D linear velocity.
</description>
</class>
<class type="fuse_constraints::AbsoluteVelocityAngular3DStampedConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 3D angular velocity, or a direct measurement of
the 3D angular velocity.
</description>
</class>
<class type="fuse_constraints::AbsoluteVelocityLinear3DStampedConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 3D linear velocity, or a direct measurement of
the 3D linear velocity.
</description>
</class>
<class type="fuse_constraints::AbsoluteOrientation3DStampedConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 3D orientation, or a direct measurement of the
Expand All @@ -63,6 +87,12 @@
A constraint that represents either prior information about a 3D pose, or a direct measurement of the 3D pose.
</description>
</class>
<class type="fuse_constraints::AbsolutePose3DStampedEulerConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents either prior information about a 3D pose, or a direct measurement of the 3D pose,
with the 3D orientation as roll-pitch-yaw Euler angles.
</description>
</class>
<class type="fuse_constraints::MarginalConstraint" base_class_type="fuse_core::Constraint">
<description>
A constraint that represents remaining marginal information on a set of variables.
Expand Down
12 changes: 12 additions & 0 deletions fuse_constraints/include/fuse_constraints/absolute_constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@
#include <fuse_core/uuid.h>
#include <fuse_variables/acceleration_angular_2d_stamped.h>
#include <fuse_variables/acceleration_linear_2d_stamped.h>
#include <fuse_variables/acceleration_angular_3d_stamped.h>
#include <fuse_variables/acceleration_linear_3d_stamped.h>
#include <fuse_variables/orientation_2d_stamped.h>
#include <fuse_variables/position_2d_stamped.h>
#include <fuse_variables/position_3d_stamped.h>
#include <fuse_variables/velocity_angular_2d_stamped.h>
#include <fuse_variables/velocity_linear_2d_stamped.h>
#include <fuse_variables/velocity_angular_3d_stamped.h>
#include <fuse_variables/velocity_linear_3d_stamped.h>

#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
Expand Down Expand Up @@ -186,22 +190,30 @@ class AbsoluteConstraint : public fuse_core::Constraint
// Define unique names for the different variations of the absolute constraint
using AbsoluteAccelerationAngular2DStampedConstraint = AbsoluteConstraint<fuse_variables::AccelerationAngular2DStamped>;
using AbsoluteAccelerationLinear2DStampedConstraint = AbsoluteConstraint<fuse_variables::AccelerationLinear2DStamped>;
using AbsoluteAccelerationAngular3DStampedConstraint = AbsoluteConstraint<fuse_variables::AccelerationAngular3DStamped>;
using AbsoluteAccelerationLinear3DStampedConstraint = AbsoluteConstraint<fuse_variables::AccelerationLinear3DStamped>;
using AbsoluteOrientation2DStampedConstraint = AbsoluteConstraint<fuse_variables::Orientation2DStamped>;
using AbsolutePosition2DStampedConstraint = AbsoluteConstraint<fuse_variables::Position2DStamped>;
using AbsolutePosition3DStampedConstraint = AbsoluteConstraint<fuse_variables::Position3DStamped>;
using AbsoluteVelocityAngular2DStampedConstraint = AbsoluteConstraint<fuse_variables::VelocityAngular2DStamped>;
using AbsoluteVelocityLinear2DStampedConstraint = AbsoluteConstraint<fuse_variables::VelocityLinear2DStamped>;
using AbsoluteVelocityAngular3DStampedConstraint = AbsoluteConstraint<fuse_variables::VelocityAngular3DStamped>;
using AbsoluteVelocityLinear3DStampedConstraint = AbsoluteConstraint<fuse_variables::VelocityLinear3DStamped>;
} // namespace fuse_constraints

// Include the template implementation
#include <fuse_constraints/absolute_constraint_impl.h>

BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteAccelerationAngular2DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteAccelerationLinear2DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteAccelerationAngular3DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteAccelerationLinear3DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteOrientation2DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsolutePosition2DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsolutePosition3DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteVelocityAngular2DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteVelocityLinear2DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteVelocityAngular3DStampedConstraint);
BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsoluteVelocityLinear3DStampedConstraint);

#endif // FUSE_CONSTRAINTS_ABSOLUTE_CONSTRAINT_H
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ inline std::string AbsoluteConstraint<fuse_variables::AccelerationLinear2DStampe
return "fuse_constraints::AbsoluteAccelerationLinear2DStampedConstraint";
}

template<>
inline std::string AbsoluteConstraint<fuse_variables::AccelerationAngular3DStamped>::type() const
{
return "fuse_constraints::AbsoluteAccelerationAngular3DStampedConstraint";
}

template<>
inline std::string AbsoluteConstraint<fuse_variables::AccelerationLinear3DStamped>::type() const
{
return "fuse_constraints::AbsoluteAccelerationLinear3DStampedConstraint";
}

template<>
inline std::string AbsoluteConstraint<fuse_variables::Orientation2DStamped>::type() const
{
Expand Down Expand Up @@ -181,6 +193,18 @@ inline std::string AbsoluteConstraint<fuse_variables::VelocityLinear2DStamped>::
return "fuse_constraints::AbsoluteVelocityLinear2DStampedConstraint";
}

template<>
inline std::string AbsoluteConstraint<fuse_variables::VelocityAngular3DStamped>::type() const
{
return "fuse_constraints::AbsoluteVelocityAngular3DStampedConstraint";
}

template<>
inline std::string AbsoluteConstraint<fuse_variables::VelocityLinear3DStamped>::type() const
{
return "fuse_constraints::AbsoluteVelocityLinear3DStampedConstraint";
}

} // namespace fuse_constraints

#endif // FUSE_CONSTRAINTS_ABSOLUTE_CONSTRAINT_IMPL_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2018, Locus Robotics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FUSE_CONSTRAINTS_ABSOLUTE_POSE_3D_STAMPED_EULER_CONSTRAINT_H
#define FUSE_CONSTRAINTS_ABSOLUTE_POSE_3D_STAMPED_EULER_CONSTRAINT_H

#include <fuse_core/constraint.h>
#include <fuse_core/eigen.h>
#include <fuse_core/fuse_macros.h>
#include <fuse_core/serialization.h>
#include <fuse_core/uuid.h>
#include <fuse_variables/orientation_3d_stamped.h>
#include <fuse_variables/position_3d_stamped.h>

#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <Eigen/Dense>

#include <ostream>
#include <string>
#include <vector>


namespace fuse_constraints
{

/**
* @brief A constraint that represents either prior information about a 3D pose, or a direct measurement of the 3D pose.
*
* A 3D pose is the combination of a 3D position and a 3D orientation variable. As a convenience, this class applies
* an absolute constraint on both variables at once. This type of constraint arises in many situations. In mapping
* it is common to define the very first pose as the origin. Some sensors, such as GPS, provide direct measurements
* of the robot's pose in the global frame. And localization systems often match laserscans or pointclouds to a prior
* map (scan-to-map measurements). This constraint holds the measured 3D pose and the measurement
* uncertainty/covariance. Orientations are represented as roll, pitch, yaw.
*/
class AbsolutePose3DStampedEulerConstraint : public fuse_core::Constraint
{
public:
FUSE_CONSTRAINT_DEFINITIONS_WITH_EIGEN(AbsolutePose3DStampedEulerConstraint);

/**
* @brief Default constructor
*/
AbsolutePose3DStampedEulerConstraint() = default;

/**
* @brief Create a constraint using a measurement/prior of the 3D pose
*
* @param[in] source The name of the sensor or motion model that generated this constraint
* @param[in] position The variable representing the position components of the pose
* @param[in] orientation The variable representing the orientation components of the pose
* @param[in] mean The measured/prior pose as a vector (6x1 vector: x, y, z, roll, pitch, yaw)
* @param[in] covariance The measurement/prior covariance (6x6 matrix: x, y, z, roll, pitch, yaw)
*/
AbsolutePose3DStampedEulerConstraint(
const std::string& source,
const fuse_variables::Position3DStamped& position,
const fuse_variables::Orientation3DStamped& orientation,
const fuse_core::Vector6d& mean,
const fuse_core::Matrix6d& covariance);

/**
* @brief Destructor
*/
virtual ~AbsolutePose3DStampedEulerConstraint() = default;

/**
* @brief Read-only access to the measured/prior vector of mean values.
*
* Order is (x, y, z, roll, pitch, yaw)
*/
const fuse_core::Vector6d& mean() const { return mean_; }

/**
* @brief Read-only access to the square root information matrix.
*
* Order is (x, y, z, roll, pitch, yaw)
*/
const fuse_core::Matrix6d& sqrtInformation() const { return sqrt_information_; }

/**
* @brief Compute the measurement covariance matrix.
*
* Order is (x, y, z, roll, pitch, yaw)
*/
fuse_core::Matrix6d covariance() const { return (sqrt_information_.transpose() * sqrt_information_).inverse(); }

/**
* @brief Print a human-readable description of the constraint to the provided stream.
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
void print(std::ostream& stream = std::cout) const override;

/**
* @brief Construct an instance of this constraint's cost function
*
* The function caller will own the new cost function instance. It is the responsibility of the caller to delete
* the cost function object when it is no longer needed. If the pointer is provided to a Ceres::Problem object, the
* Ceres::Problem object will takes ownership of the pointer and delete it during destruction.
*
* @return A base pointer to an instance of a derived CostFunction.
*/
ceres::CostFunction* costFunction() const override;

protected:
fuse_core::Vector6d mean_; //!< The measured/prior mean vector for this variable
fuse_core::Matrix6d sqrt_information_; //!< The square root information matrix

private:
// Allow Boost Serialization access to private methods
friend class boost::serialization::access;

/**
* @brief The Boost Serialize method that serializes all of the data members in to/out of the archive
*
* @param[in/out] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read/written. Generally unused.
*/
template<class Archive>
void serialize(Archive& archive, const unsigned int /* version */)
{
archive & boost::serialization::base_object<fuse_core::Constraint>(*this);
archive & mean_;
archive & sqrt_information_;
}
};

} // namespace fuse_constraints

BOOST_CLASS_EXPORT_KEY(fuse_constraints::AbsolutePose3DStampedEulerConstraint);

#endif // FUSE_CONSTRAINTS_ABSOLUTE_POSE_3D_STAMPED_EULER_CONSTRAINT_H
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace fuse_constraints
*
* So, for example, if
* b_ = [ measured_yaw ]
* [ meausred_roll ]
* [ measured_roll ]
*
* then the cost function is of the form:
*
Expand Down Expand Up @@ -140,7 +140,7 @@ class NormalPriorOrientation3DEulerCostFunctor

private:
fuse_core::MatrixXd A_; //!< The residual weighting matrix, most likely the square root information matrix
fuse_core::VectorXd b_; //!< The measured 3D orientation (quaternion) value
fuse_core::VectorXd b_; //!< The orientation measurement or prior. Its order must match the values in \p axes.
std::vector<Euler> axes_; //!< The Euler angle axes that we're measuring
};

Expand Down
Loading