drawable_submap.h — DrawableSubmap class¶
include/cartographer_rviz/drawable_submap.h declares DrawableSubmap, the class that contains everything needed to render a single submap onto the final texture that represents the whole map.
class DrawableSubmap : public QObject { Q_OBJECT ... };
It is a QObject so that it can coordinate asynchronous texture fetching with the OGRE thread through Qt signal/slot connections.
Public interface¶
Constructor¶
DrawableSubmap(const cartographer::mapping::SubmapId& submap_id,
rviz_common::DisplayContext* display_context,
Ogre::SceneNode* map_node,
rviz_common::properties::Property* submap_category,
bool visible, bool pose_axes_visible,
float pose_axes_length, float pose_axes_radius);
The constructor creates an OGRE scene node under map_node, two OgreSlice children (high- and low-resolution), a pose-axes object, a submap ID text label, and a visibility BoolProperty parented to submap_category. The destructor waits for any in-flight texture query and destroys the scene nodes.
Members¶
Update(header, metadata)— updates the submap metadata (version and pose). If needed, the nextMaybeFetchTexture()call will fetch a new texture. Also renames the visibility property to"<submap_index>.<version>"and updates its tooltip description.MaybeFetchTexture(client, callback_group_executor)— if a newer texture version is available and it has not been queried too recently, issues an asynchronousSubmapQueryRPC and returnstrue.QueryInProgress()— returns whether an RPC is in progress.SetAlpha(current_tracking_z, fade_out_start_distance_in_meters)— sets the submap alpha based on its slice height and the current tracking-frame z value. Submaps withinfade_out_start_distance_in_metersof the tracking z are drawn at full opacity; beyond that they fade out over a band of the same length.SetSliceVisibility(slice_index, visible)— sets visibility of one texture slice.Accessors:
id(),version(),visibility(),set_visibility(),set_pose_markers_visibility().
Signals and slots¶
Signal
RequestSucceeded()— emitted after a texture RPC finishes, connected toUpdateSceneNode().Private slots:
UpdateSceneNode()(applies fetched textures to the OGRE slices),ToggleVisibility(),TogglePoseMarkerVisibility().
Private state¶
The class holds the submap id, a mutex_ guarding the pose, query bookkeeping (last_query_timestamp_, query_in_progress_, metadata_version_), the fetched SubmapTextures, an rpc_request_future_ for the async query, the OGRE nodes (submap_node_, submap_id_text_node_, ogre_slices_), the pose axes and ID text objects, the current alpha, and the visibility property.