UAVPathManagerBus issue in the 3D Obstacle Avoidance UAV Package delivery
Hi,
I’m trying to modify the UAV Package Delivery project such as it allows multiple waypoints while avoiding obstacles, using QGroundConrol. Until now I have done these:
-modified replaced FollowWaypoints with the guidance from FullGuidanceLogic
However, MissionData input must be bus signal "uavPathManagerBus"
Currently, the MissionData comes from the function that contains the OA algorithm:
function [y, DTD, needHover] = computeLPWaypoints(mission, Steer,UAVState)
%#codegen
Wp1 = [mission(1).position’ mission(1).params(4)];
Wp2x = mission(2).position(1);
Wp2y = mission(2).position(2);
needHover = false;
% Follow obstacle avoidance steer direction when UAV is above 5 meters
% above ground
if (~any(isnan(Steer)) && (UAVState.z < -5))
if (Steer(5) == 0)
% Compute look ahead point 6 meters along the steering direction
LAP_local = 6*Steer(2:4)’;
% Follow yaw command from obstacle avoidance
yaw = Steer(1);
LAP = [LAP_local yaw] + [UAVState.x, UAVState.y, UAVState.z, 0];
if(isnan(LAP(4)))
LAP(4) = 0;
end
y = [ Wp1(1,:) ; LAP ; Wp2x , Wp2y , 0 , LAP(4) ];
DTD = norm([Wp2x Wp2y] – LAP(1:2));
else
% Rotate in place
y = [ Wp1(1,:) ; UAVState.x, UAVState.y, UAVState.z Steer(1); Wp2x , Wp2y , 0 , Steer(1) ];
DTD = norm([Wp2x Wp2y] – [UAVState.x, UAVState.y]);
needHover = true;
end
else
% If there is no good steer direction or UAV is too low, fly up
y = [ Wp1(1,:) ; UAVState.x , UAVState.y , UAVState.z-2 , 0 ; Wp2x , Wp2y , 0 , 0 ];
DTD = norm([Wp2x Wp2y] – [UAVState.x, UAVState.y]);
end
if(DTD<5)
% When close to target point, switch to landing
y = [ Wp1(1,:) ; Wp2x , Wp2y, -11 , 0 ; Wp2x , Wp2y , -1 , 0 ];
end
end
I get this obvious error when I try to run the simulation:
I have tried sending the sigal from the GCS dirrectly into the MissionData (as expected), but then the quadcopter just flies back and forth around the first waypoint of the mission:
I would very much appreciate any advice on how to move further with this.
Regards,
TudorHi,
I’m trying to modify the UAV Package Delivery project such as it allows multiple waypoints while avoiding obstacles, using QGroundConrol. Until now I have done these:
-modified replaced FollowWaypoints with the guidance from FullGuidanceLogic
However, MissionData input must be bus signal "uavPathManagerBus"
Currently, the MissionData comes from the function that contains the OA algorithm:
function [y, DTD, needHover] = computeLPWaypoints(mission, Steer,UAVState)
%#codegen
Wp1 = [mission(1).position’ mission(1).params(4)];
Wp2x = mission(2).position(1);
Wp2y = mission(2).position(2);
needHover = false;
% Follow obstacle avoidance steer direction when UAV is above 5 meters
% above ground
if (~any(isnan(Steer)) && (UAVState.z < -5))
if (Steer(5) == 0)
% Compute look ahead point 6 meters along the steering direction
LAP_local = 6*Steer(2:4)’;
% Follow yaw command from obstacle avoidance
yaw = Steer(1);
LAP = [LAP_local yaw] + [UAVState.x, UAVState.y, UAVState.z, 0];
if(isnan(LAP(4)))
LAP(4) = 0;
end
y = [ Wp1(1,:) ; LAP ; Wp2x , Wp2y , 0 , LAP(4) ];
DTD = norm([Wp2x Wp2y] – LAP(1:2));
else
% Rotate in place
y = [ Wp1(1,:) ; UAVState.x, UAVState.y, UAVState.z Steer(1); Wp2x , Wp2y , 0 , Steer(1) ];
DTD = norm([Wp2x Wp2y] – [UAVState.x, UAVState.y]);
needHover = true;
end
else
% If there is no good steer direction or UAV is too low, fly up
y = [ Wp1(1,:) ; UAVState.x , UAVState.y , UAVState.z-2 , 0 ; Wp2x , Wp2y , 0 , 0 ];
DTD = norm([Wp2x Wp2y] – [UAVState.x, UAVState.y]);
end
if(DTD<5)
% When close to target point, switch to landing
y = [ Wp1(1,:) ; Wp2x , Wp2y, -11 , 0 ; Wp2x , Wp2y , -1 , 0 ];
end
end
I get this obvious error when I try to run the simulation:
I have tried sending the sigal from the GCS dirrectly into the MissionData (as expected), but then the quadcopter just flies back and forth around the first waypoint of the mission:
I would very much appreciate any advice on how to move further with this.
Regards,
Tudor Hi,
I’m trying to modify the UAV Package Delivery project such as it allows multiple waypoints while avoiding obstacles, using QGroundConrol. Until now I have done these:
-modified replaced FollowWaypoints with the guidance from FullGuidanceLogic
However, MissionData input must be bus signal "uavPathManagerBus"
Currently, the MissionData comes from the function that contains the OA algorithm:
function [y, DTD, needHover] = computeLPWaypoints(mission, Steer,UAVState)
%#codegen
Wp1 = [mission(1).position’ mission(1).params(4)];
Wp2x = mission(2).position(1);
Wp2y = mission(2).position(2);
needHover = false;
% Follow obstacle avoidance steer direction when UAV is above 5 meters
% above ground
if (~any(isnan(Steer)) && (UAVState.z < -5))
if (Steer(5) == 0)
% Compute look ahead point 6 meters along the steering direction
LAP_local = 6*Steer(2:4)’;
% Follow yaw command from obstacle avoidance
yaw = Steer(1);
LAP = [LAP_local yaw] + [UAVState.x, UAVState.y, UAVState.z, 0];
if(isnan(LAP(4)))
LAP(4) = 0;
end
y = [ Wp1(1,:) ; LAP ; Wp2x , Wp2y , 0 , LAP(4) ];
DTD = norm([Wp2x Wp2y] – LAP(1:2));
else
% Rotate in place
y = [ Wp1(1,:) ; UAVState.x, UAVState.y, UAVState.z Steer(1); Wp2x , Wp2y , 0 , Steer(1) ];
DTD = norm([Wp2x Wp2y] – [UAVState.x, UAVState.y]);
needHover = true;
end
else
% If there is no good steer direction or UAV is too low, fly up
y = [ Wp1(1,:) ; UAVState.x , UAVState.y , UAVState.z-2 , 0 ; Wp2x , Wp2y , 0 , 0 ];
DTD = norm([Wp2x Wp2y] – [UAVState.x, UAVState.y]);
end
if(DTD<5)
% When close to target point, switch to landing
y = [ Wp1(1,:) ; Wp2x , Wp2y, -11 , 0 ; Wp2x , Wp2y , -1 , 0 ];
end
end
I get this obvious error when I try to run the simulation:
I have tried sending the sigal from the GCS dirrectly into the MissionData (as expected), but then the quadcopter just flies back and forth around the first waypoint of the mission:
I would very much appreciate any advice on how to move further with this.
Regards,
Tudor uav, uav package delivery, bus, embedded matlab function, matlab function, signal, obstacle avoidance, uav toolbox MATLAB Answers — New Questions