Good evening,
I am trying to generalize the histogram filter localization to discrete environments of arbitrary dimensionality. Even though at this point working with numpy would probably be the best choice, I would like to stick to certain constraints of an assignment which itself got me started with this whole 2D- to higher-dimensional-capability thing.
For a start, I chose a cubic environment (each segment labelled from 1 to 27):
debug = [[['1', '2', '3'],
['4', '5', '6'],
['7', '8', '9']],
[['10', '11', '12'],
['13', '14', '15'],
['16', '17', '18']],
[['19', '20', '21'],
['22', '23', '24'],
['25', '26', '27']]]
During histogram localization a robot first moves and subsequently measures an input which helps gathering information about where the robot itself is residing. In my limited discrete 3D-cube-environment, my robot can fly up/down, move left/right and go forward/backward. Each time I need to perform an update alongside the robots movement direction (i.e. alter probability of residing in a certain segment).
Moving Forward/Backward would mean altering the rows {1,10,19},{2,11,20},{3,12,21},… and so on, while going left/right would mean altering the rows {1,2,3},{4,5,6},{7,8,9},… Ultimately, going up and down would mean altering {1,4,7},…
So this is where I am, with relatively limited basic python knowledge, I found myself in struggle with generalizing from 2- to 3D – however would even like it to work for higher dimensional environments. Any ideas on what to do next? Are there fancy ways to transform given lists of lists such that updates as described previously would become a straightforward task (if they are not already)?
Thanks everyone!
Don’t use a list of lists, using a
numpy.ndarraywill make things much easier for the fancy indexing/slicing/transformations you need.