30 #ifndef VIGIR_FOOTSTEP_PLANNING_LIB_MATH_H__ 31 #define VIGIR_FOOTSTEP_PLANNING_LIB_MATH_H__ 41 #include <vigir_footstep_planning_msgs/footstep_planning_msgs.h> 47 static const double TWO_PI = 2 * M_PI;
64 return (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2);
71 return (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2);
77 return (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2) + (z1 - z2)*(z1 - z2);
84 return (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2) + (z1 - z2)*(z1 - z2);
111 inline double parabol(
double x,
double y,
double a_inv,
double b_inv)
113 return x*x*a_inv + y*y*b_inv;
117 inline double grid_cost(
int x1,
int y1,
int x2,
int y2,
float cell_size)
119 int x = abs(x1 - x2);
120 int y = abs(y1 - y2);
123 return M_SQRT2 * cell_size;
129 inline double pround(
double x,
double prec)
131 return ::round(x/prec)*prec;
134 inline double pceil(
double x,
double prec)
136 return ::ceil(x/prec)*prec;
139 inline double pfloor(
double x,
double prec)
141 return ::floor(x/prec)*prec;
147 inline int disc_val(
double length,
double cell_size)
150 return static_cast<int>(round(length / cell_size));
159 inline double cont_val(
int length,
double cell_size)
162 return static_cast<double>(length) * cell_size;
173 return disc_val(angle, angle_bin_size);
183 return cont_val(angle, angle_bin_size);
229 inline unsigned int calc_hash_tag(
int x,
int y,
int theta,
int leg,
unsigned int hash_pred,
unsigned int hash_succ,
int max_hash_size)
247 void getDeltaStep(
const msgs::Foot& current,
const msgs::Foot& next, geometry_msgs::Pose& dstep);
250 void quaternionToNormalYaw(
const geometry_msgs::Quaternion& q, geometry_msgs::Vector3& n,
double& yaw);
251 void quaternionToNormal(
const geometry_msgs::Quaternion& q, geometry_msgs::Vector3& n);
252 void normalToQuaternion(
const geometry_msgs::Vector3& n,
double yaw, geometry_msgs::Quaternion& q);
254 void RPYToNormal(
double r,
double p,
double y, geometry_msgs::Vector3& n);
255 void normalToRP(
const geometry_msgs::Vector3& n,
double yaw,
double& r,
double& p);
TFSIMD_FORCE_INLINE const tfScalar & y() const
TFSIMD_FORCE_INLINE const tfScalar & x() const