Perception Tool Kit (PTK) API Guide

Introduction

Collaboration diagram for PTK Map:

Data Structures

struct  PTK_GridInfo
 Grid information. More...
 
struct  PTK_MapConfig
 Map configuration. More...
 
struct  PTK_Map
 Map definition. More...
 

Functions

uint32_t PTK_Map_getSize (const PTK_MapConfig *config)
 Compute how much memory is required to store the complete PTK_Map described by the given configuration. More...
 
PTK_MapPTK_Map_init (uint8_t *mem, const PTK_MapConfig *config)
 Initialize an externally allocated piece of memory to be a valid PTK_Map. This also initializes all member PTK_Grids, so no further initialization is required. More...
 
void PTK_Map_clear (PTK_Map *map)
 This clears all PTK_Grids internal to the map. It has the same result as if PTK_Grid clear were called on each individually. More...
 
uint32_t PTK_Map_copy (PTK_Map *__restrict dst, const PTK_Map *__restrict src)
 Copy all constituent PTK_Grids from the given source PTK_Map to the destination PTK_Map. They must have the same PTK_MapConfig or an assertion failure is generated. More...
 
uint32_t PTK_Map_has (const PTK_Map *map, uint32_t id)
 Test if a PTK_Map contains a PTK_Grid with the specified id. More...
 
PTK_GridPTK_Map_get (const PTK_Map *map, uint32_t id)
 Obtain a pointer to the PTK_Grid matching the specified id. More...
 

Macros

#define PTK_MAP_OK   ((uint32_t)0)
 Error codes. More...
 
#define PTK_MAP_XCELL_COUNT_INVALID   ((uint32_t)-1)
 Invalid X cell count. More...
 
#define PTK_MAP_YCELL_COUNT_INVALID   ((uint32_t)-2)
 Invalid Y cell count. More...
 
#define PTK_MAP_ZCELL_COUNT_INVALID   ((uint32_t)-3)
 Invalid Z cell count. More...
 
#define PTK_MAP_GRID_ID_INVALID   ((uint32_t)-4)
 Invalid grid ID. More...
 
#define PTK_MAP_GRID_DATA_TYPE_INVALID   ((uint32_t)-5)
 Invalid grid data type. More...
 
#define PTK_MAP_CELL_DATA_SIZE_INVALID   ((uint32_t)-6)
 Invalid grid element data size. More...
 

Macro Definition Documentation

◆ PTK_MAP_OK

#define PTK_MAP_OK   ((uint32_t)0)

Error codes.

Return status OK.

◆ PTK_MAP_XCELL_COUNT_INVALID

#define PTK_MAP_XCELL_COUNT_INVALID   ((uint32_t)-1)

Invalid X cell count.

◆ PTK_MAP_YCELL_COUNT_INVALID

#define PTK_MAP_YCELL_COUNT_INVALID   ((uint32_t)-2)

Invalid Y cell count.

◆ PTK_MAP_ZCELL_COUNT_INVALID

#define PTK_MAP_ZCELL_COUNT_INVALID   ((uint32_t)-3)

Invalid Z cell count.

◆ PTK_MAP_GRID_ID_INVALID

#define PTK_MAP_GRID_ID_INVALID   ((uint32_t)-4)

Invalid grid ID.

◆ PTK_MAP_GRID_DATA_TYPE_INVALID

#define PTK_MAP_GRID_DATA_TYPE_INVALID   ((uint32_t)-5)

Invalid grid data type.

◆ PTK_MAP_CELL_DATA_SIZE_INVALID

#define PTK_MAP_CELL_DATA_SIZE_INVALID   ((uint32_t)-6)

Invalid grid element data size.

Function Documentation

◆ PTK_Map_getSize()

uint32_t PTK_Map_getSize ( const PTK_MapConfig config)

Compute how much memory is required to store the complete PTK_Map described by the given configuration.

Parameters
[in]configConfiguration to determine memory requirements for.
Returns
Amount of memory required, in bytes.

◆ PTK_Map_init()

PTK_Map* PTK_Map_init ( uint8_t *  mem,
const PTK_MapConfig config 
)

Initialize an externally allocated piece of memory to be a valid PTK_Map. This also initializes all member PTK_Grids, so no further initialization is required.

Parameters
[out]memExternally allocated memory of at least PTK_Map_getSize() bytes.
[in]configConfiguration to guide initialization.
Returns

◆ PTK_Map_clear()

void PTK_Map_clear ( PTK_Map map)

This clears all PTK_Grids internal to the map. It has the same result as if PTK_Grid clear were called on each individually.

NOTE: Currently there is no way to clear the user specific data.

Parameters
[in,out]mapThe PTK_Map to be cleared.

◆ PTK_Map_copy()

uint32_t PTK_Map_copy ( PTK_Map *__restrict  dst,
const PTK_Map *__restrict  src 
)

Copy all constituent PTK_Grids from the given source PTK_Map to the destination PTK_Map. They must have the same PTK_MapConfig or an assertion failure is generated.

Parameters
[out]dstThe PTK_Map to copy to.
[in]srcThe PTK_Map to copy from.
Returns
  • The requested PTK_Grid, if record with matching Id is found.
  • NULL, otherwise

◆ PTK_Map_has()

uint32_t PTK_Map_has ( const PTK_Map map,
uint32_t  id 
)

Test if a PTK_Map contains a PTK_Grid with the specified id.

Parameters
[in]mapPTK_Map to check.
[in]idThe ID to look for.
Returns
  • 1 if the given PTK_Map contains a PTK_Grid matching the given id
  • 0, otherwise

◆ PTK_Map_get()

PTK_Grid* PTK_Map_get ( const PTK_Map map,
uint32_t  id 
)

Obtain a pointer to the PTK_Grid matching the specified id.

Parameters
[in]mapPTK_Map to check.
[in]idThe ID to look for.
Returns
  • The requested PTK_Grid, if record with matching Id is found.
  • NULL, otherwise