kompass.components.map_server¶
Module Contents¶
Classes¶
MapServer component configuration parameters |
|
MapServer component used for reading and converting map data from file to serve a global map. Supports both 2D maps with a YAML file and 3D maps with PCD files. |
API¶
- class kompass.components.map_server.MapServerConfig¶
Bases:
kompass.config.ComponentConfigMapServer component configuration parameters
Name
Type, Default
Description
map_file_read_rate
float,0.0Rate to read and convert the map data from file. If zero, converts once.
pc_publish_row
bool,TruePublish the row point cloud data read from the file. Only applicable if input is
.pcdfile.pc_frame
Optional[str],NoneFrame ID to use when publishing the point cloud data. If
None, uses the world frame.map_file_path
Optional[str],NonePath to the map file.
custom_map_frame
Optional[str],NoneCustom frame ID for the map.
grid_resolution
float,0.05Resolution of the occupancy grid if generating from point cloud.
z_ground_limit
float,0.01Points below this height value are considered ground. Used only for point cloud input.
- class kompass.components.map_server.MapServer(component_name: str, config_file: Optional[str] = None, config: Optional[kompass.components.map_server.MapServerConfig] = None, outputs: Optional[Dict[str, kompass.components.ros.Topic]] = None, **kwargs)¶
Bases:
kompass.components.component.ComponentMapServer component used for reading and converting map data from file to serve a global map. Supports both 2D maps with a YAML file and 3D maps with PCD files.
Outputs:
Key Name
Allowed Types
Number
Default
global_map
1
Topic(name="/map", msg_type="OccupancyGrid")- Global map generated from input data.spatial_sensor
1, optional
Topic(name="/row_point_cloud", msg_type="PointCloud2")- Row point cloud data for visualization or further processing.Available Services:
Save2dMapToFile: Saves the 2D map to a file (YAML format).
Save3dMapToFile: Saves the 3D map to a file (PCD format).
Usage Example:
from kompass.components import MapServerConfig, MapServer from kompass.ros import Topic # Setup custom configuration my_config = MapServerConfig( map_file_read_rate=5.0, map_file_path="/path/to/your/map.pcd", grid_resolution=0.1, pc_publish_row=False, ) # Init a MapServer object my_map_server = MapServer(component_name="map_server", config=my_config)
- init_variables()¶
Overwrites the init variables method called at Node init
- create_all_timers()¶
Create all node timers
- create_all_services()¶
Creates all node services
- destroy_all_timers()¶
Destroys all node timers
- destroy_all_services()¶
Destroys all node services
- convert_map_from_file() bool¶
Convert the map from file to OccupancyGrid message
- 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:
- 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:
- property scan_tf_listener: ros_sugar.tf.TFListener¶
Gets a transform listener for LaserScan (from scan to robot base)
- Returns:
- Return type:
- property depth_tf_listener: ros_sugar.tf.TFListener¶
Gets a transform listener for LaserScan (from scan to robot base)
- Returns:
- Return type:
- property pc_tf_listener: ros_sugar.tf.TFListener¶
Gets a transform listener for LaserScan (from scan to robot base)
- Returns:
- Return type:
- 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:
- 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
- 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
- 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:
- 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:
- 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