Struct jalansim::map::Map

template <typename T>

ClassList > jalansim > map > Map

2D occupancy grid map with distance field. More...

  • #include <map.hpp>

Public Attributes

Type Name
MapCell< T > * cells
Array of map cells (row-major order)
uint8_t cells_managed
Memory management flag (0=malloc, 1=CUDA managed)
T max_dist
Maximum distance value in the distance field.
T origin_x
T origin_y
World coordinates of grid origin (cell 0,0)
T scale
Size of each grid cell in world units.
int size_x
int size_y
Map dimensions in cells.

Public Functions

Type Name
Map< T > * clone () const
Create a deep copy of this map.
JALANSIM_HOST_DEVICE size_t index (int i, int j) const
Convert grid coordinates to linear array index.
JALANSIM_HOST_DEVICE T interpolate_dist (T i, T j) const
Interpolate distance value at continuous grid coordinates.
JALANSIM_HOST_DEVICE bool is_valid (int i, int j) const
Check if grid coordinates are within map bounds.
void resize (int sx, int sy)
Resize the map to new dimensions.
JALANSIM_HOST_DEVICE int to_i (T x) const
Convert world x-coordinate to nearest grid x-index.
JALANSIM_HOST_DEVICE T to_if (T x) const
Convert world x-coordinate to continuous grid x-index.
JALANSIM_HOST_DEVICE int to_j (T y) const
Convert world y-coordinate to nearest grid y-index.
JALANSIM_HOST_DEVICE T to_jf (T y) const
Convert world y-coordinate to continuous grid y-index.
JALANSIM_HOST_DEVICE T to_x (int i) const
Convert grid x-index to world x-coordinate.
JALANSIM_HOST_DEVICE T to_y (int j) const
Convert grid y-index to world y-coordinate.
void update_dist (T max_d)
Update the distance field using CPU or GPU algorithm.

Public Static Functions

Type Name
Map< T > * create ()
Create a new map instance with appropriate memory allocation.
void destroy (Map< T > * m)
Destroy a map instance and free its memory.

Detailed Description

Represents a 2D environment as a regular grid of cells, where each cell stores occupancy information and distance to nearest obstacle. Supports both CPU and GPU execution with efficient distance field computation using various algorithms (Jacobi iteration, jump flooding).

The map uses a coordinate system where (origin_x, origin_y) corresponds to grid cell (0, 0), and each cell represents a square region of size 'scale' in world units.

Template parameters:

  • T Numeric type for distance values and coordinates (float, double)

Public Attributes Documentation

variable cells

Array of map cells (row-major order)

MapCell<T>* jalansim::map::Map< T >::cells;

variable cells_managed

Memory management flag (0=malloc, 1=CUDA managed)

uint8_t jalansim::map::Map< T >::cells_managed;

variable max_dist

Maximum distance value in the distance field.

T jalansim::map::Map< T >::max_dist;

variable origin_x

T jalansim::map::Map< T >::origin_x;

variable origin_y

World coordinates of grid origin (cell 0,0)

T jalansim::map::Map< T >::origin_y;

variable scale

Size of each grid cell in world units.

T jalansim::map::Map< T >::scale;

variable size_x

int jalansim::map::Map< T >::size_x;

variable size_y

Map dimensions in cells.

int jalansim::map::Map< T >::size_y;

Public Functions Documentation

function clone

Create a deep copy of this map.

inline Map < T > * jalansim::map::Map::clone () const

Returns:

Pointer to cloned map with identical data


function index

Convert grid coordinates to linear array index.

inline JALANSIM_HOST_DEVICE size_t jalansim::map::Map::index (
    int i,
    int j
) const

Parameters:

  • i Grid x-coordinate
  • j Grid y-coordinate

Returns:

Linear index into cells array


function interpolate_dist

Interpolate distance value at continuous grid coordinates.

inline JALANSIM_HOST_DEVICE T jalansim::map::Map::interpolate_dist (
    T i,
    T j
) const

Parameters:

  • i Continuous grid coordinate in x-direction
  • j Continuous grid coordinate in y-direction

Returns:

Bilinearly interpolated distance value


function is_valid

Check if grid coordinates are within map bounds.

inline JALANSIM_HOST_DEVICE bool jalansim::map::Map::is_valid (
    int i,
    int j
) const

Parameters:

  • i Grid x-coordinate
  • j Grid y-coordinate

Returns:

True if coordinates are valid, false otherwise


function resize

Resize the map to new dimensions.

inline void jalansim::map::Map::resize (
    int sx,
    int sy
) 

Parameters:

  • sx New width in cells
  • sy New height in cells

function to_i

Convert world x-coordinate to nearest grid x-index.

inline JALANSIM_HOST_DEVICE int jalansim::map::Map::to_i (
    T x
) const

Parameters:

  • x World x-coordinate

Returns:

Nearest grid x-index


function to_if

Convert world x-coordinate to continuous grid x-index.

inline JALANSIM_HOST_DEVICE T jalansim::map::Map::to_if (
    T x
) const

Parameters:

  • x World x-coordinate

Returns:

Continuous grid x-index


function to_j

Convert world y-coordinate to nearest grid y-index.

inline JALANSIM_HOST_DEVICE int jalansim::map::Map::to_j (
    T y
) const

Parameters:

  • y World y-coordinate

Returns:

Nearest grid y-index


function to_jf

Convert world y-coordinate to continuous grid y-index.

inline JALANSIM_HOST_DEVICE T jalansim::map::Map::to_jf (
    T y
) const

Parameters:

  • y World y-coordinate

Returns:

Continuous grid y-index


function to_x

Convert grid x-index to world x-coordinate.

inline JALANSIM_HOST_DEVICE T jalansim::map::Map::to_x (
    int i
) const

Parameters:

  • i Grid x-index

Returns:

World x-coordinate


function to_y

Convert grid y-index to world y-coordinate.

inline JALANSIM_HOST_DEVICE T jalansim::map::Map::to_y (
    int j
) const

Parameters:

  • j Grid y-index

Returns:

World y-coordinate


function update_dist

Update the distance field using CPU or GPU algorithm.

inline void jalansim::map::Map::update_dist (
    T max_d
) 

Parameters:

  • max_d Maximum distance value to use for initialization

Public Static Functions Documentation

function create

Create a new map instance with appropriate memory allocation.

static inline Map < T > * jalansim::map::Map::create () 

Returns:

Pointer to newly created map (CUDA managed memory if available)


function destroy

Destroy a map instance and free its memory.

static inline void jalansim::map::Map::destroy (
    Map < T > * m
) 

Parameters:

  • m Pointer to map to destroy


The documentation for this class was generated from the following file include/jalansim/map/map.hpp