47 #ifndef FASTRACK_ENVIRONMENT_ENVIRONMENT_H 48 #define FASTRACK_ENVIRONMENT_ENVIRONMENT_H 57 #include <std_msgs/Empty.h> 58 #include <visualization_msgs/Marker.h> 61 namespace environment {
65 using bound::Cylinder;
66 using bound::TrackingBound;
68 template <
typename M,
typename P>
79 const Vector3d& position,
const TrackingBound& bound,
80 double time = std::numeric_limits<double>::quiet_NaN())
const = 0;
83 bool AreValid(
const std::vector<Vector3d>& positions,
84 const TrackingBound& bound,
85 double time = std::numeric_limits<double>::quiet_NaN())
const {
87 for (
const auto& p : positions) {
88 if (!
IsValid(p, bound, time))
return false;
139 template <
typename M,
typename P>
141 name_ = ros::names::append(n.getNamespace(),
"Environment");
144 ROS_ERROR(
"%s: Failed to load parameters.",
name_.c_str());
149 ROS_ERROR(
"%s: Failed to register callbacks.",
name_.c_str());
162 template <
typename M,
typename P>
164 ros::NodeHandle nl(n);
167 if (!nl.getParam(
"topic/sensor_sub",
sensor_topic_))
return false;
168 if (!nl.getParam(
"topic/updated_env",
updated_topic_))
return false;
169 if (!nl.getParam(
"vis/env",
vis_topic_))
return false;
172 if (!nl.getParam(
"frame/fixed",
fixed_frame_))
return false;
175 if (!nl.getParam(
"env/upper/x",
upper_(0)))
return false;
176 if (!nl.getParam(
"env/upper/y",
upper_(1)))
return false;
177 if (!nl.getParam(
"env/upper/z",
upper_(2)))
return false;
179 if (!nl.getParam(
"env/lower/x",
lower_(0)))
return false;
180 if (!nl.getParam(
"env/lower/y",
lower_(1)))
return false;
181 if (!nl.getParam(
"env/lower/z",
lower_(2)))
return false;
187 template <
typename M,
typename P>
189 ros::NodeHandle nl(n);
197 nl.advertise<visualization_msgs::Marker>(
vis_topic_.c_str(), 1,
false);
bool Initialize(const ros::NodeHandle &n)
ros::Subscriber sensor_sub_
ros::Publisher updated_pub_
virtual bool LoadParameters(const ros::NodeHandle &n)
virtual void SensorCallback(const typename M::ConstPtr &msg)=0
virtual M SimulateSensor(const P ¶ms) const =0
virtual void Visualize() const =0
std::string sensor_topic_
virtual bool IsValid(const Vector3d &position, const TrackingBound &bound, double time=std::numeric_limits< double >::quiet_NaN()) const =0
virtual bool RegisterCallbacks(const ros::NodeHandle &n)
bool AreValid(const std::vector< Vector3d > &positions, const TrackingBound &bound, double time=std::numeric_limits< double >::quiet_NaN()) const
std::string updated_topic_