ethz-asl / polygon_coverage_planning

Coverage planning in general polygons with holes.
GNU General Public License v3.0
529 stars 155 forks source link

Point Angle #51

Closed ehvenimunis closed 3 years ago

ehvenimunis commented 3 years ago

Hello,

When I get to one point, I want it to look at the other point. Is there anything in your work made for this?

Thanks, Salih.

rikba commented 3 years ago

Hi Salih,

Are you asking if the package computes the heading of the robot to point to the next waypoint?

This package only returns a vector of waypoints. But you can compute the direction of the connecting segment quite easily. Let's assume std::vector<Eigen::Vector3d> waypoints is the vector of waypoints.

for (size_t i = 0; i < waypoints.size() - 1; ++i) {
  const Eigen::Vector3d direction = waypoints[i + 1] - waypoints[i];
  const double heading = std::atan2(direction.y(), direction.x());
}

I hope that answers your question.

ehvenimunis commented 3 years ago

Yes, I asked if the package calculates the robot's direction to point to the next waypoint. I got the solution with a similar line of code.

Thanks @rikba