42 namespace planner_2dof_serial_joints
45 const Vecf& euclid_cost_coef,
50 : euclid_cost_coef_(euclid_cost_coef)
51 , resolution_(resolution)
56 for (
Vec p(-range, -range); p[0] <= range; p[0]++)
58 for (p[1] = -range; p[1] <= range; p[1]++)
68 for (
int i = 0; i < 2; i++)
75 const Vec& cur,
const Vec& next,
const std::vector<VecWithCost>& start,
const Vec& goal)
const 77 if ((
unsigned int)next[0] >= (
unsigned int)
resolution_ * 2 ||
78 (
unsigned int)next[1] >= (
unsigned int)
resolution_ * 2)
81 d.
cycle(resolution_, resolution_);
85 float distf = std::hypot(static_cast<float>(d[0]), static_cast<float>(d[1]));
88 const int dist = distf;
92 dp[0] =
static_cast<float>(d[0]) / dist;
93 dp[1] =
static_cast<float>(d[1]) / dist;
95 for (
int i = 0; i < dist; i++)
97 pos[0] = std::lround(v[0]);
98 pos[1] = std::lround(v[1]);
100 const auto c =
cm_[pos];
112 const Vec& cur,
const Vec& goal)
const 114 const Vec d = goal - cur;
119 const std::vector<VecWithCost>& ss,
void cycle(const int res, const ArgList &...rest)
GridAstarModel2DoFSerialJoint(const Vecf &euclid_cost_coef, const int resolution, BlockMemGridmapBase< char, 2, 0 > &cm, const CostCoeff &cc, const int range)
void cycleUnsigned(const int res, const ArgList &...rest)
float cost(const Vec &cur, const Vec &next, const std::vector< VecWithCost > &start, const Vec &goal) const override
BlockMemGridmapBase< char, 2, 0 > & cm_
const std::vector< Vec > & searchGrids(const Vec &p, const std::vector< VecWithCost > &ss, const Vec &es) const override
std::vector< Vec > search_list_
float costEstim(const Vec &cur, const Vec &goal) const override
float euclidCost(const Vec &v) const