-
Notifications
You must be signed in to change notification settings - Fork 92
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
[ROS2] Porting bodies::Body::computeBoundingBox changes from noetic to ROS2 #239
Merged
Merged
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
92744ad
merging obb into ros2
peci1 2e7de79
test bounding box updated
spelletier1996 f74c0d1
Added obb.h
tmayoff 994b258
Merge branch 'ros2-obb' of github.com:spelletier1996/geometric_shapes…
tmayoff 517648f
updated tests and cpp to 232
spelletier1996 5d04936
Merge branch 'ros2-obb' of github.com:spelletier1996/geometric_shapes…
spelletier1996 d6a80af
Fixed build
tmayoff 483b844
Fixed license
tmayoff c014758
added obb to bodies header
spelletier1996 9caa2eb
Merge branch 'ros2-obb' of github.com:spelletier1996/geometric_shapes…
spelletier1996 169d33b
Fixed FCL dependency
tmayoff e055eed
.
tmayoff a108625
merged changes from 232
spelletier1996 0814306
Merge branch 'ros2-obb' of github.com:spelletier1996/geometric_shapes…
spelletier1996 8aa8ca3
Builds tests pass (copyright fails though)
tmayoff f49fdf6
Reverted copyright notice changes
tmayoff fdad9d3
Fixed copyright notices
tmayoff 43939d4
^
tmayoff 48bc778
Ran pre-commit
tmayoff 5f351f4
added pcl to package.xml
tmayoff e15c6af
format
tmayoff 520d5a5
Copyright year
spelletier1996 126955b
reversed white space change
spelletier1996 94ea0df
removed commented depends
spelletier1996 48bba6f
toFCL fromFCL removed, FCL 0.5 checks removed
spelletier1996 26212d1
Merge pull request #2 from spelletier1996/pr-review-fixes
spelletier1996 b36a5d7
addressing header and xml comments
spelletier1996 6c321ec
re-added accidental removal of translation line
spelletier1996 1818146
correct ifdef
spelletier1996 5bd19db
fix redundant depends
tmayoff 998a998
added copyright notice
tmayoff 0d04ba5
copied the copyright from the obb.h file
tmayoff daa7464
Merge branch 'ros2' into ros2-obb
tmayoff 7f76e3b
remove fcl export
tmayoff 0117184
Added libfcl to back to exec-depend
tmayoff 6536349
Fix whitespace
rhaschke 4d1c5e2
Update package.xml
tmayoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
// Copyright 2024 Open Robotics | ||
// | ||
// 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 Open Robotics 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. | ||
|
||
/* Author: Martin Pecka */ | ||
|
||
#ifndef GEOMETRIC_SHAPES_OBB_H | ||
#define GEOMETRIC_SHAPES_OBB_H | ||
|
||
#include <memory> | ||
|
||
#include <Eigen/Core> | ||
#include <Eigen/Geometry> | ||
|
||
#include <eigen_stl_containers/eigen_stl_containers.h> | ||
#include <geometric_shapes/aabb.h> | ||
|
||
namespace bodies | ||
{ | ||
class OBBPrivate; | ||
|
||
/** \brief Represents an oriented bounding box. */ | ||
class OBB | ||
{ | ||
public: | ||
/** \brief Initialize an oriented bounding box at position 0, with 0 extents and | ||
* identity orientation. */ | ||
OBB(); | ||
OBB(const OBB& other); | ||
OBB(const Eigen::Isometry3d& pose, const Eigen::Vector3d& extents); | ||
virtual ~OBB(); | ||
|
||
OBB& operator=(const OBB& other); | ||
|
||
/** | ||
* \brief Set both the pose and extents of the OBB. | ||
* \param [in] pose New pose of the OBB. | ||
* \param [in] extents New extents of the OBB. | ||
*/ | ||
void setPoseAndExtents(const Eigen::Isometry3d& pose, const Eigen::Vector3d& extents); | ||
|
||
/** | ||
* \brief Get the extents of the OBB. | ||
* \return The extents. | ||
*/ | ||
Eigen::Vector3d getExtents() const; | ||
|
||
/** | ||
* \brief Get the extents of the OBB. | ||
* \param extents [out] The extents. | ||
*/ | ||
void getExtents(Eigen::Vector3d& extents) const; | ||
|
||
/** | ||
* \brief Get the pose of the OBB. | ||
* \return The pose. | ||
*/ | ||
Eigen::Isometry3d getPose() const; | ||
|
||
/** | ||
* \brief Get The pose of the OBB. | ||
* \param pose The pose. | ||
*/ | ||
void getPose(Eigen::Isometry3d& pose) const; | ||
|
||
/** | ||
* \brief Convert this OBB to an axis-aligned BB. | ||
* \return The AABB. | ||
*/ | ||
AABB toAABB() const; | ||
|
||
/** | ||
* \brief Convert this OBB to an axis-aligned BB. | ||
* \param aabb The AABB. | ||
*/ | ||
void toAABB(AABB& aabb) const; | ||
|
||
/** | ||
* \brief Add the other OBB to this one and compute an approximate enclosing OBB. | ||
* \param box The other box to add. | ||
* \return Pointer to this OBB after the update. | ||
*/ | ||
OBB* extendApprox(const OBB& box); | ||
|
||
/** | ||
* \brief Check if this OBB contains the given point. | ||
* \param point The point to check. | ||
* \return Whether the point is inside or not. | ||
*/ | ||
bool contains(const Eigen::Vector3d& point) const; | ||
|
||
/** | ||
* \brief Check whether this and the given OBBs have nonempty intersection. | ||
* \param other The other OBB to check. | ||
* \return Whether the OBBs overlap. | ||
*/ | ||
bool overlaps(const OBB& other) const; | ||
|
||
/** | ||
* \brief Check if this OBB contains whole other OBB. | ||
* \param point The point to check. | ||
* \return Whether the point is inside or not. | ||
*/ | ||
bool contains(const OBB& obb) const; | ||
|
||
/** | ||
* \brief Compute coordinates of the 8 vertices of this OBB. | ||
* \return The vertices. | ||
*/ | ||
EigenSTL::vector_Vector3d computeVertices() const; | ||
|
||
protected: | ||
/** \brief PIMPL pointer */ | ||
std::unique_ptr<OBBPrivate> obb_; | ||
}; | ||
} // namespace bodies | ||
|
||
#endif // GEOMETRIC_SHAPES_OBB_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break ABI (the virtual keyword). Not sure what is the current policy regarding ABI breakages.