36 #include <rclcpp/logger.hpp>
37 #include <rclcpp/logging.hpp>
39 const rclcpp::Logger
BULLET_LOGGER = rclcpp::get_logger(
"collision_detection.bullet");
48 active_links.push_back(urdf_link->name);
49 for (
const auto& child_link : urdf_link->child_links)
56 for (std::size_t i = 0; i < urdf_link->child_links.size(); ++i)
58 const urdf::LinkConstSharedPtr child_link = urdf_link->child_links[i];
59 if ((child_link->parent_joint) && (child_link->parent_joint->type !=
urdf::Joint::FIXED))
69 shapes::Shape* result =
nullptr;
72 case urdf::Geometry::SPHERE:
73 result =
new shapes::Sphere(
static_cast<const urdf::Sphere*
>(geom)->radius);
75 case urdf::Geometry::BOX:
77 urdf::Vector3 dim =
static_cast<const urdf::Box*
>(geom)->dim;
78 result =
new shapes::Box(dim.x, dim.y, dim.z);
81 case urdf::Geometry::CYLINDER:
82 result =
new shapes::Cylinder(
static_cast<const urdf::Cylinder*
>(geom)->radius,
83 static_cast<const urdf::Cylinder*
>(geom)->length);
85 case urdf::Geometry::MESH:
87 const urdf::Mesh* mesh =
static_cast<const urdf::Mesh*
>(geom);
88 if (!mesh->filename.empty())
91 shapes::Mesh* m = shapes::createMeshFromResource(mesh->filename, scale);
97 RCLCPP_ERROR(
BULLET_LOGGER,
"Unknown geometry type: %d",
static_cast<int>(geom->type));
101 return shapes::ShapePtr(result);
106 Eigen::Quaterniond q(pose.rotation.w, pose.rotation.x, pose.rotation.y, pose.rotation.z);
107 Eigen::Isometry3d result;
108 result.translation() =
Eigen::Vector3d(pose.position.x, pose.position.y, pose.position.z);
109 result.linear() = q.toRotationMatrix();
Eigen::Isometry3d urdfPose2Eigen(const urdf::Pose &pose)
void getActiveLinkNamesRecursive(std::vector< std::string > &active_links, const urdf::LinkConstSharedPtr &urdf_link, bool active)
Recursively traverses robot from root to get all active links.
shapes::ShapePtr constructShape(const urdf::Geometry *geom)
Vec3fX< details::Vec3Data< double > > Vector3d
const rclcpp::Logger BULLET_LOGGER