-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rotateToYaw(yaw) returns at yaw but drone rotates more before stopping #856
Comments
You might want to play around to turn PID controller. Overshoots might happen because p is too high for example. There is plenty of literature on web on PID tuning... PID parameters: |
I found this command to work when the drone is hovering. If you control the head direction in move, you may use the drivetrain parameter. client.hoverAsync().join() |
i do as you said, but it is not work two airsim 1.2 |
@wangnboss, Would you share your AirSim version? I don't have those Classes in my Python API. When I try to use
It looks like that I don't have |
Solved by PR2516 |
I am using the Python API.
MultirotorClient class method rotateToYaw(yaw, max_wait_seconds, margin) always over shoots the target yaw. If large enough max_wait_seconds argument is supplied, method return when yaw is within margin of target yaw, but drone continues to rotate for a while. For example, see following pyton code:
from AirSimClient import *
import time
import math
factor = 180./math.pi
def print_info():
pitch, roll, yaw = client.getPitchRollYaw()
print("pitch %5.1f, roll %5.1f, yaw %5.1f" % (pitchfactor, rollfactor, yaw*factor))
print()
client = MultirotorClient()
client.confirmConnection()
client.enableApiControl(True)
client.armDisarm(True)
delay = 5
max_wait_seconds = delay
client.takeoff()
time.sleep(delay)
print_info()
print("rotateToYaw (90)")
client.rotateToYaw(90., max_wait_seconds, 1)
print_info() # it reached 90
time.sleep(delay)
print_info() # it continued rotating
which produces the following output:
Waiting for connection:
after takoff
pitch 0.0, roll 0.0, yaw 0.0
rotateToYaw (90)
pitch 0.0, roll 0.0, yaw 90.5
pitch 0.0, roll 0.0, yaw 114.4
Is this is normal/expected/desired behavior?
If so, how do I get the drone to STOP rotating when it reaches target yaw?
I've tried adding the following line immediately after the call to rotateToYaw, but it does not work.
client.rotateByYawRate(0.,1) #try to stop rotation
The text was updated successfully, but these errors were encountered: