|
bitsim
Model, simulate, estimate and control robots in C++
|
A rectangular slice of the plane with axis-aligned box obstacles, a start and a goal. More...
#include <box_world.h>
Classes | |
| struct | Box |
| An axis-aligned box [x0, x1] x [y0, y1] [m]. More... | |
| struct | RayHit |
| What a range beam found: whether it struck anything within reach, and how far away. More... | |
Public Types | |
| using | Point = std::array<real_t, 2> |
Public Member Functions | |
| BoxWorld (real_t width, real_t height, std::vector< Box > obstacles, real_t robot_radius, const Point &start, const Point &goal) | |
| real_t | width () const noexcept |
| real_t | height () const noexcept |
| real_t | robot_radius () const noexcept |
| const std::vector< Box > & | obstacles () const noexcept |
| const Point & | start () const noexcept |
| const Point & | goal () const noexcept |
| bool | is_free (const Point &p) const |
| True if a disc of the given radius centred at p touches no obstacle and no outer wall. The default radius is the robot's. | |
| bool | is_free (const Point &p, real_t radius) const |
| OccupancyGrid | occupancy_grid (real_t cell_size) const |
| The world as an OccupancyGrid of square cells, with the obstacles and the outer walls grown by margin so a point planner stays clear of them. The default margin is the robot's radius; a margin of zero gives the obstacles themselves. | |
| OccupancyGrid | occupancy_grid (real_t cell_size, real_t margin) const |
| RayHit | ray_cast (const Point &origin, real_t angle, real_t max_range) const |
| Cast a ray from origin in the direction angle (radians, measured from the x axis) and return the distance to the nearest obstacle or outer wall, capped at max_range. This is the ground truth a range sensor measures; add noise for a realistic scan. | |
Static Public Member Functions | |
| static BoxWorld | warehouse () |
| The warehouse of the grid_planning and rrt examples: 8 x 5 m, a 0.25 m robot, five shelves and a wall with a door, from (0.5, 0.5) to (7.5, 4.5). | |
A rectangular slice of the plane with axis-aligned box obstacles, a start and a goal.
The world is the rectangle [0, width] x [0, height]. Its obstacles are axis-aligned boxes, such as the shelves and the wall of a warehouse. A disc robot of radius robot_radius is planned as a point by keeping its centre at least that far from every obstacle and from the outer walls.
The same world drives a grid planner and a sampling planner, so the two share one map: occupancy_grid() cuts it into cells with the obstacles grown by the robot's radius, and is_free() tests a single point for a planner that samples the free space, such as RRT.
| using bitsim::planning::BoxWorld::Point = std::array<real_t, 2> |
| bitsim::planning::BoxWorld::BoxWorld | ( | real_t | width, |
| real_t | height, | ||
| std::vector< Box > | obstacles, | ||
| real_t | robot_radius, | ||
| const Point & | start, | ||
| const Point & | goal ) |
| width | The width of the world, along x [m] |
| height | The height, along y [m] |
| obstacles | The box obstacles [m] |
| robot_radius | The radius of the disc robot [m] |
| start | Where the robot starts [m] |
| goal | Where it has to go [m] |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
True if a disc of the given radius centred at p touches no obstacle and no outer wall. The default radius is the robot's.
|
inlinenoexcept |
|
inline |
The world as an OccupancyGrid of square cells, with the obstacles and the outer walls grown by margin so a point planner stays clear of them. The default margin is the robot's radius; a margin of zero gives the obstacles themselves.
| OccupancyGrid bitsim::planning::BoxWorld::occupancy_grid | ( | real_t | cell_size, |
| real_t | margin ) const |
| BoxWorld::RayHit bitsim::planning::BoxWorld::ray_cast | ( | const Point & | origin, |
| real_t | angle, | ||
| real_t | max_range ) const |
Cast a ray from origin in the direction angle (radians, measured from the x axis) and return the distance to the nearest obstacle or outer wall, capped at max_range. This is the ground truth a range sensor measures; add noise for a realistic scan.
|
inlinenoexcept |
|
inlinenoexcept |
|
static |
The warehouse of the grid_planning and rrt examples: 8 x 5 m, a 0.25 m robot, five shelves and a wall with a door, from (0.5, 0.5) to (7.5, 4.5).
|
inlinenoexcept |