MRPT / mrpt

:zap: The Mobile Robot Programming Toolkit (MRPT)
https://docs.mrpt.org/reference/latest/
BSD 3-Clause "New" or "Revised" License
1.95k stars 631 forks source link

TP-Space navigation: include info for closest obstacles not only collisions #174

Closed jlblancoc closed 7 years ago

jlblancoc commented 8 years ago

Try to include that info into precomputed tables: it may take more memory, but may allow robots to navigate more correctly finding the middle of gaps (safer navigation).

jlblancoc commented 8 years ago

More details on what is to be done here:

tpspace_scheme

chatrasen commented 8 years ago

@jlblancoc In the previous LUT we are storing the (a,d) pair which make the robot land in that cell starting from the position (0,0) right?

And in the new LUT that we want to design, we will have to simulate trajectories from the cell we are storing information in and then find the minimum clearance? Is that what we have to do? If wrong, please correct me.

jlblancoc commented 8 years ago

The previous LUT is built in mrpt::nav::build_PTG_collision_grids(). In this code it can be seen how an entry is added to the LUT only when the shape of the robot collides with the cell... which may be quite different that the robot origin (the local 0,0 coordinats on the vehicle) reaches that cell ;-)

The new code might be incorporated inside build_PTG_collision_grids() as well, probably reusing all the outer loops. The missing part is evaluating the minimum distance from (obs_x,obs_y) to the robot polygon. May need to use geometry functions in mrpt::math.

chatrasen commented 8 years ago

@jlblancoc Thanks, got my first doubt cleared.

For the new LUT, what you mean to say is, inside the same if as you mentioned in the above code, store the minimum distance from (obs_x, obs_y) corresponding to the (a,d) pair and keep rest of the code as it is, right?

dheerajgattupalli commented 8 years ago

@chatrasen I dont think we can write it inside the if condition...

For each obstacle point we have to compute the distance from all points on the robot polygon to obstacle point and save the minimum a,d.. so this part should be written outside the if condition.. @jlblancoc correct me if i am wrong anywhere

jlblancoc commented 8 years ago

@dheerajgattupalli is right, the new code should go outside of the if However, note that the closest distance may lie in the middle of a segment, so checking for vertices should not be enough. Hint: TSegment2D::distance()

Also, remember that to avoid excessive memory usage, clearance should not be evaluated for all d values (n for loop)...

chatrasen commented 8 years ago

@dheerajgattupalli why are the npoints obstacle points? They have just been simulated from the trajectory.

dheerajgattupalli commented 8 years ago

@chatrasen true npoints are points from trajectory not obstacle points ... i edited my comment :-)

jlblancoc commented 8 years ago

Thank you @chatrasen for your great contribution in Pull request #202 !! I just marked as done the first 3 checkboxes above. However, there are some small issues that should improved as added in code comments in the PR. It would be great if you or someone else could go on with this line, otherwise it will be addressed in the future, no worries...

chatrasen commented 8 years ago

@jlblancoc The CReactiveNavigationSystem::STEP3_WSpaceToTPSpace() function in this link takes in one parameter as the vector of minimum distance of the obstacle for various alphas. To incorporate the clearance grid, should I use a pair inside the vector or create a new vector for this purpose. Because using a pair will change the code a lot for the existing users I guess though it is convenient for a new user

jlblancoc commented 8 years ago

Good point @chatrasen ! Indeed, that part must be changed... I guess that it should be worth changing it to make it "right" and more maintainable in the future: one new struct could be created (instead of a pair, because we have a pair for now, but who knows in the future?) and use a vector of that struct.

chatrasen commented 8 years ago

Yea right, this would be take care of any possible changes in future. Will be working on this soon. Presently working on the GSoC apllication :P

jlblancoc commented 8 years ago

Sure! First is first ;-)