35 lines
999 B
C++
35 lines
999 B
C++
//
|
|
// Created by bastian on 26.03.22.
|
|
//
|
|
|
|
#ifndef BUILD_GENERATEXYPOSE_H
|
|
#define BUILD_GENERATEXYPOSE_H
|
|
|
|
#include <behaviortree_cpp_v3/action_node.h>
|
|
#include "../Area.h"
|
|
#include <random>
|
|
#include <geometry_msgs/msg/pose.hpp>
|
|
|
|
namespace BT {
|
|
|
|
// This class cannot guarantee valid results with every polygon, triangles are assumed to be a valid triangle-strip.
|
|
class GenerateXYPose : public SyncActionNode {
|
|
|
|
private:
|
|
double getArea(const std::shared_ptr<Area> &area, unsigned long id);
|
|
Position2D getRandomPosInTriangle(const std::shared_ptr<Area> &area, unsigned long id);
|
|
std::default_random_engine re = std::default_random_engine(random());
|
|
std::uniform_real_distribution<double> dist = std::uniform_real_distribution<double>(0.0, 1.0);
|
|
|
|
|
|
public:
|
|
GenerateXYPose(const std::string &name, const NodeConfiguration &config);
|
|
|
|
static PortsList providedPorts();
|
|
|
|
NodeStatus tick() override;
|
|
};
|
|
}
|
|
|
|
#endif //BUILD_GENERATEXYPOSE_H
|