3 #ifndef SE2EZ_CORE_CSPACE_ 4 #define SE2EZ_CORE_CSPACE_ 6 #include <ompl/util/PPM.h> 11 #include <condition_variable> 84 CSpaceGrid(
const RobotPtr &robot,
unsigned int jointA,
unsigned int jointB,
85 unsigned int width = 500,
unsigned int height = 500,
Mode mode = COLLISION);
96 unsigned int width = 500,
unsigned int height = 500,
Mode mode = COLLISION);
107 void compute(
bool block =
true,
const StatePtr &base =
nullptr,
const GridCallback &callback = {});
111 void waitToComplete();
115 bool isComputing()
const;
125 ompl::PPM::Color &getPixel(
const StatePtr &state);
132 ompl::PPM::Color &getPixel(
double i,
double j);
152 RobotCoords getCoords(
unsigned int i,
unsigned int j);
172 double distanceToSlice(
const StatePtr &state);
177 double progress()
const;
182 unsigned int getWidth()
const;
187 unsigned int getHeight()
const;
196 void emplaceChunks();
202 Eigen::Vector4d getFrameColor(
const std::string &frame)
const;
205 const unsigned int xChunk_{25};
206 const unsigned int yChunk_{25};
207 const double minDepth_{-1.};
208 const double maxDepth_{1.};
237 Chunk(
unsigned int x,
unsigned int y,
unsigned int w,
unsigned int h) : x(x), y(y), w(w), h(h)
247 unsigned int maxChunks_{0};
unsigned int y
y coordinate.
Container class for image chunk information to worker threads.
const unsigned int indexB_
Joint index for Y-axis.
A shared pointer wrapper for se2ez::State.
Coordinates for the robot.
unsigned int x
x coordinate.
Chunk(unsigned int x, unsigned int y, unsigned int w, unsigned int h)
Constructor.
std::vector< bool > newState_
Has each thread updated to new base state for computation?
Mode
Drawing mode for the grid.
const unsigned int width_
Width of image.
std::vector< bool > working_
Which threads are currently working?
std::condition_variable work_
Condition variable that there is work to do.
std::mutex statelock_
Mutex for state.
const RobotPtr robot_
Robot to use.
std::condition_variable complete_
Condition variable to notify when complete.
static const unsigned int cores_
Number of cores on the machine.
const unsigned int height_
Height of image.
std::queue< Chunk > chunks_
Queue of chunks.
unsigned int y
Starting y coordinate of chunk.
Use viridis color palette for signed distance.
Draw collisions as black pixels.
A shared pointer wrapper for se2ez::Robot.
const Eigen::Vector2d limitB_
Joint limits for second joint (1-DoF)
const Mode mode_
Render mode.
unsigned int w
Width of chunk.
Signed distance, but penetrations are colored by geometry.
Color obstacles by geometry color.
const bool contB_
Is joint B continuous?
const unsigned int indexA_
Joint index for X-axis.
std::vector< std::thread * > threads_
Threads.
unsigned int x
Starting x coordinate of chunk.
unsigned int h
Height of chunk.
const Eigen::Vector2d limitA_
Joint limits for first joint (1-DoF)
#define SE2EZ_CLASS_FORWARD(C)
const bool contA_
Is joint A continuous?
Helper class to compute and draw C-Space images from arbitrary robots.