set initialpose for AMCL in code
Hi all
I followed the rviz source code 2D Pose Estimate which is the below function to set initialpose for AMCL in my own code.
void InitialPoseTool::onPoseSet(double x, double y, double theta)
It worked in publishing a single message to the topic initialpose. However this was not able to set the pose of the robot, because in rviz the pose of the robot never changed to the new one and in the console there also had not been showing any message like "[ROS_INFO] setting the robot pose to ..." as usual when we used the rviz 2D Pose Estimate tool.
But I finally made it work by using the latched ros publisher rather than the normal publisher
ros::Publisher advertise(const std::string& topic, uint32_t queue_size, bool latch = true)
The question I want to raise here is why the normal publisher without latch could work in rviz while I have to use the latched version to publish the message to set the pose?
Thanks all.