A path planner for an n-link planar robot arm moving among polygonal obstacles (or point obstacles).
Video overview at https://youtu.be/xqTdsxyIths The video uses workspace potential fields that attract the origins of the DH frames to their goal locations while avoiding obstacles. The robot is blue, the goal configuration is green. The attractive forces to the goal are drawn with green arrows. The obstacles (red) are point lasers which the robot must avoid. When the robot is within the avoidance region (pink) of an obstacle it experiences repulsive forces (blue arrows). The shortest distance from each obstacle to each link is drawn in magenta.
Simply set the input parameter "choice" to run preset demos, or modify the demos for your needs:
if choice == 2, "two-link robot that gets stuck in a local minimum and must do a random walk to escape"
elseif choice == 3, "This local minimum is very deep, requiring a LONG random walk to escape. It doesn't always escape (SOMETIMES IT IS STUCK FOREVER)."
elseif choice == 4, "polygonal obstacles, does hit a local minimum, but usually escapes quickly"
elseif choice == 5, " 4-link robot, polygonal obstacles, has 'chatter' that makes it take time to settle"
Based off chapter 5.2 in "Robot Modeling and Control" by Spong, Hutchinson, and Vidyasagar
Aaron T. Becker, 04-13-2016 -- 11/14/2019, firstname.lastname@example.org This solution uses code by Mary Burbage, MS 2017.
Aaron T. Becker's Robot Swarm Lab (2022). Robot Arm Potential Field Navigation (https://www.mathworks.com/matlabcentral/fileexchange/73617-robot-arm-potential-field-navigation), MATLAB Central File Exchange.