ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to properly mimic a bumper event?

asked 2015-03-11 11:06:47 -0600

BlitherPants gravatar image

updated 2015-03-18 13:32:36 -0600

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-18 13:31:26 -0600

BlitherPants gravatar image

updated 2015-03-18 13:34:02 -0600

After having stared at it for a while, I've come to the conclusion that, since the bumper2pointcloud is handled inside a nodelet (of which my understanding is mediocre at best), there isn't a good way of feeding it false bumper data. What I've done is combine both approaches:

I include the above code for publishing a bumper event so that the safety controller can back up. But also within that function I also create a PointCloud2 .24 meters in front of the robot and publish that to mobile_base/sensors/bumper_pointcloud. This has the effect of registering the fake bump as an obstacle in the costmap, and I can see it in RViz.

So far, what I have seems to work for my purpose, though I can't help but feel this is a rather haphazard way of doing things. Even though I have this marked as an answer for the sake of completeness, I'd love to see anyone else's opinion should they read this in the future. Thanks.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-03-11 11:06:47 -0600

Seen: 1,468 times

Last updated: Mar 18 '15