# Count number of collisions while navigating to goal

I have the navigation stack working in ROS Kinetic on my computer. In Stage ROS simulations, I can specify the goal and the robot navigates to it. I need to count the number of collisions (if any) that occurred as it traverses to the goal. How can I go about achieving this ?

Collisions with? If you have an occupancy map, then you can check with that and the robot's base_link. If the objects are static then just having their positions will be enough to check the collisions. It completely depends on the robot and the application.

• I apologize, should have made this clearer. I meant collisions with obstacles (both static and dynamic) and yes I am using an occupancy grid. How do you use it to check collisions? Aug 9, 2021 at 21:05
• Don't know quite about the dynamic obstacles but for static at every instant check for the occupancy grid at your robot's location, if the occupancy grid indicates an obstacle(above a certain threshold) then you can count it as a collision. If you want to avoid the obstacles then use this kind of approach.youtube.com/watch?v=JpKkfWxbqqg&t=195s . Here he uses pygame module which already has collision detection module. Aug 10, 2021 at 8:16
• That makes sense. thank you. Aug 11, 2021 at 20:37