Let's Make Robots!

Walter's new Navigation System (May I / Can I Go)

So here we go... I have been sick of "regular" navigation for quite a while now (more than a year now). The whole idea of "just keep going and if there is something there, react to it" is just not doing it for me any more. For the last year or so, I have been thinking about and working on a new system of "may I go". The theory is basic: Before you start going somewhere, check that there is somewhere to go! In the system I am using now, a 180 degree scan is performed and the sonar readings and angle is sent to processing. From there, paths are determined and the "best path" is chosen from all the available paths. As we sit now, the system is a follows:

Whole scan

Find "sections" or paths

Tell me how many "available" paths there are.

Weed out the "paths" that are not wide enough for Walter to fit through

(in this version of the code) Pick the widest one

Find the center of this "widest path", figure out how far to turn to get to this heading

Turn there and go!

 

Now, I can add as many options as I want as to what path to choose and why. Also there can be more weeding-out as well, i.e. ignore all paths that are wicked close, etc. Now that I have the basic system down, I can expand almost endlessly.

Please watch the video as it explains quite a bit.

Here is my data:

And the numbers:

Now, when you see the first arrays, the ones with all the raw distance numbers, you will see that the widest paths don't have the most numbers of readings in them. --I have no idea why. The final data I am getting is all coming out clean as a whistle so the funny numbers must be a problem with how I am writing to the arrays in the first place. Again, I don't know and I am not going to look to far into this as the final numbers are spot-on.

Index 1 Contains Array: [172.64, 172.64, 172.37999, 172.37999, 171.86, 171.86, ]

Index 2 Contains Array: [172.64, 172.64, 172.37999, 172.37999, 171.86, 171.86, 150.41, 150.41, 149.11, 149.11, 148.33, 148.33, 140.53001, 140.53001, 138.58, 138.58, 138.44998, 138.44998, 137.8, 137.8, 137.15, 137.15, 137.15, 137.15, 137.28001, 137.28001, 137.28001, 137.28001, 137.15, 137.15, 137.67, 137.67, ]

Index 3 Contains Array: [172.64, 172.64, 172.37999, 172.37999, 171.86, 171.86, 150.41, 150.41, 149.11, 149.11, 148.33, 148.33, 140.53001, 140.53001, 138.58, 138.58, 138.44998, 138.44998, 137.8, 137.8, 137.15, 137.15, 137.15, 137.15, 137.28001, 137.28001, 137.28001, 137.28001, 137.15, 137.15, 137.67, 137.67, 158.34, 158.34, 137.93, 137.93, 137.93, 137.93, ]

Index 4 Contains Array: [172.64, 172.64, 172.37999, 172.37999, 171.86, 171.86, 150.41, 150.41, 149.11, 149.11, 148.33, 148.33, 140.53001, 140.53001, 138.58, 138.58, 138.44998, 138.44998, 137.8, 137.8, 137.15, 137.15, 137.15, 137.15, 137.28001, 137.28001, 137.28001, 137.28001, 137.15, 137.15, 137.67, 137.67, 158.34, 158.34, 137.93, 137.93, 137.93, 137.93, 101.4, 101.4, 100.1, 100.1, 96.85, 96.85, 96.07, 96.07, 95.42, 95.42, 89.57, 89.57, 96.2, 96.2, 98.28, 98.28, 98.409996, 98.409996, 101.009995, 101.009995, ]

Index 5 Contains Array: [172.64, 172.64, 172.37999, 172.37999, 171.86, 171.86, 150.41, 150.41, 149.11, 149.11, 148.33, 148.33, 140.53001, 140.53001, 138.58, 138.58, 138.44998, 138.44998, 137.8, 137.8, 137.15, 137.15, 137.15, 137.15, 137.28001, 137.28001, 137.28001, 137.28001, 137.15, 137.15, 137.67, 137.67, 158.34, 158.34, 137.93, 137.93, 137.93, 137.93, 101.4, 101.4, 100.1, 100.1, 96.85, 96.85, 96.07, 96.07, 95.42, 95.42, 89.57, 89.57, 96.2, 96.2, 98.28, 98.28, 98.409996, 98.409996, 101.009995, 101.009995, 120.899994, 120.899994, 121.03001, 121.03001, 122.329994, 122.329994, 123.11, 123.11, 124.409996, 124.409996, 124.409996, 124.409996, 117.39, 117.39, 117.39, 117.39, ]

