43 #ifndef FASTRACK_BOUND_SPHERE_H 44 #define FASTRACK_BOUND_SPHERE_H 49 #include <fastrack_srvs/TrackingBoundSphere.h> 50 #include <fastrack_srvs/TrackingBoundSphereResponse.h> 62 if (params.size() != 1) {
63 ROS_ERROR(
"Sphere: params were incorrect size.");
72 void FromRos(
const fastrack_srvs::TrackingBoundSphere::Response& res) {
77 fastrack_srvs::TrackingBoundSphere::Response
ToRos()
const {
78 fastrack_srvs::TrackingBoundSphere::Response res;
87 double radius)
const {
88 return (p - center).squaredNorm() <= (radius +
r) * (radius + r);
92 const Vector3d& upper)
const {
93 const Vector3d closest_point(std::min(upper(0), std::max(lower(0), p(0))),
94 std::min(upper(1), std::max(lower(1), p(1))),
95 std::min(upper(2), std::max(lower(2), p(2))));
96 return (closest_point - p).squaredNorm() <= r *
r;
102 const Vector3d& upper)
const {
103 return p(0) >= lower(0) + r && p(0) <= upper(0) - r &&
104 p(1) >= lower(1) + r && p(1) <= upper(1) - r &&
105 p(2) >= lower(2) + r && p(2) <= upper(2) -
r;
109 void Visualize(
const ros::Publisher& pub,
const std::string& frame)
const {
110 visualization_msgs::Marker m;
112 m.header.frame_id = frame;
113 m.header.stamp = ros::Time::now();
115 m.type = visualization_msgs::Marker::SPHERE;
116 m.action = visualization_msgs::Marker::ADD;
bool ContainedWithinBox(const Vector3d &p, const Vector3d &lower, const Vector3d &upper) const
void FromRos(const fastrack_srvs::TrackingBoundSphere::Response &res)
bool OverlapsBox(const Vector3d &p, const Vector3d &lower, const Vector3d &upper) const
void Visualize(const ros::Publisher &pub, const std::string &frame) const
bool Initialize(const std::vector< double > ¶ms)
fastrack_srvs::TrackingBoundSphere::Response ToRos() const
bool OverlapsSphere(const Vector3d &p, const Vector3d ¢er, double radius) const