Rotator Problems (Need help !)

Hello,
I am working on a project using Unreal Engine 5.2.1 and Cesium. I am sending orientation and position values, which I calculate in Matlab, via UDP in JSON format, including ecef_x, ecef_y, ecef_z, and the orientation values for ecef2body as roll, pitch, and yaw. Then, using the Make Vector block, I convert the received ecef_x, ecef_y, and ecef_z values into a vector and input it to the Transform Earth Centered Fixed Position to Unreal block. I have assigned CesiumGlobeAnchor to my aircraft, which correctly moves to the right location (I verified it by checking the longitude and latitude values at that moment with Google Maps).

Now let me describe the issue I am experiencing. In Matlab, I have the eci values which I convert to ecef and send along with the current body transform values for roll, pitch, and yaw. However, although the positions I checked in the Matlab simulation are correct, the orientations are not.

AirCraftBluePrintCode

I have shared the code I am using below. How should I correct it? I am very confused, could you please help me?

Hi @baba_geldi24,

Thanks for sharing the Blueprint! I think I found the issue. I see that you’re using Make Transform and directly setting the rotation values. However, the Unreal transform is unlikely to align with the rotation values that are relative to the globe. In other words, you’re putting in a rotation in the Unreal coordinate system, but the globe anchor requires a rotation in East-South-Up.

You can use Set East South Up to apply this rotation in the globe-relative coordinate system:

image

Also, are you moving from the perspective of that single aircraft? If so, you could also attach a CesiumOriginShift to that aircraft. This component will continually reposition the georeference origin so it’s at the aircraft’s position. It can present a more intuitive way of dealing with the transforms, but it definitely depends on your use case.

Either way, let us know how it goes!

Thank you @janine I tried Set East South Up Rotation but it cannot working as i excepected. My simulation, which is working on matlab, looking different. Our simulink model working right hand coordinate system.

I got Two question ;

  1. What should I do for convert the rotation?
  2. Should I convert to euler rotation to east south up?

Note :Actually, what I meant to say in the first question is, should I first convert from MATLAB to Unreal’s position and then convert to East-South-Up?

Hi @baba_geldi24,

Thanks for the diagrams! Judging from your drawings, you can convert between the coordinate systems just by applying the right rotations. If your Euler angles come from Matlab, then you can first construct a quaternion from those angles. Then, multiply it by a quaternion that represents:

  • a 90 degree rotation around the Z axis (to make Y forward), and then
  • a 90 degree rotation about that new y-axis (to make Z up).

Once you multiply those two quaternions, then you can just pass it in to the Set East South Up rotation Blueprint. You shouldn’t have to do any extra conversion, but of course, let us know if you still run into issues.

Hi @janine
It’s not working, and I noticed a mistake in the diagram I created.

I think I did the correct conversion but I’m not sure how the ‘set East South Up Rotation’ block is used. Then I found ‘Set Earth Centered Earth Fixed Rotation’ block because of In the simulation running on Matlab, the body transformation of the aircraft is fixed according to the ECEF coordinate frame. So I thought that the ‘Set Earth Centered Earth Fixed Rotation’ function would give me the correct rotation. I tried this but It cannot work with MATLAB simulation’s data. Here is my blueprint code :

I hope I can explain my problem. The more I fail, the more stressed I get, and the more stressed I am, the more I fail.

@janine hello?

Hi @baba_geldi24, I’m so sorry that I missed this.

Another community member had a similar issue with setting the orientation below:

They found that by using the Snap To East South Up Blueprint, they were able to successfully orient their actors.

We still have to triage why this is necessary (ideally it shouldn’t be), but hopefully this helps with your orientation issues. Let us know how it goes!

Hi, yea. That thread shows the pertinent part of what I did. Haven’t delved into why. I no doubt have over engineered it perhaps but haven’t toyed much with what I can leave out to get the same effect.