Index 6 Contains Array: [172.64, 172.64, 172.37999, 172.37999, 171.86, 171.86, 150.41, 150.41, 149.11, 149.11, 148.33, 148.33, 140.53001, 140.53001, 138.58, 138.58, 138.44998, 138.44998, 137.8, 137.8, 137.15, 137.15, 137.15, 137.15, 137.28001, 137.28001, 137.28001, 137.28001, 137.15, 137.15, 137.67, 137.67, 158.34, 158.34, 137.93, 137.93, 137.93, 137.93, 101.4, 101.4, 100.1, 100.1, 96.85, 96.85, 96.07, 96.07, 95.42, 95.42, 89.57, 89.57, 96.2, 96.2, 98.28, 98.28, 98.409996, 98.409996, 101.009995, 101.009995, 120.899994, 120.899994, 121.03001, 121.03001, 122.329994, 122.329994, 123.11, 123.11, 124.409996, 124.409996, 124.409996, 124.409996, 117.39, 117.39, 117.39, 117.39, 99.06, 99.06, 98.28, 98.28, 91.78, 91.78, 89.829994, 89.829994, 89.7, 89.7, 89.7, 89.7, 89.7, ]

Total Number of Available Paths : 6
Path Number 1 Last ray number for that path : 7
Path Number 2 Last ray number for that path : 33
Path Number 3 Last ray number for that path : 39
Path Number 4 Last ray number for that path : 59
Path Number 5 Last ray number for that path : 75
Path Number 6 Last ray number for that path : 88


Path Number 1 Width 7
Path Number 2 Width 26
Path Number 3 Width 6
Path Number 4 Width 20
Path Number 5 Width 16
Path Number 6 Width 13

Path Number 2 is a wide enough path
Path Number 4 is a wide enough path
Path Number 5 is a wide enough path

The Widest Path Available is Path Number 2

Chosen heading is 40 degrees from left edge

AttachmentSize
Screen_Grab_Sonar_Radar_Thing_w_numbers.JPG133.44 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

When deciding which path is wide enough for walter to drive through - are you multiplying out to calculate the actual physical width of the path?

In case you've not yet considered it (and to state the bleeding obvious), the further away a reflecting surface is, the smaller the angle it subtends.

Path three is 6 rays wide, but it also looks half as far again from walter as does path 5, so if it were at the same distance as path 5, it would be 9 rays degrees wide? - okay this might still not be wide enough for walter, but the point is that further-away surfaces subtend smaller numbers of rays, so choosing a path based only on the number of rays might not give you the full answer.

I think the calculation for converting to from angle and distance to physical width is something like S=R(radians)*D, where S is the physical width of the path, R is the number of rays (converted into radians i.e for 2-degree-wide rays, 1 ray = 2*pi/180), and D is the physical distance from walter.

 

 

You mentioned at about 8 minutes being able to find the widest path and then halving and adding the the end of the previous path. Would it not be easier to halve the widest subtract it from its max and then find out where that is from 90 degrees?

interesting video and analysis.   the problem you mentioned - writing previous data to next array -  sounds like an index confusion problem, such as 0 is the 1st, while 1 is the 2nd, and 2 is the 3rd, etc.  and somewhere in your processing your loosing track of the indexes and which array you intend on loading, etc.

I figured out the array list problems. It seems I am writing all the previous data into each next array. I have no idea why this is happening. Hmmmm.