kompass.components.mapper

Module Contents

Classes

LocalMapperConfig

LocalMapperConfig parameters

LocalMapper

This component is responsible for generating this local map during the navigation.

API

class kompass.components.mapper.LocalMapperConfig

Bases: kompass.config.ComponentConfig

LocalMapperConfig parameters

class kompass.components.mapper.LocalMapper(*, component_name: str, config_file: Optional[str] = None, config: Optional[kompass.components.mapper.LocalMapperConfig] = None, inputs: Optional[Dict[str, kompass.components.ros.Topic]] = None, outputs: Optional[Dict[str, kompass.components.ros.Topic]] = None, **kwargs)

Bases: kompass.components.component.Component

This component is responsible for generating this local map during the navigation.

Note

Current implementation supports LaserScan sensor data to create an Occupancy Grid local map. PointCloud and semantic information will be supported in an upcoming release

Available Run Types

Set directly from LocalMapper ‘run_type’ property.

Timed

Produces a local map periodically if all inputs are available

Inputs

Key

Description

Accepted Types

Number of Topics

Default Value

location

Robot current location

Odometry, PoseWithCovariance, Pose

1

Topic(name="/odom", msg_type="Odometry")

sensor_data

Direct sensor input

LaserScan

1

Topic(name="/scan", msg_type="LaserScan")

Outputs

Key

Description

Accepted Types

Default Value

local_map

Local occupancy map

OccupancyGrid

Topic(name="/scan", msg_type="LaserScan")

Usage Example:

    from kompass_core.mapping import LocalMapperConfig
    from kompass.components import LocalMapper, MapperConfig

    # Select map parameters
    map_params = MapperConfig(width=5.0, height=5.0, resolution=0.2) # 5mX5m map with 0.2m/cell resolution

    # Setup custom component configuration
    my_config = LocalMapperConfig(loop_rate=10.0, map_params=map_params)

    # Init a mapper
    my_mapper = LocalMapper(component_name="mapper", config=my_config)
init_variables()

Overwrites the init variables method called at Node init

publish_data()

Publish layers and obstacles mapped from LocalMapper

custom_on_configure()

Component custom configuration method to set the core debug level

property robot: kompass.config.RobotConfig

Getter of robot config

Returns:

Robot configuration

Return type:

RobotConfig

property run_type: kompass.config.ComponentRunType

Component run type: Timed, ActionServer or Event

Returns:

Timed, ActionServer or Server

Return type:

str

property inputs_keys: List[kompass.components.defaults.TopicsKeys]

Getter of component inputs key names that should be used in the inputs dictionary

property outputs_keys: List[kompass.components.defaults.TopicsKeys]

Getter of component outputs key names that should be used in the inputs dictionary

inputs(**kwargs)

Set component input streams (topics) : kwargs[topic_keyword]=Topic()

outputs(**kwargs)

Set component output streams (topics)

set_input(**kwargs) bool

Set value of an input(s) topic

Returns:

If input(s) successfully updated

Return type:

bool

set_output(**kwargs) bool

Set value of an output(s) topic

Returns:

If output is successfully updates

Return type:

bool

config_from_file(config_file: str)

Configure component from file

Parameters:

config_file (str) – Path to file (yaml, json, toml)

property odom_tf_listener: Optional[ros_sugar.tf.TFListener]

Gets a transform listener for Odometry (from odom to world)

Returns:

Return type:

TFListener

property scan_tf_listener: ros_sugar.tf.TFListener

Gets a transform listener for LaserScan (from scan to robot base)

Returns:

Return type:

TFListener

property depth_tf_listener: ros_sugar.tf.TFListener

Gets a transform listener for LaserScan (from scan to robot base)

Returns:

Return type:

TFListener

property pc_tf_listener: ros_sugar.tf.TFListener

Gets a transform listener for LaserScan (from scan to robot base)

Returns:

Return type:

TFListener

get_transform_listener(**kwargs) ros_sugar.tf.TFListener

Gets a transform listener

Parameters:
  • src_frame (str) – Source coordinates frame

  • goal_frame (str) – Goal coordinates frame

Returns:

TF listener object

Return type:

TFListener

in_topic_name(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[str, List[str], None]

Get the topic(s) name(s) corresponding to an input key name

Parameters:

key (str) – Input key name

Returns:

Topic(s) name(s)

Return type:

Union[str, List[str], None]

out_topic_name(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[str, List[str], None]

Get the topic(s) name(s) corresponding to an output key name

Parameters:

key (str) – Output key name

Returns:

Topic(s) name(s)

Return type:

Union[str, List[str], None]

get_in_topic(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[kompass.components.ros.Topic, List[kompass.components.ros.Topic], None]

Get the topic(s) corresponding to an input key name

Parameters:

key (str) – Input key name

Returns:

Topic(s)

Return type:

Union[Topic, List[Topic], None]

get_out_topic(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[kompass.components.ros.Topic, List[kompass.components.ros.Topic], None]

Get the topic(s) corresponding to an output key name

Parameters:

key (str) – Output key name

Returns:

Topic(s)

Return type:

Union[Topic, List[Topic], None]

get_callback(key: Union[str, kompass.components.defaults.TopicsKeys], idx: int = 0) Optional[kompass.callbacks.GenericCallback]

Get callback with given input key name

Parameters:
  • key (str) – Input key name

  • idx (int, optional) – Index of the input of multiple inputs correspond to the same key, defaults to 0

Raises:

KeyError – If key is not found in component inputs

Returns:

Callback object

Return type:

GenericCallback

get_publisher(key: Union[str, kompass.components.defaults.TopicsKeys], idx: int = 0) ros_sugar.io.Publisher

Get publisher with given output key name

Parameters:
  • key (str) – Output topic key name

  • idx (int, optional) – Index of the output of multiple inputs correspond to the same key, defaults to 0

Raises:

KeyError – If key is not found in component outputs

Returns:

Publisher object

Return type:

Publisher

callbacks_inputs_check(inputs_to_check: Optional[List[str]] = None, inputs_to_exclude: Optional[List[str]] = None) bool

Check that all node inputs are provided before executing callback