You’re reading an older version of the Slamcore SDK documenation. The latest one is 23.04.

Slamcore Scripts

The scripts are installed via the Slamcore C++ API package for your chosen platforms. There are two scripts available:

  • plot_trajectory.py

  • plot_map.py

Plot Trajectory

plot_trajectory.py is a simple script that allows plotting and visualisation of the 3D trajectories exported from Slamcore software.

_images/script_plot_trajectory_example.png

Fig. 15 Plot Trajectory Script

Dependencies

The Python3 script uses the matplotlib and numpy library. To install these dependencies, first ensure Python and pip are installed on your system.

# check Python version and installation
$ python --version

# check pip
$ pip -V

# install Matplotlib
$ pip install matplotlib

# install numpy
$ pip install numpy

Usage

To plot trajectories, run the following:

$ python /usr/src/slamcore/examples/plot_trajectory.py <path/to/CSV/file/1>
<path/to/CSV/file/2> ...

You may save or interact with the plot using the UI buttons for matplotlib.

Command-Line Options

At start-up, the Plot Trajectory script accepts the following command-line options:

-h,--help

show this help message and exit

trajectory_file

the path to the Slamcore trajectory CSV files to plot

Plot Map

plot_map.py is a simple script that allows plotting and visualisation of the occupancy map .txt file exported from Slamcore software.

_images/script_plot_map_example.png

Fig. 16 Plot Map Script

Dependencies

The Python3 script uses the matplotlib and numpy library. To install these dependencies, first ensure Python and pip are installed on your system.

# check Python version and installation
$ python --version

# check pip
$ pip -V

# install Matplotlib
$ pip install matplotlib

# install numpy
$ pip install numpy

Usage

First generate a map in .txt format using the write_map c++ example:

$ ./write_map <dataset/path> <output/txt/file> [<config/file>]

This will generate a .txt file containing the pixel values of the occupancy map.

To plot the map with the python script, run the following:

$ python /usr/src/slamcore/examples/plot_map.py <path/to/txt/file/>

You may save or interactive with the plot using the UI buttons for matplotlib.

Command-Line Options

At start-up, the Plot Map script accepts the following command-line options:

-h,--help

show this help message and exit

txt_map_file

Slamcore map TXT file to plot