How to properly mimic a bumper event?
Hi,
I'm using a Turtlebot 2 with ROS Hydro. I'm writing an autonomous drive application that uses a hybrid of directly-published velocity commands and move_base goals at different times. I use the AMCL demo for localization.
During some points when I'm simply sending velocity commands for the bot to drive forward, it will hit something nasty in such a way that neither the laser nor the bumper will recognize it as an obstacle. The robot will then sit there pushing up against the object.
Thus, I've written code to note when the robot doesn't appear to have traveled, so it can deduce when it's stuck. If it believes it's stuck, I then have it raise a bumper event with the following:
void RaiseBumperEvent(void)
{
kobuki_msgs::BumperEvent msg;
msg.bumper = 1;
msg.state = 1;
bump_pub_.publish(msg);
ros::Duration(.5).sleep();
msg.bumper = 1;
msg.state = 0;
bump_pub_.publish(msg);
}
Here, bump_pub_ publishes directly to mobile_base/events/bumper
. At first glance, this seems to work great; when the robot gets stuck, the event gets raised, and the kobuki safety controller backs the robot up.
But I've noticed something; when I check the local costmap in RViz, the obstacle doesn't get inserted on the costmap like it would if I physically kicked the bumper.
How do I mimic this behavior? It looks like the costmap inserts the obstacle based on the output of bumper2pointcloud (topic mobile_base/sensors/bumper_pointcloud
), but I would have thought bumper2pointcloud picked up its input from mobile_base/events/bumper
? If not that topic, then where would it get it from? Using rosnode info on the b2p nodelet doesn't give me any obvious clues.
I suppose I could also have my program publish a PointCloud2 directly to the mobile_base/sensors/bumper_pointcloud
topic, but I would much rather mimic a bumper hit that bumper2pointcloud can interpret on its own.
Any ideas? Thanks!