-
Notifications
You must be signed in to change notification settings - Fork 370
Dev_ROSUnityCoordinateSystemConversion
Unity uses a Left-Handed, with y-up
world coordinate system, whereas ROS uses a Right-Handed, with z-up
world coordinate system.
Unity | ROS | |
---|---|---|
Forward | Z | X |
Right | X | -Y |
Up | Y | Z |
Rotation | clockwise | counter-clockwise |
TransformExtensions.cs
script of ROS# handles coordinate system conversions by keeping the Forward-Leftward-Upward convention same for both simulation platforms.
Example: Ros2Unity() code snippet
public static Vector3 Ros2Unity(this Vector3 vector3)
{
return new Vector3(-vector3.y, vector3.z, vector3.x);
}
Joint axes are imported/exported via the help of transform extensions. The vector which defines the axis is converted by keeping the same Forward-Leftward-Upward convention and will point into the same direction in the other coordinate system.
However, the rotation direction should also be taken into account.
Example: Apply Torque to Continuous or Revolute Joints
-
Spawn a URDF model with continuous or revolute joint in Gazebo to run a physics simulation.
-
Apply
positive torque
around forward-axis to observe a counter-clockwise rotation. -
Import URDF model to Unity, and run physics simulation independently from Gazebo simulation.
-
Tick
Use Motor
andFree Spin
-
Apply
negative torque
around forward-axis to observe the same counter-clockwise rotation.
© Siemens AG, 2017-2024
-
- 1.3.1 R2D2 Setup
- 1.3.2 Gazebo Setup on VM
- 1.3.3 TurtleBot Setup (Optional for ROS2)
-
- 2.1 Quick Start
- 2.2 Transfer a URDF from ROS to Unity
- 2.3 Transfer a URDF from Unity to ROS
- 2.4 Unity Simulation Scene Example
- 2.5 Gazebo Simulation Scene Example
- 2.6 Fibonacci Action Client
- 2.7 Fibonacci Action Server
- 3.1 Import a URDF on Windows
- 3.2 Create, Modify and Export a URDF Model
- 3.3 Animate a Robot Model in Unity
- Message Handling: Readers & Writers
- Thread Safety for Message Reception
- File Server Package
- ROS-Unity Coordinate System Conversions
- Post Build Events
- Preprocessor Directives in ROS#
- Adding New Message Types
- RosBridgeClient Protocols
- RosBridgeClient Serializers
- Action Server State Machine Model
© Siemens AG, 2017-2024