13 #include <mrpt/version.h> 16 #if MRPT_VERSION >= 0x199 17 #include <mrpt/math/CMatrixFixed.h> 20 template <
typename T, std::
size_t ROWS, std::
size_t COLS>
21 using CMatrixFixedNumeric = CMatrixFixed<T, ROWS, COLS>;
28 template <
class GRAPH_T>
31 const std::string &rawlog_fname ,
32 const std::string &fname_GT ,
41 win_manager, node_reg, edge_reg,
43 m_conn_manager(dynamic_cast<
mrpt::utils::COutputLogger *>(this), nh),
44 m_nh(nh), m_graph_nodes_last_size(0), m_registered_multiple_nodes(false),
45 cm_graph_async_spinner( 1, &this->custom_service_queue),
46 m_sec_alignment_params(
"AlignmentParameters"),
47 m_sec_mr_slam_params(
"MultiRobotParameters"), m_opts(*this) {
53 "In Destructor: Deleting CGraphSlamEngine_MR instance...");
56 for (
typename neighbors_t::iterator neighbors_it =
m_neighbors.begin();
57 neighbors_it !=
m_neighbors.end(); ++neighbors_it) {
62 template <
class GRAPH_T>
71 ->tf_self_to_neighbor_first_integrated_pose) &&
73 neighbor->hasNewData() &&
86 template <
class GRAPH_T>
96 std::vector<TNodeID> nodeIDs;
97 std::map<TNodeID, node_props_t> nodes_params;
103 mrpt_msgs::GetCMGraph cm_graph_srv;
106 for (
const auto n : nodeIDs) {
107 cm_graph_srv.request.nodeIDs.push_back(
n);
126 "Merging new batch from \"" 133 pair<TNodeID, node_props_t> node_props_to_connect = *nodes_params.begin();
137 c.mean = node_props_to_connect.second.pose -
139 #if MRPT_VERSION >= 0x199 140 c.cov_inv.setIdentity();
149 for (
const auto n : this->
m_graph.nodes) {
150 if (
n.second.agent_ID_str == neighbor->
getAgentNs() &&
151 n.second.nodeID_loc ==
153 graph_conn.
from =
n.first;
158 graph_conn.
to = node_props_to_connect.first;
161 "Hypothesis for adding the batch of nodes: " << graph_conn);
162 graph_conns.push_back(graph_conn);
165 std::map<TNodeID, TNodeID> old_to_new_mappings;
166 this->
m_graph.mergeGraph(other_graph, graph_conns,
168 &old_to_new_mappings);
175 for (
typename std::vector<TNodeID>::const_iterator n_cit = nodeIDs.begin();
176 n_cit != nodeIDs.end(); ++n_cit) {
183 new_nodeIDs_to_scans_pairs.insert(make_pair(old_to_new_mappings.at(*n_cit),
184 nodes_params.at(*n_cit).scan));
186 <<
"\t[old:] " << *n_cit << endl
187 <<
"| [new:] " << old_to_new_mappings.at(*n_cit));
191 new_nodeIDs_to_scans_pairs.end());
200 TNodeID last_node = *nodeIDs.rbegin();
202 make_pair(last_node, nodes_params.at(last_node).pose);
209 template <
class GRAPH_T>
223 bool ret_val =
false;
226 for (
typename neighbors_t::iterator neighbors_it =
m_neighbors.begin();
227 neighbors_it !=
m_neighbors.end(); ++neighbors_it) {
236 "Updating own cached map after successful node registration...");
252 template <
class GRAPH_T>
263 bool ret_val =
false;
265 std::vector<TNodeID> neighbor_nodes;
266 std::map<TNodeID, node_props_t> nodes_params;
277 COccupancyGridMap2D::Ptr neighbor_gridmap = neighbor->
getGridMap();
286 this->logFmt(LVL_INFO,
"Trying to align the maps, initial estimation: %s",
295 const CPosePDF::Ptr pdf_tmp = gridmap_aligner.
AlignPDF(
297 &run_time, &results);
298 this->logFmt(LVL_INFO,
"Elapsed Time: %f", run_time);
299 CPosePDFSOG::Ptr pdf_out = CPosePDFSOG::Create();
300 pdf_out->copyFrom(*pdf_tmp);
304 pdf_out->getMostLikelyCovarianceAndMean(cov_out, pose_out);
306 this->logFmt(LVL_INFO,
"%s\n",
322 mrpt_msgs::GetCMGraph cm_graph_srv;
323 typedef mrpt_msgs::GetCMGraphRequest::_nodeIDs_type nodeID_type;
324 nodeID_type &matched_nodeIDs = cm_graph_srv.request.nodeIDs;
328 for (
typename std::vector<TNodeID>::const_iterator n_cit =
329 neighbor_nodes.begin();
330 n_cit != neighbor_nodes.end(); ++n_cit) {
331 matched_nodeIDs.push_back(*n_cit);
359 #if MRPT_VERSION >= 0x199 360 cov_out = c.cov_inv.inverse();
362 cov_out.inv(c.cov_inv);
367 graph_conn.
to = *neighbor_nodes.begin();
370 graph_conns.push_back(graph_conn);
373 std::map<TNodeID, TNodeID> old_to_new_mappings;
374 this->
m_graph.mergeGraph(other_graph, graph_conns,
376 &old_to_new_mappings);
383 for (
typename std::vector<TNodeID>::const_iterator n_cit =
384 neighbor_nodes.begin();
385 n_cit != neighbor_nodes.end(); ++n_cit) {
392 new_nodeIDs_to_scans_pairs.insert(make_pair(old_to_new_mappings.at(*n_cit),
393 nodes_params.at(*n_cit).scan));
395 <<
"\t[old:] " << *n_cit << endl
396 <<
"| [new:] " << old_to_new_mappings.at(*n_cit));
400 new_nodeIDs_to_scans_pairs.end());
418 TNodeID last_node = *neighbor_nodes.rbegin();
420 make_pair(last_node, nodes_params.at(last_node).pose);
425 <<
"] have been integrated successfully");
433 template <
class GRAPH_T>
435 mrpt::obs::CActionCollection::Ptr &action,
436 mrpt::obs::CSensoryFrame::Ptr &observations,
437 mrpt::obs::CObservation::Ptr &observation,
size_t &rawlog_entry) {
440 using namespace mrpt;
444 observation, rawlog_entry);
447 bool did_register_from_map_merge;
452 "Conservative inter-graph TF computation is not yet implemented.");
457 (did_register_from_map_merge || did_register_from_batches);
465 return continue_exec;
490 std::vector<string> nodes_up;
495 "Waiting for master_discovery, master_sync nodes to come up....");
497 "/master_sync/get_sync_info");
591 template <
class GRAPH_T>
603 &this->
m_graph.nodes.at(nodeID));
620 template <
class GRAPH_T>
627 neighbors_it !=
m_neighbors.end(); ++neighbors_it) {
629 if ((*neighbors_it)->getAgentNs() == agent_ID_str) {
631 neighbor = *neighbors_it;
640 template <
class GRAPH_T>
653 mrpt_msgs::GraphSlamAgents nearby_slam_agents;
663 for (GraphSlamAgents::_list_type::const_iterator it =
664 nearby_slam_agents.list.begin();
665 it != nearby_slam_agents.list.end(); ++it) {
667 const GraphSlamAgent &gsa = *it;
671 return (neighbor->agent == gsa);
673 typename neighbors_t::const_iterator neighbor_it =
684 make_pair(latest_neighbor,
false));
696 template <
class GRAPH_T>
709 typename GRAPH_T::global_poses_t poses_to_send;
710 int poses_counter = 0;
712 NodeIDWithPose_vec ros_nodes;
715 for (
typename GRAPH_T::global_poses_t::const_reverse_iterator cit =
718 cit != this->
m_graph.nodes.rend());
726 NodeIDWithPose curr_node_w_pose;
728 curr_node_w_pose.nodeID = cit->first;
732 curr_node_w_pose.str_ID.data = cit->second.agent_ID_str;
733 curr_node_w_pose.nodeID_loc = cit->second.nodeID_loc;
735 ros_nodes.vec.push_back(curr_node_w_pose);
754 template <
class GRAPH_T>
774 if (!this->
isOwnNodeID(mrpt_last_regd_id_scan.first)) {
781 ASSERT_(mrpt_last_regd_id_scan.second);
784 mrpt_msgs::NodeIDWithLaserScan ros_last_regd_id_scan;
785 convert(*(mrpt_last_regd_id_scan.second), ros_last_regd_id_scan.scan);
786 ros_last_regd_id_scan.nodeID = mrpt_last_regd_id_scan.first;
801 template <
class GRAPH_T>
808 typename GRAPH_T::global_poses_t::const_iterator global_pose_search =
809 this->
m_graph.nodes.find(nodeID);
811 mrpt::format(
"isOwnNodeID called for nodeID \"%lu\" which is not " 812 "found in the graph",
813 static_cast<unsigned long>(nodeID)));
817 pose_out = &global_pose_search->second;
851 template <
class GRAPH_T>
858 template <
class GRAPH_T>
899 template <
class GRAPH_T>
901 mrpt_msgs::GetCMGraph::Request &req, mrpt_msgs::GetCMGraph::Response &
res) {
906 set<TNodeID> nodes_set(req.nodeIDs.begin(), req.nodeIDs.end());
910 if (nodes_set.size() < 2) {
915 GRAPH_T mrpt_subgraph;
916 this->
m_graph.extractSubGraph(nodes_set, &mrpt_subgraph,
923 template <
class GRAPH_T>
925 const TNodeID nodeID, mrpt::opengl::CSetOfObjects::Ptr &viz_object) {
931 std::string &agent_ID_str = this->
m_graph.nodes.at(nodeID).agent_ID_str;
940 obj_color = neighbor->
color;
942 viz_object->setColor_u8(obj_color);
947 template <
class GRAPH_T>
949 bool registered , std::string class_name ) {
964 template <
class GRAPH_T>
966 typename GRAPH_T::global_poses_t *graph_poses)
const {
970 for (
const auto &
n : this->
m_graph.nodes) {
972 graph_poses->insert(
n);
979 template <
class GRAPH_T>
981 std::set<TNodeID> *nodes_set)
const {
985 for (
const auto &
n : this->
m_graph.nodes) {
987 nodes_set->insert(
n.first);
992 template <
class GRAPH_T>
994 std::set<TNodeID> *nodes_set)
const {
1001 template <
class GRAPH_T>
1004 const mrpt_msgs::GraphSlamAgent &agent_in)
1005 : engine(engine_in), agent(agent_in), has_setup_comm(false) {
1015 "/" +
agent.topic_namespace.data +
"/" +
engine.m_last_regd_nodes_topic;
1017 "/" +
agent.topic_namespace.data +
"/" +
engine.m_last_regd_id_scan_topic;
1019 "/" +
agent.topic_namespace.data +
"/" +
engine.m_cm_graph_service;
1022 "In constructor of TNeighborAgentProps for topic namespace: %s",
1023 agent.topic_namespace.data.c_str());
1027 COccupancyGridMap2D::Ptr eng_gridmap =
engine.m_gridmap_cached;
1028 gridmap_cached->setSize(eng_gridmap->getXMin(), eng_gridmap->getXMax(),
1029 eng_gridmap->getYMin(), eng_gridmap->getYMax(),
1030 eng_gridmap->getResolution());
1034 template <
class GRAPH_T>
1037 template <
class GRAPH_T>
1045 "TNeighborAgentProps: Successfully set up subscribers/services " 1046 "to agent topics for namespace [%s].",
1047 agent.topic_namespace.data.c_str());
1052 template <
class GRAPH_T>
1059 template <
class GRAPH_T>
1072 template <
class GRAPH_T>
1074 const mrpt_msgs::NodeIDWithPose_vec::ConstPtr &nodes) {
1078 using namespace std;
1081 typedef typename GRAPH_T::constraint_t::type_value
pose_t;
1082 engine.logFmt(LVL_DEBUG,
"In fetchUpdatedNodesList method.");
1084 for (NodeIDWithPose_vec::_vec_type::const_iterator n_it = nodes->vec.begin();
1085 n_it != nodes->vec.end(); ++n_it) {
1089 std::pair<set<TNodeID>::iterator,
bool>
res =
nodeIDs_set.insert(nodeID);
1092 engine.logFmt(LVL_INFO,
"Just fetched a new nodeID: %lu",
1093 static_cast<unsigned long>(nodeID));
1136 template <
class GRAPH_T>
1138 const mrpt_msgs::NodeIDWithLaserScan::ConstPtr &last_regd_id_scan) {
1140 using namespace std;
1143 engine.logFmt(LVL_DEBUG,
"In fetchLastRegdIDScan method.");
1148 ros_scans.push_back(*last_regd_id_scan);
1154 template <
class GRAPH_T>
1156 std::vector<TNodeID> *nodeIDs ,
1157 std::map<TNodeID, node_props_t> *nodes_params ,
1158 bool only_unused )
const {
1163 using namespace std;
1167 ASSERT_(nodeIDs || nodes_params);
1170 for (std::set<TNodeID>::const_iterator n_it =
nodeIDs_set.begin();
1181 std::pair<TNodeID, node_props_t>
params;
1184 params.first = *n_it;
1185 params.second.pose = *p;
1186 CObservation2DRangeScan::Ptr mrpt_scan =
1187 CObservation2DRangeScan::Create();
1196 if (!ros_laser_scan) {
1201 params.second.scan = mrpt_scan;
1204 nodes_params->insert(params);
1221 nodeIDs->push_back(*n_it);
1228 template <
class GRAPH_T>
1234 template <
class GRAPH_T>
1236 int new_batch_size) {
1239 auto is_not_integrated = [
this](
const std::pair<TNodeID, bool> pair) {
1242 int not_integrated_num =
1246 return (not_integrated_num >= new_batch_size);
1251 template <
class GRAPH_T>
1260 for (std::vector<mrpt_msgs::NodeIDWithLaserScan>::const_iterator it =
1263 if (it->nodeID == nodeID) {
1273 template <
class GRAPH_T>
1275 const std::set<TNodeID> &nodeIDs,
paths_t *opt_paths)
const {
1277 using namespace std;
1279 typedef std::set<TNodeID>::const_iterator set_cit;
1284 "nodeIDs is not a strict subset of the current neighbor's nodes");
1287 for (set_cit cit = nodeIDs.begin(); cit != std::prev(nodeIDs.end()); ++cit) {
1289 for (set_cit cit2 = std::next(cit); cit2 != nodeIDs.end(); ++cit2) {
1294 constraint_t::state_length>();
1298 opt_paths->push_back(
path_t(
1304 LVL_DEBUG,
"Filling optimal path for nodes: %lu => %lu: %s",
1305 static_cast<unsigned long>(*cit), static_cast<unsigned long>(*cit2),
1306 opt_paths->back().curr_pose_pdf.getMeanVal().asString().c_str());
1312 template <
class GRAPH_T>
1317 using namespace mrpt;
1319 using namespace std;
1323 std::vector<TNodeID> nodeIDs;
1324 std::map<TNodeID, node_props_t> nodes_params;
1329 for (
typename map<TNodeID, node_props_t>::const_iterator it =
1330 nodes_params.begin();
1331 it != nodes_params.end(); ++it) {
1333 auto obs = it->second.scan.get();
1334 #if MRPT_VERSION >= 0x199 1344 template <
class GRAPH_T>
1345 const mrpt::maps::COccupancyGridMap2D::Ptr &
1356 template <
class GRAPH_T>
1358 mrpt::maps::COccupancyGridMap2D::Ptr &map)
const {
1370 template <
class GRAPH_T>
1375 template <
class GRAPH_T>
1377 : conservative_find_initial_tfs_to_neighbors(false),
1378 nodes_integration_batch_size(4), num_last_regd_nodes(10),
1379 inter_group_node_count_thresh(40),
1380 inter_group_node_count_thresh_minadv(25),
engine(engine_in) {
1383 template <
class GRAPH_T>
1387 template <
class GRAPH_T>
1397 "Conservative behavior is not yet implemented.");
1403 "inter_group_node_count_thresh [%d]" 1404 "is set lower than the advised minimum [%d]",
1408 std::this_thread::sleep_for(std::chrono::milliseconds(2000));
1413 template <
class GRAPH_T>
1415 #
if MRPT_VERSION >= 0x199
1416 std::ostream &out)
const {
virtual mrpt::poses::CPose3D getLSPoseForGridMapVisualization(const mrpt::utils::TNodeID nodeID) const
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void dumpToTextStream(mrpt::utils::CStream &out) const
bool pubUpdatedNodesList()
Update the last registered NodeIDs and corresponding positions of the current agent.
void computeGridMap() const
Using the fetched LaserScans and nodeID positions, compute the occupancy gridmap of the given neighbo...
mrpt::maps::COccupancyGridMap2DPtr m_gridmap_cached
const engine_mr_t & engine
void getCachedNodes(std::vector< TNodeID > *nodeIDs=NULL, std::map< TNodeID, node_props_t > *nodes_params=NULL, bool only_unused=true) const
Return cached list of nodeIDs (with their corresponding poses, LaserScans)
GRAPH_T::constraint_t::type_value pose_t
Edge Registration Decider virtual method.
mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_T > * m_node_reg
std::string m_list_neighbors_topic
Name of topic at which we publish information about the agents that we can currently communicate with...
ros::AsyncSpinner cm_graph_async_spinner
AsyncSpinner that is used to query the CM-Graph service in case a new request arrives.
void publish(const boost::shared_ptr< M > &message) const
ros::ServiceClient cm_graph_srvclient
void loadFromConfigFileName(const std::string &config_file, const std::string §ion)
void addTextMessage(const double x, const double y, const std::string &text, const mrpt::utils::TColorf &color=mrpt::utils::TColorf(1.0, 1.0, 1.0), const size_t unique_index=0)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool hasNewNodesBatch(int new_batch_size)
Decide whether there are enough new nodes + scans that have not been integrated in the graph yet...
GRAPH_T::constraint_t constraint_t
#define THROW_EXCEPTION(msg)
ros::Publisher m_last_regd_id_scan_pub
Publisher of the laserScan + the corresponding (last) registered node.
std::string m_sec_mr_slam_params
TColorManager m_neighbor_colors_manager
bool m_registered_multiple_nodes
Indicates whether multiple nodes were just registered. Used for checking correct node registration in...
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
~TNeighborAgentProps()
Destructor.
mrpt::utils::TColor getNextTColor()
std::string getSTLContainerAsString(const T &t)
bool addNodeBatchesFromAllNeighbors()
Traverse all neighbors for which I know the inter-graph transformation, run addNodeBatchFromNeighbor...
bool call(MReq &req, MRes &res)
std::set< TNodeID > nodeIDs_set
NodeIDs that I have received from this graphSLAM agent.
#define MRPT_LOG_WARN_STREAM(__CONTENTS)
ros::Subscriber last_regd_nodes_sub
ros::NodeHandle * nh
NodeHandle passed by the calling CGraphSlamEngine_MR class.
std::vector< mrpt_msgs::NodeIDWithLaserScan > ros_scans
ROS LaserScans that I have received from this graphSLAM agent.
mrpt::graphslam::deciders::CEdgeRegistrationDecider< GRAPH_T > * m_edge_reg
#define MRPT_LOG_INFO_STREAM(__CONTENTS)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
std::string m_config_fname
std::pair< TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > MRPT_NodeIDWithLaserScan
TColor color
Unique color of current TNeighborAgentProps instance.
void getNodeIDsOfEstimatedTrajectory(std::set< TNodeID > *nodes_set) const
bool findTFsWithAllNeighbors()
Using map-merging find a potentuial transofrmation between own graph map to another agent's map and u...
constraint_t::type_value pose_t
#define MRPT_LOG_DEBUG_STREAM(__CONTENTS)
mrpt::graphslam::TUncertaintyPath< GRAPH_T > path_t
std::map< TNeighborAgentProps *, bool > m_neighbor_to_found_initial_tf
Map from neighbor instance to transformation from own to neighbor's graph.
bool getNeighborByAgentID(const std::string &agent_ID_str, TNeighborAgentProps *&neighbor) const
Fill the TNeighborAgentProps instance based on the given agent_ID_str string that is provided...
mrpt::poses::CPosePDFPtr AlignPDF(const mrpt::maps::CMetricMap *m1, const mrpt::maps::CMetricMap *m2, const mrpt::poses::CPosePDFGaussian &initialEstimationPDF, float *runningTime=NULL, void *info=NULL)
std::string getGridMapAlignmentResultsAsString(const mrpt::poses::CPosePDF &pdf, const mrpt::slam::CGridMapAligner::TReturnInfo &ret_info)
TNeighborAgentProps(CGraphSlamEngine_MR< GRAPH_T > &engine_in, const mrpt_msgs::GraphSlamAgent &agent_in)
Constructor.
TAlignerMethod methodSelection
void fetchLastRegdIDScan(const mrpt_msgs::NodeIDWithLaserScan::ConstPtr &last_regd_id_scan)
Fill the LaserScan of the last registered nodeID.
#define MRPT_LOAD_CONFIG_VAR(variableName, variableType, configFileObject, sectionNameStr)
void setupSubs()
Setup the necessary subscribers for fetching nodes, laserScans for the current neighbor.
size_t m_graph_nodes_last_size
Last known size of the m_nodes map.
mrpt::poses::CPose2D tf_self_to_neighbor_first_integrated_pose
CPose2D connecting own graph origin to neighbor first received and integrated node. If this pose is 0 then it is not yet computed.
const mrpt::maps::COccupancyGridMap2D::Ptr & getGridMap() const
void setCGraphSlamEnginePtr(const engine_t *engine)
void execDijkstraNodesEstimation()
std::map< TNodeID, bool > nodeID_to_is_integrated
Have I already integrated this node in my graph?
bool _execGraphSlamStep(mrpt::obs::CActionCollection::Ptr &action, mrpt::obs::CSensoryFrame::Ptr &observations, mrpt::obs::CObservation::Ptr &observation, size_t &rawlog_entry)
std::string m_sec_alignment_params
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
virtual void monitorNodeRegistration(bool registered=false, std::string class_name="Class")
mrpt::slam::CGridMapAligner::TConfigParams m_alignment_options
Parameters used during the alignment operation.
TOptions(const engine_mr_t &engine_in)
void fillOptPaths(const std::set< TNodeID > &nodeIDs, paths_t *opt_paths) const
Fill the optimal paths for each combination of the given nodeIDs.
void getRobotEstimatedTrajectory(typename GRAPH_T::global_poses_t *graph_poses) const
size_t inter_group_node_count_thresh
Lowest number of nodes that should exist in a group of nodes before evaluating it. These nodes are fetched by the other running graphSLAM agents.
virtual void setCConnectionManagerPtr(mrpt::graphslam::detail::CConnectionManager *conn_manager)
mrpt::graphslam::detail::CConnectionManager m_conn_manager
CConnectionManager instance.
void setCallbackQueue(CallbackQueueInterface *queue)
std::string getClassName() const
void setTColor(const TColor &color_in)
Set the color related to the current neighbor agent.
bool isEssentiallyZero(const mrpt::poses::CPose2D &p)
mrpt::graphslam::CWindowManager * m_win_manager
bool convert(const mrpt_msgs::ObservationRangeBeacon &_msg, const mrpt::poses::CPose3D &_pose, mrpt::obs::CObservationBeaconRanges &_obj)
std::vector< CMatrixD > results
const mrpt_msgs::GraphSlamAgent agent
ros::NodeHandle * m_nh
NodeHandle pointer - inherited by the parent. Redefined here for convenience.
void setEdge(const constraint_t &edge)
bool pubLastRegdIDScan()
Update the last registered NodeID and LaserScan of the current agent.
void fetchUpdatedNodesList(const mrpt_msgs::NodeIDWithPose_vec::ConstPtr &nodes)
Update nodeIDs + corresponding estimated poses.
int num_last_regd_nodes
Max number of last registered NodeIDs + corresponding positions to publish.
virtual bool _execGraphSlamStep(mrpt::obs::CActionCollection::Ptr &action, mrpt::obs::CSensoryFrame::Ptr &observations, mrpt::obs::CObservation::Ptr &observation, size_t &rawlog_entry)
void usePublishersBroadcasters()
Provide feedback about the SLAM operation.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void loadFromConfigFile(const CConfigFileBase &source, const std::string §ion)
ros::Publisher m_list_neighbors_pub
ros::ServiceServer m_cm_graph_srvserver
Interface for implementing deciders/optimizers related to the Condensed Measurements multi-robot grap...
mrpt::graphslam::CGraphSlamEngine_MR::TOptions m_opts
ros::CallbackQueue custom_service_queue
Custom Callback queue for processing requests for the services outside the standard CallbackQueue...
virtual void usePublishersBroadcasters()
Provide feedback about the SLAM operation.
mrpt::utils::TNodeID m_nodeID_max
mrpt::utils::TNodeID from
mrpt::poses::CPose3D getLSPoseForGridMapVisualization(const TNodeID nodeID) const
void monitorNodeRegistration(bool registered=false, std::string class_name="Class")
Overriden method that takes in account registration of multiple nodes of other running graphSLAM agen...
bool findTFWithNeighbor(TNeighborAgentProps *neighbor)
Method is used only when I haven't found any transformation between mine and the current neighbor's g...
virtual void setClassName(const std::string &name)
void convert(const ros::Time &src, mrpt::system::TTimeStamp &des)
mrpt::utils::TColor m_optimized_map_color
ros::Subscriber last_regd_id_scan_sub
CGraphSlamEngine_MR< GRAPH_T > & engine
bool conservative_find_initial_tfs_to_neighbors
Be conservative when it comes to deciding the initial transformation of own graph with regards to gra...
std::string m_mr_ns
Condensed Measurements topic namespace.
const std::string & getTrimmedNs() const
Get the agent ROS namespace.
int nodes_integration_batch_size
After an inter-graph transformation is found between own graph and a neighbor's map, newly fetched neighbor's nodes are added in batches.
mrpt::maps::COccupancyGridMap2D::Ptr gridmap_cached
Pointer to the gridmap object of the neighbor.
ros::Publisher m_last_regd_nodes_pub
Publisher of the last registered nodeIDs and positions.
nodes_to_scans2D_t m_nodes_to_laser_scans2D
GRAPH_T::global_pose_t global_pose_t
bool getCMGraph(mrpt_msgs::GetCMGraph::Request &req, mrpt_msgs::GetCMGraph::Response &res)
Compute and fill the Condensed Measurements Graph.
void setObjectPropsFromNodeID(const TNodeID nodeID, mrpt::opengl::CSetOfObjects::Ptr &viz_object)
std::vector< hypot_t > hypots_t
mrpt::slam::CGridMapAligner::TConfigParams options
void setupSrvs()
Setup necessary services for neighbor.
void getNearbySlamAgents(mrpt_msgs::GraphSlamAgents *agents_vec, bool ignore_self=true)
Fill the given vector with the SLAM Agents that the current manager can see and communicate with...
mrpt::graphslam::optimizers::CGraphSlamOptimizer< GRAPH_T > * m_optimizer
virtual void addBatchOfNodeIDsAndScans(const std::map< TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > &nodeIDs_to_scans2D)
neighbors_t m_neighbors
GraphSlamAgent instance pointer to TNeighborAgentProps.
std::string last_regd_nodes_topic
size_t inter_group_node_count_thresh_minadv
Minimum advised limit of inter_group_node_count_thresh.
double m_offset_y_nrd
Display the Deciders/Optimizers with which we are running as well as the namespace of the current age...
void setupComm()
Wrapper for calling setupSubs, setupSrvs.
std::string last_regd_id_scan_topic
GRAPH_T::global_poses_t poses
Poses that I have received from this graphSLAM agent.
#define MRPT_LOG_ERROR_STREAM(__CONTENTS)
std::string m_cm_graph_service
Name of the server which is to be called when other agent wants to have a subgraph of certain nodes r...
std::map< mrpt::utils::TNodeID, mrpt::obs::CObservation2DRangeScanPtr > nodes_to_scans2D_t
void dumpToConsole() const
std::string cm_graph_service
bool isOwnNodeID(const TNodeID nodeID, const global_pose_t *pose_out=NULL) const
Return true if current CGraphSlamEngine_MR object initially registered this nodeID, false otherwise.
ROSCPP_DECL bool getNodes(V_string &nodes)
CallbackQueueInterface * getCallbackQueue() const
std::pair< TNodeID, mrpt::poses::CPose2D > last_integrated_pair_neighbor_frame
Last nodeID/CPose2D of neighbor that was integrated - Pose is taken with regards to neighbor's frame ...
mrpt::graphslam::CGraphSlamEngine derived class for executing multi-robot graphSLAM ...
bool hasNewData() const
Return True if there are new data (node positions and corresponding LaserScans available) ...
std::string m_last_regd_id_scan_topic
Name of the topic that the last registered laser scan (+ corresponding nodeID) is published at...
std::vector< path_t > paths_t
double m_offset_y_namespace
GRAPH_T::constraint_t constraint_t
ROSCPP_DECL bool search(const std::string &ns, const std::string &key, std::string &result)
#define ASSERTMSG_(f, __ERROR_MSG)
const bool m_enable_visuals
size_t m_nodes_to_laser_scans2D_last_size
Last known size of the m_nodes_to_laser_scans2D map.
Struct responsible for holding properties (nodeIDs, node positions, LaserScans) that have been regist...
void readROSParameters()
Read configuration parameters from the ROS parameter server.
bool addNodeBatchFromNeighbor(TNeighborAgentProps *neighbor)
neighbors for which I know the inter-graph transformation, add new batches of fetches nodeIDs and sca...
std::string m_last_regd_nodes_topic
Name of the topic that the last X registered nodes + positions are going to be published at...
GLsizei GLsizei GLchar * source
std::string getAgentNs() const
void assignTextMessageParameters(double *offset_y, int *text_index)
void setupComm()
Wrapper method around the protected setup* class methods.
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)
void asString(std::string &s) const
void getAllOwnNodes(std::set< TNodeID > *nodes_set) const
Fill given set with the nodeIDs that were initially registered by the current graphSLAM engine (and n...
const sensor_msgs::LaserScan * getLaserScanByNodeID(const TNodeID nodeID) const
int m_text_index_namespace