Question: drone starts to shake if the altitude is over 50m
Hi, Version: Airsim 1.2.0, binary. Control: call moveOnPathSync with default setting but assigned waypoints. Problem: looks fine if the altitude is lower than 50m. However, if I tried to fly along the same path with an altitude over 60m, the drone started to shake. Does anyone have an idea about this abnormal phenomenon?
I faced the same problem with moveToPositionAsync() when the drone flies over or around a certain height. But I have no idea about this.
I faced the same problem with moveToPositionAsync() when the drone flies over or around a certain height. But I have no idea about this.
It seems quite strange. Could the aerial dynamics constraints be the reason? I added gimbal, so the footage you will get is ok. But the drone's attitude is a mass...
Could you please provide the sample code to reproduce this? I'm guessing your speed is too high.
Could you please provide the sample code to reproduce this? I'm guessing your speed is too high. Sure.
path = []
x0 = 0
y0 = 0
z0 = -self.lalti
l = self.length
w = self.stripewidth
dalti = self.lalti - self.halti;
offsets = [[0,l,0],\
[-w,l,0],\
[-w,0,0],\
[-w*2,0,0],\
[-2*w,l,0],\
[-3*w,l,0],\
[-3*w,0,0],\
[-4*w,0,0],\
[-4*w,l,0],\
[-4*w,l,dalti],\
[-4*w,0,dalti],\
[-3*w,0,dalti],\
[-3*w,l,dalti],\
[-2*w,l,dalti],\
[-2*w,0,dalti],\
[-w,0,dalti],\
[-w,l,dalti],\
[-0,l,dalti],\
[-0,0,dalti]]
distance = 0
xold = x0
yold = y0
zold = z0
for i in range(len(offsets)):
xnew = x0 + offsets[i][0]
ynew = y0 + offsets[i][1]
znew = z0 + offsets[i][2]
path.append(airsim.Vector3r(xnew,ynew,znew))
dx = xnew - xold
dy = ynew - yold
dz = znew - zold
distance = distance + math.sqrt(dx*dx+dy*dy+dz*dz)
xold = xnew
yold = ynew
zold = znew
print("Total distance is " + str(distance))
tripTime = distance / self.velocity
print("Estimated Time is " + str(tripTime))
self.client.moveOnPathAsync(path,\
self.velocity,\
tripTime * 3,\
airsim.DrivetrainType.MaxDegreeOfFreedom,\
airsim.YawMode(True,0), \
-1, 0)
Note:
- self.velocity = 2 m/s.
- I let timeout = tripTime * 3 since the rough time estimation by dist / avg_spd is too short to make the UAV finish the whole path.
@xiahaa can you please try the branch bug_fixes/z_controller and get back to us?
@xiahaa any news?
Hi @madratman! In my case, the error is still there. The drone is still shaking. You can see my recorded video here https://youtu.be/VOaxnu0XI_s
@xiahaa any news?
Sorry for the delay. I have tried with the branch you provided. The behavior is even more wired, from what I have seen~ I made a gif that you can see the behaviors.

@madratman Any solution for this ? Its looks like Weather : Wind bug.
Still getting this bug in the latest AirSimNH environment
UPDATE Ok, my old solution didn't work at higher speeds, so try this one and see if it works for you:
Basically we aren't going to use the position PID controller which seems to have some issues. Instead use the velocity PID with target z velocity 0 when we are close to our goal altitude.
If someone else confirms it works, or if I don't run into any issues for a while Ill do a pull request
NOTE: Be sure to change MoveByVelocityZInternal to MoveByVelocityInternal (No Z)
- In MultirotorAPIBase.cpp change some code in the moveToPathPosition
- rebuild AirSim
- added the new Plugin files to UE4
Replace
//send commands
//try to maintain altitude if path was in XY plan only, velocity based control is not as good
if (std::abs(cur.z() - dest.z()) <= 1) //for paths in XY plan current code leaves z untouched, so we can compare with strict equality
moveByVelocityZInternal(velocity_vect.x(), velocity_vect.y(), dest.z(), yaw_mode);
else
moveByVelocityInternal(velocity_vect.x(), velocity_vect.y(), velocity_vect.z(), yaw_mode);
with
//send commands
//try to maintain altitude if path was in XY plan only, velocity based control is not as good
if (std::abs(cur.z() - dest.z()) <= 1) //for paths in XY plan current code leaves z untouched, so we can compare with strict equality
moveByVelocityInternal(velocity_vect.x(), velocity_vect.y(), 0, yaw_mode);
else
moveByVelocityInternal(velocity_vect.x(), velocity_vect.y(), velocity_vect.z(), yaw_mode);
This did not help at higher altitudes. We still see a lot of jitter/vibrations at 70m/80m heights. @madratman, are there any other fixes we can try?
Huh, you rebuilt with that change and no luck? I just tried flying at 90m and didnt have any issues...If someone else wants to try, it looks like the issue is is moveByVelocityZInternal, which causes the drone to very quickly change its zvelocity at the target altitude. So it is essentially stuck oscillating (shaking) at that altitude.
OK! I realize now that my earlier solution doesn't work at higher velocity...Edited my earlier comment with a new change that seems to be working
This works. Thank you!
i have alse met this problem? do you guys have any solution for that?