39 #include <geometric_shapes/check_isometry.h>
40 #include <geometric_shapes/shape_operations.h>
49 , link_index_(link_index)
50 , parent_joint_model_(nullptr)
51 , parent_link_model_(nullptr)
52 , is_parent_joint_fixed_(false)
53 , joint_origin_transform_is_identity_(true)
54 , first_collision_body_transform_index_(-1)
56 joint_origin_transform_.setIdentity();
63 ASSERT_ISOMETRY(transform)
64 joint_origin_transform_ = transform;
65 joint_origin_transform_is_identity_ =
66 joint_origin_transform_.linear().isIdentity() &&
67 joint_origin_transform_.translation().norm() < std::numeric_limits<double>::epsilon();
72 parent_joint_model_ = joint;
79 collision_origin_transform_ = origins;
80 collision_origin_transform_is_identity_.resize(collision_origin_transform_.size());
84 for (std::size_t i = 0; i < shapes_.size(); ++i)
86 ASSERT_ISOMETRY(collision_origin_transform_[i])
87 collision_origin_transform_is_identity_[i] =
88 (collision_origin_transform_[i].linear().isIdentity() &&
89 collision_origin_transform_[i].translation().norm() < std::numeric_limits<double>::epsilon()) ?
92 Eigen::Isometry3d transform = collision_origin_transform_[i];
94 if (shapes_[i]->
type != shapes::MESH)
96 Eigen::Vector3d extents = shapes::computeShapeExtents(shapes_[i].get());
103 const shapes::Mesh* mesh =
dynamic_cast<const shapes::Mesh*
>(shapes_[i].get());
104 for (
unsigned int j = 0; j < mesh->vertex_count; ++j)
106 aabb.extend(transform * Eigen::Map<Eigen::Vector3d>(&mesh->vertices[3 * j]));
111 centered_bounding_box_offset_ = aabb.center();
113 shape_extents_.setZero();
115 shape_extents_ = aabb.sizes();
121 visual_mesh_filename_ = visual_mesh;
122 visual_mesh_origin_ = origin;
123 visual_mesh_scale_ = scale;
Represents an axis-aligned bounding box.
void extendWithTransformedBox(const Eigen::Isometry3d &transform, const Eigen::Vector3d &box)
Extend with a box transformed by the given transform.
A joint from the robot. Models the transform that this joint applies in the kinematic chain....
JointType getType() const
Get the type of joint.
void setGeometry(const std::vector< shapes::ShapeConstPtr > &shapes, const EigenSTL::vector_Isometry3d &origins)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW LinkModel(const std::string &name, size_t link_index)
Construct a link model named name.
void setParentJointModel(const JointModel *joint)
void setVisualMesh(const std::string &visual_mesh, const Eigen::Isometry3d &origin, const Eigen::Vector3d &scale)
void setJointOriginTransform(const Eigen::Isometry3d &transform)
Vec3fX< details::Vec3Data< double > > Vector3d
Main namespace for MoveIt.