Salvatore Lubertino asked . 2023-05-18

How can I implement an HybridA* Path Planning from a specific Map?

I have a problem in the Plan using the HybridA* while for what concerns the case of a RRT Path planning, I have no problem to run the script.
 
I don't know why the different Path Planning can create this error.
 
load("VI_Track_map.mat");
figure
show(VI_Track_map)
grid on
%% HybridA* Path Planning 
clear validator;
validator = validatorOccupancyMap;
validator.Map = VI_Track_map;
validator.ValidationDistance = 100;
planner = plannerHybridAStar(validator,'MinTurningRadius',20,'MotionPrimitiveLength',20);
figure
show(planner)
start = [7100 7100 0];
goal = [7500 7100 0];
show(planner,"Tree","off")
hold on
%% RRT Path Planning
ss=stateSpaceSE2;
sv=validatorOccupancyMap(ss);
sv.Map=VI_Track_map;
sv.ValidationDistance=30;
ss.StateBounds=[VI_Track_map.XWorldLimits; VI_Track_map.YWorldLimits; [-pi/2 pi/2]];
planner1=plannerRRT(ss,sv);
planner1.MaxConnectionDistance=80;
rng(10000,'twister');
start = [7100 7100 0];
goal = [7500 7100 0];
[pathObj,solnInfo]=plan(planner1,start,goal);
show(VI_Track_map)
hold on
plot(start(1),start(2),'*');
plot(goal(1),goal(2),'*');
plot(solnInfo.TreeData(:,1),solnInfo.TreeData(:,2),'b.-'); % tree expansion
plot(pathObj.States(:,1),pathObj.States(:,2),'r-','LineWidth',2) % draw path

 

MATLAB , Navigation Toolbox , path planning , navigation tool

Expert Answer

John Williams answered . 2024-05-17 19:51:59

There appear to be quite a few small issues with the script, so let's address them step-by-step:

 

%% HybridA* Path Planning
1) The plannerHybridAStar object has been created and configured, but the script never calls the plan method.
That explains the lack of a tree/path when you call the show method.
 
 
2) If you do call path = plan(planner,start,goal) using the hybridA* planner, you should find that your validatorOccupancyMap throws an error saying that the start-state is invalid.
 
3) The reason for the invalid start-state is that the validator has been configured with no inputs, meaning it contains a default stateSpaceSE2 object in the StateSpace property. plannerHybridAStar's validator uses the state-space to determine whether states passed by the planner are in-/out-of-bounds. With the default StateBounds = [-100 100; -100 100; -pi pi], your hybridA* planner will not be capable of generating a plan for the current start/goal, so these should be updated (similar to what you've done in the RRT section).
 
4) The ValidationDistance on your hybridA* planner is currently set to 100, which is 5x longer than your primitive length (20). It is important to remember that ValidationDistance is effectively the distance between points sampled/validated along edges in your tree, so if this value is too large you run the risk of your planner jumping through obstacles. For your problem, a ValidationDistance=1 (or lower) is more appropriate.
 
5) Lastly, you should carefully consider the relationship between your MinTurningRadius and MotionPrimitiveLength. Right now they are both set to 20, which means the planner will need to add a large number of nodes to explore the space (around 3 nodes to carry out a 90-degree turn using the sharpest motion-primitive). For the problem you've shown here, that may actually be fine, but you should keep these thoughts in mind as you tune your planner or work out different problems.
 
 
%% RRT Path Planning
Unlike the plannerHybridAStar planner, whose edges between nodes are defined/shaped by the planner object itself, RRT-style planners in the Navigation Toolbox rely on the nav.StateSpace object to define the shape of edges between nodes in the RRT tree (see Plan Mobile Robot Paths Using RRT for an example of how the state-space affects the planner).
For your purposes, your plannerRRT object should really be using either the stateSpaceDubins or stateSpaceReedsShepp state-spaces, or you could create you own.
 
Aside from that, here are two final suggestions:
 
1) I would suggest using plannerRRTStar rather than plannerRRT, as it will generate smoother, more-optimal paths.
 
 
2) If you have access to R2022a, you might benefit from the new optimizePath feature. This is a map-aware optimizer which can improve the path results generated by your RRT/hybridA* planner. See Optimization Based Path Smoothing for Autonomous Vehicles for an example on how this can be used.


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.