29#ifndef CPPSRC_CORE_INCLUDE_COVERAGECONTROL_ALGORITHMS_CENTRALIZED_CVT_H_
30#define CPPSRC_CORE_INCLUDE_COVERAGECONTROL_ALGORITHMS_CENTRALIZED_CVT_H_
59 size_t num_robots_ = 0;
64 std::vector<double> voronoi_mass_;
66 bool is_converged_ =
false;
73 : params_{params}, num_robots_{num_robots}, env_{env} {
75 actions_.resize(num_robots_);
76 goals_ = robot_global_positions_;
77 voronoi_mass_.resize(num_robots_, 0);
95 for (
size_t iRobot = 0; iRobot < num_robots_; ++iRobot) {
96 goals_[iRobot] = voronoi_cells[iRobot].centroid();
97 voronoi_mass_[iRobot] = voronoi_cells[iRobot].mass();
104 is_converged_ =
true;
108 for (
size_t iRobot = 0; iRobot < num_robots_; ++iRobot) {
109 actions_[iRobot] =
Point2(0, 0);
110 Point2 diff = goals_[iRobot] - robot_global_positions_[iRobot];
111 double dist = diff.norm();
125 direction.normalize();
126 actions_[iRobot] = speed * direction;
127 is_converged_ =
false;
Contains the abstract class for coverage control algorithms.
CentralizedCVT(Parameters const ¶ms, CoverageSystem &env)
CentralizedCVT(Parameters const ¶ms, size_t const &num_robots, 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.
const MapType & GetSystemExploredIDFMap() const
bool CheckOscillation(size_t const robot_id) const
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.