Robot bumper sensor modeling advice?

User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

Robot bumper sensor modeling advice?

Post by ejtttje »

Our simulator intends to run several different kinds of robots, but I'm starting with the simplest, an iRobot Create.

The half disc on the front of the robot is a large bumper. I believe they have two contact sensors: one on the left and one on the right. When it hits the front, the whole bumper slides back and hits both contacts, which then reports that the "center" bumper sensor is pressed. (so only one of left, center, right is ever active...)

I'm wondering how more experienced users would model this:
  • The expensive option would be to treat the bumper as a separate collision shape and try to replicate the bumper mechanism in the simualtion, and then report a contact when the joint(s) in the mechanism are pushed to min/max.
  • Another option would be to use a separate collision-only trimesh for each left-right-center region and fire the corresponding sensor when a contact is reported. (or perhaps implement as boolean operations on primitive collision shapes, like colliding with both a cylinder of the body, and a box offset to one side or the other)
  • A third option would be to do a series of raycasts on each physics tic emulating a scanning laser rangefinder but only reporting if the minimum is under a threshold.
  • Combining the previous two, I could place a series of collision shapes along the boundary of each bumper region, i.e. a necklace of spheres along the bumper. (aside: am I correct in assuming that the sphere shape has the fastest collision detection for situations where you want to check clearance of a small region but don't necessarily care about the exact shape?)
  • A fifth option would be to register a collision callback on the robot body itself, and then map the location of the contact point into one of sensors (or of course none if it hit the backside while going in reverse...)
I'm sure there's some boundary area where the direction of the contact force would affect which sensor gets triggered, but I'm not going to try to perfectly model the mechanism. Quick execution time and ease of implementation seem to be the main criteria.

So, if you were in the same situation, what would you do?