29#ifndef CPPSRC_CORE_INCLUDE_COVERAGECONTROL_ALGORITHMS_CLAIRVOYANT_CVT_H_
30#define CPPSRC_CORE_INCLUDE_COVERAGECONTROL_ALGORITHMS_CLAIRVOYANT_CVT_H_
58 size_t num_robots_ = 0;
63 std::vector<double> voronoi_mass_;
65 bool is_converged_ =
false;
72 : params_{params}, num_robots_{num_robots}, env_{env} {
74 actions_.resize(num_robots_);
75 goals_ = robot_global_positions_;
76 voronoi_mass_.resize(num_robots_, 0);
94 for (
size_t iRobot = 0; iRobot < num_robots_; ++iRobot) {
95 goals_[iRobot] = voronoi_cells[iRobot].centroid();
96 voronoi_mass_[iRobot] = voronoi_cells[iRobot].mass();
101 is_converged_ =
true;
105 for (
size_t iRobot = 0; iRobot < num_robots_; ++iRobot) {
106 actions_[iRobot] =
Point2(0, 0);
107 Point2 diff = goals_[iRobot] - robot_global_positions_[iRobot];
108 double dist = diff.norm();
122 direction.normalize();
123 actions_[iRobot] = speed * direction;
124 is_converged_ =
false;
Contains the abstract class for coverage control algorithms.
ClairvoyantCVT(Parameters const ¶ms, size_t const &num_robots, CoverageSystem &env)
ClairvoyantCVT(Parameters const ¶ms, CoverageSystem &env)
The CoverageSystem class is the main class for the coverage control library.
PointVector GetRobotPositions(bool force_no_noise=false)
Get the global positions of all robots.
bool CheckOscillation(size_t const robot_id) const
const MapType & GetWorldMap() const
Get the world map.
Class to store parameters.
double pTimeStep
Each time step corresponds to pTimeStep seconds.
Class for computing Voronoi cells.
auto GetVoronoiCells() const
The file contains the CoverageSystem class, which is the main class for the coverage control library.
std::vector< Point2 > PointVector
Namespace for the CoverageControl library.
Contains typedefs for the library.