I am pretty new to lejos class but currently i wanted to do some navigation on a grid map in which the robot is only allowed to move up,down,left and right while following a black line.
From the lejos api, I found classes like lineMap, fourwaygridmesh, astar algorithm, pathfinder and so on. I think if i implement all this together would get the result i want however the documentations or examples for all this is quite limited.
I just want to know how can i implement all this together?
Here is what i found out so far, in order to use fourwaygrid mesh i would need a linemap.
If my map is a gridmap, How should i implement linemap for such a scenario?
For the path, I would want to be able to set the starting point and ending point and the algorithm would help to calculate the shortest path to the ending point. How should i combine everything together?
This are the codes i have so far, can someone advise on what i need to do to implement the grid map?
- Code: Select all
lejos.geom.Rectangle bounds = new Rectangle(50, 60, 300, 300);
LineMap myMap = new LineMap(lines, bounds);
FourWayGridMesh grid = new FourWayGridMesh(myMap, 50, 0);
AstarSearchAlgorithm alg = new AstarSearchAlgorithm();
NodePathFinder pf = new NodePathFinder(alg,grid);
Thanks in advance.