13 #include <geometry_msgs/Pose.h> 14 #include <geometry_msgs/PoseWithCovariance.h> 15 #include <mrpt_msgs/NodeIDWithPose.h> 19 #include <mrpt/version.h> 20 #if MRPT_VERSION < 0x199 23 #include <mrpt/graphs/TNodeID.h> 35 mrpt_msgs::NetworkOfPoses& ros_graph)
48 mrpt_graph.BASE::edges;
54 for (poses_cit_t poses_cit = mrpt_graph.
nodes.begin();
55 poses_cit != mrpt_graph.
nodes.end(); ++poses_cit)
57 mrpt_msgs::NodeIDWithPose ros_node;
60 ros_node.nodeID = poses_cit->first;
62 convert(poses_cit->second, ros_node.pose);
65 ros_node.str_ID.data =
"";
66 ros_node.nodeID_loc = 0;
68 ros_graph.nodes.vec.push_back(ros_node);
73 constr_it != constraints.end(); ++constr_it)
75 mrpt_msgs::GraphConstraint ros_constr;
78 ros_constr.nodeID_from = constr_it->first.first;
79 ros_constr.nodeID_to = constr_it->first.second;
85 constr_it->second.
inverse(constr_inv);
86 convert(constr_inv, ros_constr.constraint);
90 convert(constr_it->second, ros_constr.constraint);
93 ros_graph.constraints.push_back(ros_constr);
101 mrpt_msgs::NetworkOfPoses& ros_graph)
105 "Implement CNetworkOfPoses3DInf => mrpt_msgs::NetworkOfPoses " 111 mrpt_msgs::NetworkOfPoses& ros_graph)
132 mrpt_graph.BASE::edges;
138 for (poses_cit_t poses_cit = mrpt_graph.
nodes.begin();
139 poses_cit != mrpt_graph.
nodes.end(); ++poses_cit)
141 mrpt_msgs::NodeIDWithPose ros_node;
144 ros_node.nodeID = poses_cit->first;
146 convert(poses_cit->second, ros_node.pose);
149 ros_node.str_ID.data = poses_cit->second.agent_ID_str;
150 ros_node.nodeID_loc = poses_cit->second.nodeID_loc;
152 ros_graph.nodes.vec.push_back(ros_node);
158 constr_it != constraints.end(); ++constr_it)
160 mrpt_msgs::GraphConstraint ros_constr;
163 ros_constr.nodeID_from = constr_it->first.first;
164 ros_constr.nodeID_to = constr_it->first.second;
170 constr_it->second.
inverse(constr_inv);
171 convert(constr_inv, ros_constr.constraint);
175 convert(constr_it->second, ros_constr.constraint);
178 ros_graph.constraints.push_back(ros_constr);
186 mrpt_msgs::NetworkOfPoses& ros_graph)
196 const mrpt_msgs::NetworkOfPoses& ros_graph,
204 typedef NetworkOfPoses::_nodes_type::_vec_type::const_iterator nodes_cit_t;
205 typedef NetworkOfPoses::_constraints_type::const_iterator constraints_cit_t;
208 mrpt_graph.
root = ros_graph.root;
211 for (nodes_cit_t nodes_cit = ros_graph.nodes.vec.begin();
212 nodes_cit != ros_graph.nodes.vec.end(); ++nodes_cit)
216 convert(nodes_cit->pose, mrpt_pose);
218 mrpt_graph.
nodes.insert(
219 make_pair(static_cast<TNodeID>(nodes_cit->nodeID), mrpt_pose));
223 for (constraints_cit_t constr_cit = ros_graph.constraints.begin();
224 constr_cit != ros_graph.constraints.end(); ++constr_cit)
227 auto constr_ends(make_pair(
228 static_cast<TNodeID>(constr_cit->nodeID_from),
229 static_cast<TNodeID>(constr_cit->nodeID_to)));
233 convert(constr_cit->constraint, mrpt_constr);
235 mrpt_graph.
edges.insert(make_pair(constr_ends, mrpt_constr));
244 const mrpt_msgs::NetworkOfPoses& ros_graph,
249 "Implement mrpt_msgs::NetworkOfPoses => CNetworkOfPoses3DInf " 254 const mrpt_msgs::NetworkOfPoses& ros_graph,
262 typedef NetworkOfPoses::_nodes_type::_vec_type::const_iterator nodes_cit_t;
263 typedef NetworkOfPoses::_constraints_type::const_iterator constraints_cit_t;
269 mrpt_graph.
root = ros_graph.root;
272 for (nodes_cit_t nodes_cit = ros_graph.nodes.vec.begin();
273 nodes_cit != ros_graph.nodes.vec.end(); ++nodes_cit)
275 mrpt_graph_pose_t mrpt_node;
278 convert(nodes_cit->pose, mrpt_node);
281 mrpt_node.agent_ID_str = nodes_cit->str_ID.data;
282 mrpt_node.nodeID_loc = nodes_cit->nodeID_loc;
284 mrpt_graph.
nodes.insert(
285 make_pair(static_cast<TNodeID>(nodes_cit->nodeID), mrpt_node));
289 for (constraints_cit_t constr_cit = ros_graph.constraints.begin();
290 constr_cit != ros_graph.constraints.end(); ++constr_cit)
293 auto constr_ends(make_pair(
294 static_cast<TNodeID>(constr_cit->nodeID_from),
295 static_cast<TNodeID>(constr_cit->nodeID_to)));
299 convert(constr_cit->constraint, mrpt_constr);
301 mrpt_graph.
edges.insert(make_pair(constr_ends, mrpt_constr));
310 mrpt_msgs::NetworkOfPoses& ros_graph,
mrpt::aligned_containers< TPairNodeIDs, edge_t >::multimap_t edges_map_t
#define THROW_EXCEPTION(msg)
void convert(mrpt_msgs::NetworkOfPoses &ros_graph, const mrpt::graphs::CNetworkOfPoses3DInf_NA &mrpt_graph)
MRPT_TODO("Modify ping to run on Windows + Test this")
bool edges_store_inverse_poses
File includes methods for converting CNetworkOfPoses*DInf <=> NetworkOfPoses message types...
void inverse(CPosePDF &o) const MRPT_OVERRIDE
edges_map_t::const_iterator const_iterator
mrpt::utils::TNodeID root