Skip to content

Making Maps for ROS from Tango

clakell edited this page Jun 20, 2014 · 6 revisions

The maps created by the device can also be converted simply into image files for a ROS environment. To accomplish this, the tutorial uses netfabb Basic. netfabb Basic was designed for 3D printing, but its slicing environment and cutting tools make it an ideal program to take a particular section of your scan. The robot only needs to know about the section that influences it: particularly, from the floor to the top of your robot. We will be selecting only this section to create a black and white map. First, open netfabb and import (Project -> Add Part) your merged file from earlier which is devoid of scattered particles. Because netfabb and MeshLab have different axis, you will need to select "Back" in the netfabb toolbar to get a top-down view. "Back" is the rightmost cube with a hidden orange face. On the right hand side is the "Cut" area along with vital information about your mesh. Use the cut slider labeled for the Y axis to find the "floor" of the mesh. The green lines identify the edges of the cut. You will need to bring the cutting plane up such that it intersects with the walls and all the objects in the room but not the floor itself. See these images for more detail:

This image shows the plane intersecting with the floor improperly.

intersection with floor

This image shows the cutting plane intersecting with the chair and the walls, but not the floor itself.

correct cutting

Press "Execute Cut" and then "Cut" in the lower right. Ignore the red warning sign if it comes up. You will not be using this mesh directly, so it does not matter if there are holes. Next, you will need to repeat the process to cut the top of the mesh. Find something in the mesh that is approximately equal to the height of your robot. For this map, it is the seat of the chair. Raise and lower the Y cutting plane until it just surpasses the height of the object. This does not need to be extremely exact. Again, press "Execute Cut" and then "Cut." Now you have the slice you need. In the "context area" above the Cut menu, click the little plus sign (+) next to "Parts" then again to the left of "Cuts of filename" and "Cuts of filename (Cut 1)" to see all the parts. Click the orange eye next to "filename (Cut 2)" and "filename (Cut 1) (Cut 1)." When finished, your context area should look like this:

context area

Make sure that the image you see on the left is the right piece. Zoom out so that you can see your entire map with about an inch of white space on all sides then go into Edit -> Save Screenshot and save it to your disk. Next use your favorite image editor (On Mac, Preview is enough) to bring Contrast up to 100%. In Preview, this is under Tools -> Adjust Color and dragging the contrast slider all the way to the right. In GIMP, this is under Tools -> Color Tools -> Brightness/Contrast. Almost all image editors have a contrast adjustment. Lastly, you can use a white paintbrush tool or elegant cropping to remove any leftover symbols (such as the red warning symbol) or floating pieces.

Here are some examples of complete maps using this approach: Kitchen Map Hall Map Smooth Hall Map Rough Hall Map Simple

Alternatively, for a more precise method you can use netfabb's slicing tool to select the correct layers. Import the original mesh and use the rotate tool to rotate the part around the X axis 90. Then, go into Extras -> Slice Selected Parts and pick a small layer size (0.01mm or so). Use the slider on the left of the Information menu (lower right) to find the bottom layer. Read the number labeled "Current Z Height" and write it down somewhere. Next, use the slider to find the top layer and record the new number. To return to the mesh, click on the filename in the Parts area of the context menu. In the "Cuts" area, type the first number you found into the box to the right of the "Z" slider and then press "Execute Cut" followed by "Cut." Repeat the process with the second number. This method is more precise because it is easier to see the outline of the slice. Complete the map the same way. The slicing images cannot be used directly because they do not contain the data from the layers above and below. Also notice that there is a grid which will interfere with ROS' system. Slicing area: one layer only