Skip to content

Inherent y drift depending on order of calls in the python script #2852

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

Open
amaalo2 opened this issue Jul 14, 2020 · 0 comments
Open

Inherent y drift depending on order of calls in the python script #2852

amaalo2 opened this issue Jul 14, 2020 · 0 comments
Labels

Comments

@amaalo2
Copy link

amaalo2 commented Jul 14, 2020

Similar to Git Issue #2851, I am experiencing Y drift depending on the order of the calls.

`import setup_path
import airsim
import pprint
import time

for i in range(10):

client = airsim.MultirotorClient()
client.reset()
client.confirmConnection()
client.enableApiControl(True)
client.armDisarm(True)
client.takeoffAsync().join()


while True:
    collision_info = client.simGetCollisionInfo()
    client.enableApiControl(True)

    #Move Straight
    client.moveByVelocityZAsync(1, 0, -2, 1).join()

    quad_state = client.simGetGroundTruthKinematics().position
    pos_x = quad_state.x_val
    pos_y = quad_state.y_val
    pos_z = quad_state.z_val

    print(pos_x,pos_y,pos_z)

    if collision_info.has_collided:
        print(i)
        print("Collision at pos %s, normal %s, impact pt %s, penetration %f, name %s, obj id %d" % (
            pprint.pformat(collision_info.position), 
            pprint.pformat(collision_info.normal), 
            pprint.pformat(collision_info.impact_point), 
            collision_info.penetration_depth, collision_info.object_name, collision_info.object_id))               
        break

`

This is the code used to run a drone in a straight line.
Specifically, using the lines below from the code above in this order:

collision_info = client.simGetCollisionInfo()
client.enableApiControl(True)

image

I get much different results in terms of Y drift if I swap those lines around.

client.enableApiControl(True)
collision_info = client.simGetCollisionInfo()

image

I do not believe the order should matter here, and I do not understand what is causing this drift.

@madratman madratman added the bug label Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants