-
Notifications
You must be signed in to change notification settings - Fork 365
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 |
Unity coordinate system with solid lines, ROS coordinate system with dashed lines;
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, 2019 Author: Berkay Alp Cakal ([email protected])
1. Installation and Configuration
1.1 Unity on Windows
1.2 Ubuntu on Oracle VM
1.3 ROS on Ubuntu
1.4 Gazebo Setup on VM
1.5 TurtleBot2
1.6 Shadow Hand
1.7 Gazebo Simulation Example Setup
1.8 Unity Simulation Example Setup
2. Application examples with ROS communication
2.1 Transfer a URDF from ROS to Unity
2.2 Transfer a URDF from Unity to ROS
2.3 Gazebo Simulation Example
2.4 Unity Simulation Example
2.5 Fibonacci Action Client
2.6 Fibonacci Action Server
3. Application examples without ROS communication
3.1 Import a URDF on Windows
3.2 Create, Modify and Export a URDF Model
3.3 Animate a Robot Model in Unity
ROS-Unity Coordinate System Conversions
How to add new Message Types
RosBridgeClient Protocols
RosBridgeClient Serializers
Message Handling Code Map
Action Server State Machine Model
License Headers