36 #define BOOST_PARAMETER_MAX_ARITY 7 44 DiagnosticNodelet::onInit();
65 if (
nh_->getParam(
"robot_description", content)) {
71 std::string root_link_id;
72 std::string world_frame_id;
73 pnh_->param<std::string>(
"root_link_id", root_link_id,
"BODY");
74 pnh_->param<std::string>(
"world_frame_id", world_frame_id,
"map");
76 double default_padding, default_scale;
77 pnh_->param(
"self_see_default_padding", default_padding, 0.01);
78 pnh_->param(
"self_see_default_scale", default_scale, 1.0);
79 std::vector<robot_self_filter::LinkInfo>
links;
82 if (!
pnh_->hasParam(
"self_see_links")) {
86 pnh_->getParam(
"self_see_links", ssl_vals);
90 if (ssl_vals.
size() == 0) {
93 for (
int i = 0; i < ssl_vals.
size(); i++) {
94 robot_self_filter::LinkInfo li;
96 NODELET_WARN(
"Self see links entry %d is not a structure. Stopping processing of self see links",i);
99 if (!ssl_vals[i].hasMember(
"name")) {
100 NODELET_WARN(
"Self see links entry %d has no name. Stopping processing of self see links",i);
103 li.name = std::string(ssl_vals[i][
"name"]);
104 if (!ssl_vals[i].hasMember(
"padding")) {
105 NODELET_DEBUG(
"Self see links entry %d has no padding. Assuming default padding of %g",i,default_padding);
106 li.padding = default_padding;
108 li.padding = ssl_vals[i][
"padding"];
110 if (!ssl_vals[i].hasMember(
"scale")) {
111 NODELET_DEBUG(
"Self see links entry %d has no scale. Assuming default scale of %g",i,default_scale);
112 li.scale = default_scale;
114 li.scale = ssl_vals[i][
"scale"];
135 jsk_recognition_msgs::CheckCollision::Response &
res)
137 sensor_msgs::JointState joint = req.joint;
138 geometry_msgs::PoseStamped
pose = req.pose;
144 const geometry_msgs::PoseStamped& pose)
154 NODELET_ERROR_STREAM(
"Transform error of sensor data: " << ex.what() <<
", quitting callback");
159 Eigen::Matrix4f sensor_to_world;
161 pcl::transformPointCloud(
cloud_,
cloud_, sensor_to_world);
163 self_mask_->assumeFrameFromJointAngle(joint, pose);
166 bool contain_flag =
false;
168 for (
size_t i = 0; i <
cloud_.size(); i++) {
170 if (finite(p.x) && finite(p.y) && finite(p.z) &&
171 self_mask_->getMaskContainment(p.x, p.y, p.z) == robot_self_filter::INSIDE) {
std::string world_frame_id_
#define NODELET_ERROR(...)
#define NODELET_WARN(...)
URDF_EXPORT bool initString(const std::string &xmlstring)
ros::ServiceServer service_
void transformAsMatrix(const tf::Transform &bt, Eigen::Matrix4f &out_mat)
pcl::PointCloud< pcl::PointXYZ > cloud_
void fromROSMsg(const sensor_msgs::PointCloud2 &cloud, pcl::PointCloud< T > &pcl_cloud)
PLUGINLIB_EXPORT_CLASS(jsk_pcl_ros::CollisionDetector, nodelet::Nodelet)
Type const & getType() const
tf::TransformBroadcaster tf_broadcaster_
#define NODELET_ERROR_STREAM(...)
tf::TransformListener tf_listener_
virtual void unsubscribe()
virtual void initSelfMask()
boost::shared_ptr< robot_self_filter::SelfMaskUrdfRobot > self_mask_
#define NODELET_INFO(...)
std::string cloud_frame_id_
virtual bool checkCollision(const sensor_msgs::JointState &joint, const geometry_msgs::PoseStamped &pose)
virtual void pointcloudCallback(const sensor_msgs::PointCloud2::ConstPtr &msg)
#define NODELET_DEBUG(...)
virtual bool serviceCallback(jsk_recognition_msgs::CheckCollision::Request &req, jsk_recognition_msgs::CheckCollision::Response &res)