8 this->pillars = std::make_unique<std::vector<Pillar>>(
pillars);
17 this->pillars = std::make_unique<std::vector<Pillar>>(
pillars);
25 this->
pillars = std::make_unique<std::vector<Pillar>>();
40 for (uint32_t i = 1; i < nodes.size(); i++) {
42 if (nodes[i]->getData().distanceTo(pillar.getPose()) < pillar.getRadius() +
BOT_RADIUS) {
50 double magnitude = pillar.getRadius() +
BOT_RADIUS;
51 for (
double i = 1.0; i < 5.0; i += 0.75) {
52 for (uint16_t angle = 0; angle < 361; angle += 25) {
53 const double radian = angle * M_PI / 180.0;
56 attemptAdd.
plus(pillar.getPose());
67 this->
pillars->push_back(pillar);
78 for (uint16_t nodeIndex = 0; nodeIndex < nodes.size(); nodeIndex++) {
79 for (uint16_t nodeIndexTwo = 0; nodeIndexTwo < nodes.size(); nodeIndexTwo++) {
80 if (nodeIndex != nodeIndexTwo) {
81 Pose2D positionOne = nodes[nodeIndex]->getData();
82 Pose2D positionTwo = nodes[nodeIndexTwo]->getData();
83 double length = positionOne.
distanceTo(positionTwo);
84 double dy = (positionTwo.
getY() - positionOne.
getY());
85 double dx = (positionTwo.
getX() - positionTwo.
getY());
86 bool gotThrough =
true;
88 for (uint8_t pillarIndex = 0; pillarIndex <
pillars->size(); pillarIndex++) {
111 std::vector<Pose2D> toReturn;
112 for (uint16_t i = 0; i < path.size(); i++) {
113 toReturn.push_back(path[i]->getData());
123 if (i.getPose().distanceTo(location) < i.getRadius() +
BOT_RADIUS) {
162 for (uint32_t i = 0; i < this->
pillars->size(); i++) {
163 if (this->
pillars->at(i).getPose().distanceTo(newPillar.
getPose()) < newPillar.
getRadius() + this->pillars->at(i).getRadius()) {
175 this->
pillars->push_back(newPillar);
180 Pose2D position(updatedPosition);
192 std::vector<Pillar> copy;
193 for (
const auto & i : *
pillars) {
204 switch (cardinality) {
230 for (uint16_t i = 0; i < this->
pillars->size(); i++) {
242 double t = ((cx - x1) * dx + (cy - y1) * dy) / (dx * dx + dy * dy);
245 double closestX = x1 + t * dx;
246 double closestY = y1 + t * dy;
249 double distX = closestX - cx;
250 double distY = closestY - cy;
251 double distanceToLine = std::sqrt(distX * distX + distY * distY);
254 return distanceToLine <= r;
std::unique_ptr< std::vector< Pillar > > pillars
int32_t getDesiredIndex() const
void updateBotPose(const Pose2D &updatedPosition)
std::vector< Pillar > getCopyPillars()
std::unique_ptr< std::vector< Pillar > > getPillars()
bool validLocationForNode(const Pose2D &location)
std::vector< Pillar > newPillars
Pose2D getDesiredDestination()
static bool lineIntersectsCircle(double cx, double cy, double r, double x1, double y1, double x2, double y2)
HoleManager & getManager()
void addPillar(Pillar &newPillar)
void setPillars(std::unique_ptr< std::vector< Pillar > > pillars)
void updateDesired(const Pose2D &other)
std::vector< Pose2D > makePath()
void addEdgeMeasurement(double rawPosition, Cardinality cardinality)
void setDesiredIndex(int32_t index)
static bool outOfBounds(const Pose2D &location)
static double roundRadius(double radius)
Graph< Pose2D > & getGraph()
void applyOffsetToEdge(double x, double y)
Pose2D desiredDestination
void removeNode(size_t index)
void addConnection(Node< V > *one, Node< V > *two, double weight)
void addNode(Node< V > *newNode)
std::vector< Node< V > * > Dijkstra(Node< V > *from, Node< V > *find)
std::vector< Node< V > * > getNodes()
void offsetAll(const Pose2D &offset) const
bool lineIntersectsAnyHoleMeasurement(const Pose2D &positionOne, const Pose2D &positionTwo)
bool nodeCollides(Pose2D position)
void setPosition(const Pose2D &newPosition)
void setRadius(double newRadius)
static Pose2D fromPolar(double magnitude, double angle)
void plus(const Pose2D &other)
double distanceTo(const Pose2D &other) const