Publishing map->odom transform using custom localization and SLAM algorithms
I am writing my own FastSLAM and Monte-Carlo localization algorithms and I am trying to figure out how to calculate the map->odom transform. From what I understand, my SLAM and localization algorithm will give the transform from the map frame to the base_link frame when given odometry data calculated in the odom frame. I have seen that AMCL and Gmapping publish the transform from the odom frame to the map frame, but I am not sure of how to calculate this once I have the map to base_link transform from the SLAM or localization algorithm.
Would I assume that the transform from the odometry data is "correct", create transformation matrices for T_(map->base_link) and T_(odom->base_link) and then say:
T_(map->odom) = T_(map->base_link) * T_(odom->base_link)^-1