def go_to_with_planner(self, x, y, t):
start = self.position()[:-1]
end = np.array([x, y])
points = self.planner.get_points(start=start, end=end, robot=self)
def add_t(points, t):
points = np.array(points)
lens = np.hypot(points[:, 0], points[:, 1])
tpm = t / np.add.reduce(lens)
npoints = np.zeros(shape=(points.shape[0], 3))
npoints[:, :-1] = points
npoints[:, -1] = tpm * lens
return npoints
npoints = add_t(points, t)
if not points:
logging.warning("no available path. start=%r, end=%r", start, end)
else:
self.follow(points, t)
评论列表
文章目录