UAV Package Delivery Obstacle Avoidance issue

7 views (last 30 days)
Hi, I am encountering an issue when trying to test the obstacle avoidance algorithm on a different scenario. I am using QGC connection for the trajectory and the quadcopter simply does not avoid all the obstacles, but only some of them. I've changed the safety distance, but without success. On QGroundControl, the quadcopter appears to "want" to avoid the obstacle, but it still follows the trajectory towards the landing point (see image)
I've tried to use a different obstacle but same thing happens - it avoided the red building, but went through the circular blue obstacle:
The lidar seems to be working fine. I would appreciate some help. Also, if I understood correctly from other questions on this forum, the project is designed for only one waypoint (i.e. take-off to landing)?
Many thanks in advance.
Tudor

Accepted Answer

Jianxin Sun
Jianxin Sun on 24 Jan 2023
Hi Tudor,
Here are a couple examples that might help you:
https://www.mathworks.com/help/uav/ug/uav-obstacle-avoidance-in-simulink.html shows how to setup a Simulink model that navigates through multiple waypoints while avoiding obstacles
https://www.mathworks.com/help/uav/ug/tune-3d-vector-field-histogram-controller-for-obstacle-avoidance-in-3d-scene.html shows how to tune the obstacle avoidance algorithm with the help from MATLAB visualization
Thanks,
Jianxin
  4 Comments
Tudor-Stefan Tonca
Tudor-Stefan Tonca on 28 Jan 2023
@Jianxin Sun, I'm currently working on changing the model such as it allows multiple waypoints within the obstacle avoidance guidance logic. I'm thinking that I need to somehow combine the guidance logic from Full Guidance Logic with the one from Obstacle Avoidance (compute InnerLoop Cmds), as per your answer. However, the MATLAB function contains this code:
function y = computeLPWaypoints(mission, Steer,UAVState)
%#codegen
Wp1 = [mission(1).position' mission(1).params(4)];
Wp2x = mission(2).position(1);
Wp2y = mission(2).position(2);
if(~isnan(Steer))
LAP_local = 6*[cos(Steer), sin(Steer)];
LAP = [ LAP_local(1)+ UAVState.x , LAP_local(2) + UAVState.y , -11 , Steer];
if(isnan(LAP(4)))
LAP(4) = 0;
end
y = [ Wp1(1,:) ; LAP ; Wp2x , Wp2y , 0 , Steer ];
DTD = sqrt( (LAP(1) - Wp2x)^2 + (LAP(2)-Wp2y)^2);
else
y = [ Wp1(1,:) ; UAVState.x , UAVState.y , UAVState.z-2 , 0 ; Wp2x , Wp2y , 0 , 0 ];
DTD = sqrt( (UAVState.x - Wp2x)^2 + (UAVState.y-Wp2y)^2);
end
if(DTD<5)
y = [ Wp1(1,:) ; Wp2x , Wp2y, -11 , 0 ; Wp2x , Wp2y , 0 , 0 ];
end
end
Are Wp1 and Wp2 the waypoints, therefore limiting the number of waypoints to 2? Would this code need to be changed to allow multiple waypoints?
I also noted that the GCSCmds signal which is sent to the waypoint follower has to be as per:
The Waypoints input accepts a set of waypoints as either an Nx3, Nx4, or Nx5 matrix, where N is the number of waypoints. Each row is an [x y z] position vector with optional yaw angle and transition radius for the UAV.
Many thanks.
Tudor

Sign in to comment.

More Answers (0)

Categories

Find more on UAV in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!