URDF 파일 및 관련 mesh는 Unity의 Assets 디렉터리 내에 배치된다.
로봇 이름으로 새 폴더를 만들고, 하위 폴더에 관련 Mesh파일을 두고, 로봇 폴더의 root에 URDF 파일 배치하는 것이 좋다고 한다.

Unity로 import된 로봇은 parent-child hierarchy 구조를 따른다.


Articulation Body : 로봇 시뮬레이션을 가능하게 하는 UnityEditor의 Physx 4.0 기능을 사용할 수 있게 한다.
UrdfJoint Script : JointType의 세부 정보를 캡슐화하고 관절에 대한 정보를 가져오는 API를 포함한다. URDF 파일 내보내기를 위한 도우미 기능도 포함되어 있다.
UrdfInertial Script : 이 스크립트에는 joint와 link의 원래 구성에 대한 관성 데이터가 포함되어있다. 또한 로봇 URDF 내보내는 도우미 기능이 있다.
JointControl : 이 스크립트에는 컨트롤러 스크립트에 대한 보조 스크립트이며 제어 정보를 Articular Body에 전달하는데 도움이 된다.
Visuals GameObject(Urdf Visual Script) : 이 gameObject와 그 하위 항목은 로봇에 대한 시각적인 정보를 저장한다. 위치, 방향, visual primitive, mesh, material, etc
Collisions GameObject(Urdf Collisions Scripit) : 이 gameObject와 그 하위 항목은 로봇에 대한 충돌 정보를 저장한다. 위치, 방향, visual primitive, mesh, material, etc



이러한 스크립트들은 URDF Importer에 존재한다.

만약 TF를 추가하고 싶으면 Urdf Link와 Urdf Joint Fixed 스크립트를 추가하고,
오브젝트 이름 : Urdf link 이름.
UrdfJointFixed에 Configuration의 Name이 Joint 이름이다.


URDF Comparator는 두 개의 URDF 파일을 비교하는 테스트 도구이다. 이 도구는 URDF 파일이 올바르게 내보내졌는지 확인하는데 사용할 수 있다.
Source URDF file : 비교할 첫 번째 URDF 파일의 경로
Exported URDF file : 비교할 두 번째 URDF 파일의 경로
Log File Save Location : log 파일의 저장 위치를 설정
Joint와 Link에 대해서 비교할 수 있다.

일반적으로 robotics(ROS) 쪽에서 사용하는 것은 왼쪽 그림의 오른손 좌표계이다. 하지만, 유니티에서는 오른쪽의 왼손 좌표계이다.
using RosMessageTypes.Geometry;
using RosMessageTypes.Std;
using Unity.Robotics.Core;
using Unity.Robotics.ROSTCPConnector.ROSGeometry;
using UnityEngine;
public static class TransformExtensions
{
public static TransformMsg ToROSTransform(this Transform tfUnity)
{
return new TransformMsg(
// Using vector/quaternion To<>() because Transform.To<>() doesn't use localPosition/localRotation
tfUnity.localPosition.To<FLU>(),
tfUnity.localRotation.To<FLU>());
}
public static TransformStampedMsg ToROSTransformStamped(this Transform tfUnity, double timeStamp)
{
return new TransformStampedMsg(
new HeaderMsg(new TimeStamp(timeStamp), tfUnity.parent.gameObject.name),
tfUnity.gameObject.name,
tfUnity.ToROSTransform());
}
}
해당 함수를 통해서 ROS의 좌표계로 변경할 수 있다.
https://docs.unity3d.com/Simulation/manual/author/set-up-sensors/configure-a-lidar.html