14 double gaussian(
double x,
double y,
double x0,
double y0,
double A,
double varx,
double vary,
double skew)
16 double dx = x - x0, dy = y - y0;
17 double h =
sqrt(dx * dx + dy * dy);
19 double mx =
cos(angle - skew) * h;
20 double my =
sin(angle - skew) * h;
21 double f1 =
pow(mx, 2.0) / (2.0 * varx),
22 f2 =
pow(my, 2.0) / (2.0 * vary);
23 return A *
exp(-(f1 + f2));
28 return sqrt(-2 * var *
log(cutoff / A));
38 server_ =
new dynamic_reconfigure::Server<ProxemicLayerConfig>(nh);
45 std::list<people_msgs::Person>::iterator p_it;
49 people_msgs::Person person = *p_it;
51 double mag =
sqrt(
pow(person.velocity.x, 2) +
pow(person.velocity.y, 2));
52 double factor = 1.0 + mag *
factor_;
55 *min_x = std::min(*min_x, person.position.x - point);
56 *min_y = std::min(*min_y, person.position.y - point);
57 *max_x = std::max(*max_x, person.position.x + point);
58 *max_y = std::max(*max_y, person.position.y + point);
64 boost::recursive_mutex::scoped_lock lock(
lock_);
72 std::list<people_msgs::Person>::iterator p_it;
78 people_msgs::Person person = *p_it;
79 double angle =
atan2(person.velocity.y, person.velocity.x);
80 double mag =
sqrt(
pow(person.velocity.x, 2) +
pow(person.velocity.y, 2));
81 double factor = 1.0 + mag *
factor_;
85 unsigned int width = std::max(1, static_cast<int>((base + point) / res)),
86 height = std::max(1, static_cast<int>((base + point) / res));
88 double cx = person.position.x, cy = person.position.y;
94 oy = cy + (point - base) *
sin(angle) - base;
99 ox = cx + (point - base) *
cos(angle) - base;
105 int start_x = 0, start_y = 0, end_x = width, end_y = height;
109 end_x = std::max(0, static_cast<int>(costmap->
getSizeInCellsX()) - dx);
111 if (static_cast<int>(start_x + dx) < min_i)
112 start_x = min_i - dx;
113 if (static_cast<int>(end_x + dx) > max_i)
119 end_y = std::max(0, static_cast<int>(costmap->
getSizeInCellsY()) - dy);
121 if (static_cast<int>(start_y + dy) < min_j)
122 start_y = min_j - dy;
123 if (static_cast<int>(end_y + dy) > max_j)
126 double bx = ox + res / 2,
128 for (
int i = start_x; i < end_x; i++)
130 for (
int j = start_y; j < end_y; j++)
132 unsigned char old_cost = costmap->
getCost(i + dx, j + dy);
136 double x = bx + i * res,
y = by + j * res;
137 double ma =
atan2(y - cy, x - cx);
140 if (fabs(diff) < M_PI / 2)
147 unsigned char cvalue = (
unsigned char) a;
148 costmap->
setCost(i + dx, j + dy, std::max(cvalue, old_cost));
158 covar_ = config.covariance;
void setCost(unsigned int mx, unsigned int my, unsigned char cost)
LayeredCostmap * layered_costmap_
std::list< people_msgs::Person > transformed_people_
double get_radius(double cutoff, double A, double var)
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
people_msgs::People people_list_
virtual void updateCosts(costmap_2d::Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)
PLUGINLIB_EXPORT_CLASS(BAGReader, nodelet::Nodelet)
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
virtual void onInitialize()
TFSIMD_FORCE_INLINE const tfScalar & y() const
virtual void updateBoundsFromPeople(double *min_x, double *min_y, double *max_x, double *max_y)
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
unsigned char getCost(unsigned int mx, unsigned int my) const
void configure(ProxemicLayerConfig &config, uint32_t level)
dynamic_reconfigure::Server< ProxemicLayerConfig >::CallbackType f_
double gaussian(double x, double y, double x0, double y0, double A, double varx, double vary, double skew)
ros::Duration people_keep_time_
boost::recursive_mutex lock_
TFSIMD_FORCE_INLINE const tfScalar & x() const
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
unsigned int getSizeInCellsY() const
INLINE Rall1d< T, V, S > exp(const Rall1d< T, V, S > &arg)
void worldToMapNoBounds(double wx, double wy, int &mx, int &my) const
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
unsigned int getSizeInCellsX() const
static const unsigned char NO_INFORMATION
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
double getResolution() const
virtual void onInitialize()
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
def shortest_angular_distance(from_angle, to_angle)
dynamic_reconfigure::Server< ProxemicLayerConfig > * server_