openroberta-lab icon indicating copy to clipboard operation
openroberta-lab copied to clipboard

Extract obstacles from an image

Open mbokeloh opened this issue 7 years ago • 1 comments

Hi everyone,

I wanted to follow up on the idea to pick a color in an uploaded image and transform all those pixels into obstacles.

Design:

  1. Add new button to simulator panel that shows the image and ask for a wall color using a color picker (this probably requires the upcoming change with the hamburger menu to allow more buttons) The button can also hide in the menu.

  2. Convert wall pixels into an obstacle representation, the "obstacle map".

  3. Find a free place in the map for the robot to place into. A hidden feature could be to hard-code one color to define the typical robot start position, but that's a detail.

  4. Loading a new map will clean up the obstacle representation and one needs to use the color picker dialog again.

Implementation plan:

  1. I would first refactor the collision detection and sensor logic out of scene.js into a separate module, if that is ok with you. I'm thinking along these lines:

Define a class ObstacleMap with three methods:

  • intersectsPoint(point) -> bool
  • intersectsBall(ball) -> bool
  • raycast(ray) -> closest intersection Point + distance I think with these methods, all the of logic in scene.js can be implemented.

Conceptually, this class represents everything that the robot can collide with.

  1. Next, I would extract the wall image using a fixed color when loading an image and add it to the obstacle map. The raycast method will simply march through the intersecting pixels.

  2. Finally, I would add the button to select the wall color and integrate the wall extraction into the simulator.

If that sounds ok to you, I would start implementing this feature now.

mbokeloh avatar Jun 26 '18 16:06 mbokeloh

@bjost2s what about this ticket. I still think this would be a nice feature?

ensonic avatar Apr 21 '19 14:04 ensonic