# Occupancy Grid Programming Help.

With much help and inspiration from Gareth and Grog (and others) I have a working Lidar (wiicamera and laser) system. Currently, I am using a very low power laser (while checking the mail everyday for the good laser to show up) and getting about 16" of range. For now during testing this is just fine. Everything is just in a smaller scale, but proportionally, everything is equal.

I am taking one distance measurement every degree in a 180 degree sweep. This array of 180 distances is sent off to processing via BT. Thank you rik for help with the processing code --and oldie but a goodie, dusted off and still working great. I start with a small circle in the center of the screen, this shows the location of the camera. From this point, we have 180 imaginary "rays" going out 1 degree apart. On each of these rays we place a dot. The dot's distance from the center is the same as the corresponding distance as read by the lidar. We draw all the dots. We connect each one with a line, and we get this:

Anywhere the line changes from blue to red (or vice versa) there has been a change in distance (between 2 adjacent points) and that change is above a given threashold. We can consider this an "edge". From one "edge" to another can be considered a "path" in that we would never drive into the corner or "edge" of anything. Zip through all the arrays of distances and angles and paths and "paths that are wide enough to fit through" and you end up with walter picking the path that is furthest away and one that he can physically fit through. We could also use this same data to find the longest "blind corner" which would be the one he would be most "curious" about. Or we could go to the closest to "investigate".etc... etc... Basically, we end up with a bunch of arrays of data, we can go through them in different ways with different criteria and chose a given path among many available ones.

Whew... Man Chris, you gunna ask a question any time soon?

I want to start exploring the idea of occupancy grids. I am gaining much inspiration from this.

Now, I have got the very basic idea here, if you look at the picture above, you see basically a 1/2 circle. This circle jets in and out but it does start at the left and continues to the right and it is a continous line. How do I code the simple idea of everything in the circle is clear, everything out of the circle we don't know about yet? I can draw a grid, I can associate an array with it --no problem. But how do I say, "If there is a peice of a line or a dot or pixel at these coordinates, change the coresponding array location to 1"? Or, "draw an imaginary line between every point and the center and any part of the grid that touches that line, change the array value to 1". Moreso, I would also need to move the center dot as walter moves to a new location on the grid. Actually, now that I think about it, that's a simple thing to do in processing. I got that one. Focus.

I think this would be similar to a video game and how characters would interact with walls and objects. Maybe I should draw a line from the center to each point --draw each ray-- Man, I got nuthin' here... I don't even know how to begin thinking about the problem...

Go easy on me.

## Comment viewing options

Why does hardware have to always come around, and stick its big, non-working nose into everything? Yup, I lost a motor driver last night. Funny --everything was super-duper A-OK and then all of a sudden, nothing. A little diagnostics later and i find it was the onboard arduino brain itself that died. Little heat gun work (and a new 328) and it seems that i am back in the ball game. However, it looks like I have a day of re-tweeking my current and volt sensors and getting this guy back to 100%.

Lost one day --pretty minor.

Hopefully driving forward and taking readings tomorrow.

You replaced the uC on your Wild Thumper Controller? Wow, you've got guts!

rik, you could not be more correct...

I didnt wanna, I had never done it before and all I had was the kind of heat gun you would use to strip paint. I was scared shitless. To be honest, it was a LOT better than I thought it would have been. Lifting the old chip off was pretty straight forward: Keep the heat moving and keep tapping the chip with some tweezers. It eventually moved a little, I grabbed it and pulled it off. I did a little tidy-tidy on the pads, tried to "prep" them with some fresh solder and went on to flooding/wicking the new chip. --That was really the hard part.

As we all know, solder wick works worst with small amounts of solder. I mean, you gotta have more stuff to capillary so the capillary action keeps capillaring. I found that it helps to "pre-soak" the braid a little bit and be sure the tip of the iron stays wet with solder (for heat transfer). Took some patience but i got it done.

My heart was pounding the whole time. --Literally.