33#ifndef CPPSRC_CORE_INCLUDE_COVERAGECONTROL_ALGORITHMS_NEAR_OPTIMAL_CVT_H_
34#define CPPSRC_CORE_INCLUDE_COVERAGECONTROL_ALGORITHMS_NEAR_OPTIMAL_CVT_H_
49#include "CoverageControl/extern/lsap/Hungarian.h"
70 size_t num_robots_ = 0;
76 bool is_converged_ =
false;
83 : params_{params}, num_robots_{num_robots}, env_{env} {
85 actions_.resize(num_robots_);
86 goals_ = robot_global_positions_;
92 auto GetGoals() {
return goals_; }
94 auto &GetVoronoi() {
return voronoi_; }
97 goals_ = NearOptimalCVTAlgorithm(
98 params_.pLloydNumTries, params_.pLloydMaxIterations, num_robots_,
100 robot_global_positions_, voronoi_);
104 is_converged_ =
true;
106 for (
size_t iRobot = 0; iRobot < num_robots_; ++iRobot) {
107 actions_[iRobot] =
Point2(0, 0);
108 Point2 diff = goals_[iRobot] - robot_global_positions_[iRobot];
109 double dist = diff.norm();
114 speed = std::min(params_.pMaxRobotSpeed, speed);
116 direction.normalize();
117 actions_[iRobot] = speed * direction;
118 is_converged_ =
false;
123 bool IsConverged() {
return is_converged_; }
Contains the abstract class for coverage control algorithms.
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 & GetWorldMap() const
Get the world map.
Class to store parameters.
double pTimeStep
Each time step corresponds to pTimeStep seconds.
Class for computing Voronoi cells.
The file contains the CoverageSystem class, which is the main class for the coverage control library.
std::vector< Point2 > PointVector
Utility functions for transforming maps.
Namespace for the CoverageControl library.
Near Optimal Centroidal Voronoi Tessellation (CVT) algorithm Near-optimal Centroidal Voronoi Tessella...
Contains typedefs for the library.