Skip to content

Commit d352016

Browse files
Revert "Update unity-ros coordinate transformation (#174)" (#195)
This reverts commit c26c4cf.
1 parent c26c4cf commit d352016

File tree

3 files changed

+13
-40
lines changed

3 files changed

+13
-40
lines changed

ROSGeometry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Unity's standard Transform class also has a `To<C>()` extension method that retu
4343

4444
# Internal details
4545

46-
Some more detail about what's going on here: The core of the ROSGeometry package is the two generic structs, `Vector3<C>` and `Quaternion<C>`. The type parameter C here indicates the coordinate frame you're working in - either FLU, or RUF, or perhaps one of the more exotic frames such as NED (north, east, down) or ENU (east, north, up), used in aviation. In conversions between RUF and geographical coordinate systems, such as NED and ENU, the east direction is equivalent to the z-axis (forward) in RUF.
46+
Some more detail about what's going on here: The core of the ROSGeometry package is the two generic structs, `Vector3<C>` and `Quaternion<C>`. The type parameter C here indicates the coordinate frame you're working in - either FLU, or RUF, or perhaps one of the more exotic frames such as NED (north, east, down) or ENU (east, north, up), used in aviation.
4747

4848
These are fully-fledged Vector3 and Quaternion classes, so if you want, you can work with them directly to perform geometric operations in an arbitrary coordinate space. (Note, it's a compile time error to add a Vector3<FLU> to a Vector3<RUF>.)
4949

com.unity.robotics.ros-tcp-connector/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ Add badges to main README
5858

5959
### Changed
6060

61-
Update the transformation of coordinate spaces using Unity's coordinate as right, up, forward (RUF) and south, up, east (SUE).
62-
6361
### Deprecated
6462

6563
### Removed

com.unity.robotics.ros-tcp-connector/Runtime/ROSGeometry/CoordinateSpaces.cs

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@ public interface CoordinateSpace : ICoordinateSpace
2020
{
2121
}
2222

23-
/// <summary>
24-
/// RUF is the Unity coordinate space, so no conversion needed
25-
/// <list type="bullet">
26-
/// <item><term>X axis: </term><description>Right and South</description></item>
27-
/// <item><term>Y axis: </term><description>Up</description></item>
28-
/// <item><term>Z axis: </term><description>Forward and East</description></item>
29-
/// </list>
30-
/// </summary>
23+
//RUF is the Unity coordinate space, so no conversion needed
3124
public class RUF : ICoordinateSpace
3225
{
3326
public Vector3 ConvertFromRUF(Vector3 v) => v;
@@ -36,14 +29,6 @@ public class RUF : ICoordinateSpace
3629
public Quaternion ConvertToRUF(Quaternion q) => q;
3730
}
3831

39-
/// <summary>
40-
/// ROS standard forward, left, up (FLU) coordinate (REP-103)
41-
/// <list type="bullet">
42-
/// <item><term>X axis: </term><description>Forward and East</description></item>
43-
/// <item><term>Y axis: </term><description>Left and North</description></item>
44-
/// <item><term>Z axis: </term><description>Up</description></item>
45-
/// </list>
46-
/// </summary>
4732
public class FLU : ICoordinateSpace
4833
{
4934
public Vector3 ConvertFromRUF(Vector3 v) => new Vector3(v.z, -v.x, v.y);
@@ -52,31 +37,21 @@ public class FLU : ICoordinateSpace
5237
public Quaternion ConvertToRUF(Quaternion q) => new Quaternion(-q.y, q.z, q.x, -q.w);
5338
}
5439

55-
/// <summary>
56-
/// Local north, east, down (NED) coordinates for outdoor systems, such as airplane and submarine (REP-103)
57-
/// <list type="bullet">
58-
/// <item><term>X axis: </term><description>North</description></item>
59-
/// <item><term>Y axis: </term><description>East</description></item>
60-
/// <item><term>Z axis: </term><description>Down</description></item>
61-
/// </list>
62-
/// </summary>
6340
public class NED : ICoordinateSpace
6441
{
65-
public Vector3 ConvertFromRUF(Vector3 v) => new Vector3(-v.x, v.z, -v.y);
66-
public Vector3 ConvertToRUF(Vector3 v) => new Vector3(-v.x, -v.z, v.y);
67-
public Quaternion ConvertFromRUF(Quaternion q) => new Quaternion(-q.x, q.z, -q.y, -q.w);
68-
public Quaternion ConvertToRUF(Quaternion q) => new Quaternion(-q.x, -q.z, q.y, -q.w);
42+
public Vector3 ConvertFromRUF(Vector3 v) => new Vector3(v.z, v.x, -v.y);
43+
public Vector3 ConvertToRUF(Vector3 v) => new Vector3(v.y, -v.z, v.x);
44+
public Quaternion ConvertFromRUF(Quaternion q) => new Quaternion(q.z, q.x, -q.y, -q.w);
45+
public Quaternion ConvertToRUF(Quaternion q) => new Quaternion(q.y, -q.z, q.x, -q.w);
6946
}
7047

71-
/// <summary>
72-
/// Local east, north, up (ENU) coordinates for short-range Cartesian representations of geographic locations (REP-103)
73-
/// <list type="bullet">
74-
/// <item><term>X axis: </term><description>East</description></item>
75-
/// <item><term>Y axis: </term><description>North</description></item>
76-
/// <item><term>Z axis: </term><description>Up</description></item>
77-
/// </list>
78-
/// </summary>
79-
public class ENU : FLU { }
48+
public class ENU : ICoordinateSpace
49+
{
50+
public Vector3 ConvertFromRUF(Vector3 v) => new Vector3(v.x, v.z, v.y);
51+
public Vector3 ConvertToRUF(Vector3 v) => new Vector3(v.x, v.z, v.y);
52+
public Quaternion ConvertFromRUF(Quaternion q) => new Quaternion(q.x, q.z, q.y, -q.w);
53+
public Quaternion ConvertToRUF(Quaternion q) => new Quaternion(q.x, q.z, q.y, -q.w);
54+
}
8055

8156
public enum CoordinateSpaceSelection
8257
{

0 commit comments

Comments
 (0)