Skip to content

Unexpected Rotation of Object #2901

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
p3jawors opened this issue Jul 31, 2020 · 0 comments
Open

Unexpected Rotation of Object #2901

p3jawors opened this issue Jul 31, 2020 · 0 comments
Labels
bug-report for issues filed as bug reports

Comments

@p3jawors
Copy link

python==3.5.2
airsim==1.2.7
unreal==4.24.1-0+++UE4+Release-4.24
OS: Ubuntu 16.04

I have created a simple object in unreal with cylinders to better visualize my quadrotor orientation. The object has collisions turned off, is moveable, and is a group of 3 cylinders. The axis of this object match the directions that you see on the quadrotor when you select it with x:forward, y:right, z:up. I am not talking about the feedback in NED where z is flipped, this is just the reference frame of the object itself in airsim that you can see when you select an object. The object itself has the cylinders set to match the directions in NED given from the airsim feedback (see first image below). I have confirmed this by setting the state of objects along x,y,z and they move as expected (+x forward, +y right, +z down) as the cylinders of this object are pointing towards. The object looks like this before it gets its state set.

pre-sim

I connect to the simulator with

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

Then I get the drone state with

state = self.client.getMultirotorState().kinematics_estimated

The idea is to set this axis object to the drones state and orientation to better visualize the rotation. I do this with

        pose = Pose(
                position_val=state.position,
                # orientation_val=state.orientation
                orientation_val=state.orientation
        )
        self.client.simSetObjectPose('xaxis', pose, teleport=True)

If I read the orientation the quaternion is (in xyzw order) [0, 0, 0, 1] as expected. However, if I set the axis object to this quaternion the object appears flipped about the y-axis by pi/2.
post-sim

I can fix this orientation (visually) by doing a quaternion rotation about the y-axis by pi/2 before setting the axis object's state to match the drone orientation in NED, however this has me wondering if I am expecting orientation in a different order, or if I am missing some conversion. I take the quaternion feedback and do a conversion to zyx euler angles (as is expected in the NED frame) to use as a target orientation state in my pd controller that I am developing. Is there some conversion I should be doing to make sure that the rotations are about the NED axis that the movement is performed on? Or is this just something else that is flipping this object for some reason, and has no affect on feedback.

Since this axis object has the same reference frame as the quadrotor, I would expect setting its orientation to [0, 0, 0, 1] would not cause any rotation.

@jonyMarino jonyMarino added bug-report for issues filed as bug reports and removed question labels Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report for issues filed as bug reports
Projects
None yet
Development

No branches or pull requests

2 participants