Skills API
Utility skills for asset processing and spatial computing tasks.
embodied_gen.skills.asset-process
Asset processing skills for EmbodiedGen.
__getattr__
__getattr__(name: str) -> object
Lazily expose asset processing APIs without import side effects.
Source code in embodied_gen/skills/asset-process/__init__.py
29 30 31 32 33 34 35 36 | |
embodied_gen.skills.asset-process.asset_process
Asset processing utilities for scaling and rotating 3D assets.
AssetProcessConfig
dataclass
AssetProcessConfig(urdf_path: str, scale_factor: float = 1.0, rot_xyz: tuple[float, float, float] = (0.0, 0.0, 0.0), keep_urdf_raw_rot: bool = False, inplace: bool = False, output_dir: Optional[str] = None)
Configuration for asset scaling and rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file to process. |
required |
scale_factor
|
float
|
Positive uniform scaling factor. |
1.0
|
rot_xyz
|
tuple[float, float, float]
|
XYZ Euler rotation in degrees. |
(0.0, 0.0, 0.0)
|
keep_urdf_raw_rot
|
bool
|
Whether to preserve the original URDF rotation. |
False
|
inplace
|
bool
|
Whether to modify the source asset directly. |
False
|
output_dir
|
Optional[str]
|
Target asset directory used when |
None
|
AssetProcessor
AssetProcessor(urdf_path: str | Path, scale_factor: float = 1.0, rot_xyz: tuple[float, float, float] = (0.0, 0.0, 0.0), keep_urdf_raw_rot: bool = False, output_dir: Optional[str | Path] = None, inplace: bool = False)
Scale and rotate mesh, collision, and Gaussian-splat asset files.
Initialize an asset processor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str | Path
|
Path to the URDF file to process. |
required |
scale_factor
|
float
|
Positive uniform scaling factor. |
1.0
|
rot_xyz
|
tuple[float, float, float]
|
XYZ Euler rotation in degrees. |
(0.0, 0.0, 0.0)
|
keep_urdf_raw_rot
|
bool
|
Whether to preserve the original visual and collision rotation after baking the asset rotation. |
False
|
output_dir
|
Optional[str | Path]
|
Target asset directory used when |
None
|
inplace
|
bool
|
Whether to modify the source asset directly. |
False
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the URDF file does not exist. |
ValueError
|
If the transform or output configuration is invalid. |
Source code in embodied_gen/skills/asset-process/asset_process.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
process
process() -> Path
Run the complete asset processing workflow.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the processed URDF file. |
Source code in embodied_gen/skills/asset-process/asset_process.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
entrypoint
entrypoint() -> None
Run the asset processing CLI.
Source code in embodied_gen/skills/asset-process/asset_process.py
428 429 430 431 432 433 434 435 436 437 438 439 | |
process_asset
process_asset(urdf_path: str | Path, scale_factor: float = 1.0, rot_xyz: tuple[float, float, float] = (0.0, 0.0, 0.0), keep_urdf_raw_rot: bool = False, output_dir: Optional[str | Path] = None, inplace: bool = False) -> Path
Scale and rotate a complete URDF-based asset.
Source code in embodied_gen/skills/asset-process/asset_process.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
embodied_gen.skills.spatial-computing
FloorplanVisualizer
Static utility class for visualizing floorplans.
draw_poly
staticmethod
draw_poly(ax: Axes, poly: Geometry, **kwargs) -> None
Draw a polygon or multi-polygon on matplotlib axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Axes
|
Matplotlib axes object. |
required |
poly
|
Geometry
|
Shapely Polygon or MultiPolygon to draw. |
required |
**kwargs
|
Additional arguments passed to ax.fill(). |
{}
|
Source code in embodied_gen/skills/spatial-computing/core/visualizer.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
plot
classmethod
plot(rooms: dict[str, Geometry], footprints: dict[str, Geometry], occ_area: Geometry, save_path: str, trajectory: ndarray | None = None, arrow_stride: int = 10, current_index: int | None = None, point_markers: bool = True, dpi: int = 300) -> None
Generate and save a floorplan visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rooms
|
dict[str, Geometry]
|
Dictionary mapping room names to floor polygons. |
required |
footprints
|
dict[str, Geometry]
|
Dictionary mapping object names to footprint polygons. |
required |
occ_area
|
Geometry
|
Union of all occupied areas. |
required |
save_path
|
str
|
Path to save the output image. |
required |
trajectory
|
ndarray | None
|
Optional (N, 2) or (N, 3) array of waypoints. When the third column (rot_deg, tangent heading) is present, heading arrows are drawn. Rendered as a red curve overlay. |
None
|
arrow_stride
|
int
|
Draw a heading arrow every |
10
|
current_index
|
int | None
|
Animation frame index. When set, only the traveled path (up to this index) is drawn, with a green dot at the current position and a red heading arrow; the future path is hidden. |
None
|
point_markers
|
bool
|
When True, mark every trajectory point with a small red dot (in addition to the curve). |
True
|
dpi
|
int
|
Output image resolution in dots per inch. |
300
|
Source code in embodied_gen/skills/spatial-computing/core/visualizer.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
UrdfSemanticInfoCollector
UrdfSemanticInfoCollector(mesh_sample_num: int = DEFAULT_MESH_SAMPLE_NUM, ignore_items: list[str] | None = None)
Collector for URDF semantic information.
Parses URDF files to extract room layouts, object footprints, and provides methods for adding new instances and updating URDF/USD files.
Attributes:
| Name | Type | Description |
|---|---|---|
mesh_sample_num |
Number of points to sample from meshes. |
|
ignore_items |
List of item name patterns to ignore. |
|
instances |
dict[str, Polygon]
|
Dictionary of instance name to footprint polygon. |
instance_meta |
dict[str, dict]
|
Dictionary of instance metadata (mesh path, pose). |
rooms |
dict[str, Geometry]
|
Dictionary of room polygons. |
footprints |
dict[str, Geometry]
|
Dictionary of object footprints. |
occ_area |
Geometry
|
Union of all occupied areas. |
floor_union |
Geometry
|
Union of all floor polygons. |
Initialize the collector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_sample_num
|
int
|
Number of points to sample from meshes. |
DEFAULT_MESH_SAMPLE_NUM
|
ignore_items
|
list[str] | None
|
List of item name patterns to ignore during parsing. |
None
|
Source code in embodied_gen/skills/spatial-computing/core/collector.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
add_instance
add_instance(asset_path: str, instance_key: str, in_room: str | None = None, on_instance: str | None = None, beside_instance: str | None = None, beside_distance: float = DEFAULT_BESIDE_DISTANCE, rotation_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY, n_max_attempt: int = DEFAULT_MAX_PLACEMENT_ATTEMPTS, place_strategy: Literal['top', 'random'] = 'random') -> list[float] | None
Add a new instance to the scene with automatic placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset_path
|
str
|
Path to the asset mesh file. |
required |
instance_key
|
str
|
Unique key for the new instance. |
required |
in_room
|
str | None
|
Optional room name to constrain placement. |
None
|
on_instance
|
str | None
|
Optional instance name to place on top of. |
None
|
beside_instance
|
str | None
|
Optional instance name to place beside (on floor). |
None
|
beside_distance
|
float
|
Initial buffer distance from the target instance for beside placement (meters). Will auto-expand if needed. |
DEFAULT_BESIDE_DISTANCE
|
rotation_rpy
|
tuple[float, float, float]
|
Initial rotation in roll-pitch-yaw. |
DEFAULT_ROTATION_RPY
|
n_max_attempt
|
int
|
Maximum placement attempts. |
DEFAULT_MAX_PLACEMENT_ATTEMPTS
|
place_strategy
|
Literal['top', 'random']
|
Either "top" or "random". |
'random'
|
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the placed instance center, or None if failed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If instance_key already exists or room/instance not found. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
collect
collect(urdf_path: str) -> None
Parse URDF file and collect semantic information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
get_instance_center
get_instance_center(instance_key: str) -> list[float] | None
Get the center position of an instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_key
|
str
|
Name of the instance to query. |
required |
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the instance center, or None if not found. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | |
remove_instance
remove_instance(instance_key: str, in_room: str | None = None) -> bool
Remove an instance from the scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_key
|
str
|
Exact instance name or semantic description to remove. |
required |
in_room
|
str | None
|
Optional room constraint - only remove if instance is in this room. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if instance was removed, False if not found. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If instance_key is a protected item (walls, floors). |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | |
remove_usd_instance
remove_usd_instance(usd_path: str, output_path: str, instance_key: str) -> None
Remove an instance from a USD file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usd_path
|
str
|
Path to the source USD file. |
required |
output_path
|
str
|
Path to save the modified USD. |
required |
instance_key
|
str
|
Prim path name of the instance to remove. |
required |
Raises:
| Type | Description |
|---|---|
ImportError
|
If pxr (USD) library is not available. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | |
save_urdf
save_urdf(output_path: str) -> None
Save the current URDF tree to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Path to save the URDF file. |
required |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | |
update_urdf_info
update_urdf_info(output_path: str, instance_key: str, visual_mesh_path: str, collision_mesh_path: str | None = None, trans_xyz: tuple[float, float, float] = (0, 0, 0), rot_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY, joint_type: str = 'fixed') -> None
Add a new link to the URDF tree and save.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Path to save the updated URDF. |
required |
instance_key
|
str
|
Name for the new link. |
required |
visual_mesh_path
|
str
|
Path to the visual mesh file. |
required |
collision_mesh_path
|
str | None
|
Optional path to collision mesh. |
None
|
trans_xyz
|
tuple[float, float, float]
|
Translation (x, y, z). |
(0, 0, 0)
|
rot_rpy
|
tuple[float, float, float]
|
Rotation (roll, pitch, yaw). |
DEFAULT_ROTATION_RPY
|
joint_type
|
str
|
Type of joint (e.g., "fixed"). |
'fixed'
|
Source code in embodied_gen/skills/spatial-computing/core/collector.py
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | |
update_usd_info
update_usd_info(usd_path: str, output_path: str, instance_key: str, visual_mesh_path: str, trans_xyz: list[float], rot_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY) -> None
Add a mesh instance to an existing USD file.
Uses Blender (bpy) to convert OBJ to USD format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usd_path
|
str
|
Path to the source USD file. |
required |
output_path
|
str
|
Path to save the modified USD. |
required |
instance_key
|
str
|
Prim path name for the new instance. |
required |
visual_mesh_path
|
str
|
Path to the visual mesh (OBJ format). |
required |
trans_xyz
|
list[float]
|
Translation [x, y, z]. |
required |
rot_rpy
|
tuple[float, float, float]
|
Rotation (roll, pitch, yaw). |
DEFAULT_ROTATION_RPY
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If pxr (USD) library or bpy is not available. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | |
get_actionable_surface
get_actionable_surface(mesh: Trimesh, tol_angle: int = 10, tol_z: float = 0.02, area_tolerance: float = 0.15, place_strategy: Literal['top', 'random'] = 'random') -> tuple[float, Geometry]
Extract the actionable (placeable) surface from a mesh.
Finds upward-facing surfaces and returns the best one based on the placement strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
Trimesh
|
The input trimesh object. |
required |
tol_angle
|
int
|
Angle tolerance in degrees for detecting up-facing normals. |
10
|
tol_z
|
float
|
Z-coordinate tolerance for clustering faces. |
0.02
|
area_tolerance
|
float
|
Tolerance for selecting candidate surfaces by area. |
0.15
|
place_strategy
|
Literal['top', 'random']
|
Either "top" (highest surface) or "random". |
'random'
|
Returns:
| Type | Description |
|---|---|
float
|
A tuple of (z_height, surface_polygon) representing the selected |
Geometry
|
actionable surface. |
Source code in embodied_gen/skills/spatial-computing/core/geometry.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
points_to_polygon
points_to_polygon(points: ndarray, smooth_thresh: float = 0.2, scanline_step: float = 0.01) -> Polygon
Convert point clouds into polygon contours using sweep line algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
Array of 2D points with shape (N, 2). |
required |
smooth_thresh
|
float
|
Buffer threshold for smoothing the polygon. |
0.2
|
scanline_step
|
float
|
Step size for the scanline sweep. |
0.01
|
Returns:
| Type | Description |
|---|---|
Polygon
|
A Shapely Polygon representing the contour of the point cloud. |
Source code in embodied_gen/skills/spatial-computing/core/geometry.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
embodied_gen.skills.spatial-computing.core.geometry
get_actionable_surface
get_actionable_surface(mesh: Trimesh, tol_angle: int = 10, tol_z: float = 0.02, area_tolerance: float = 0.15, place_strategy: Literal['top', 'random'] = 'random') -> tuple[float, Geometry]
Extract the actionable (placeable) surface from a mesh.
Finds upward-facing surfaces and returns the best one based on the placement strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
Trimesh
|
The input trimesh object. |
required |
tol_angle
|
int
|
Angle tolerance in degrees for detecting up-facing normals. |
10
|
tol_z
|
float
|
Z-coordinate tolerance for clustering faces. |
0.02
|
area_tolerance
|
float
|
Tolerance for selecting candidate surfaces by area. |
0.15
|
place_strategy
|
Literal['top', 'random']
|
Either "top" (highest surface) or "random". |
'random'
|
Returns:
| Type | Description |
|---|---|
float
|
A tuple of (z_height, surface_polygon) representing the selected |
Geometry
|
actionable surface. |
Source code in embodied_gen/skills/spatial-computing/core/geometry.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
points_to_polygon
points_to_polygon(points: ndarray, smooth_thresh: float = 0.2, scanline_step: float = 0.01) -> Polygon
Convert point clouds into polygon contours using sweep line algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
Array of 2D points with shape (N, 2). |
required |
smooth_thresh
|
float
|
Buffer threshold for smoothing the polygon. |
0.2
|
scanline_step
|
float
|
Step size for the scanline sweep. |
0.01
|
Returns:
| Type | Description |
|---|---|
Polygon
|
A Shapely Polygon representing the contour of the point cloud. |
Source code in embodied_gen/skills/spatial-computing/core/geometry.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
embodied_gen.skills.spatial-computing.core.collector
UrdfSemanticInfoCollector
UrdfSemanticInfoCollector(mesh_sample_num: int = DEFAULT_MESH_SAMPLE_NUM, ignore_items: list[str] | None = None)
Collector for URDF semantic information.
Parses URDF files to extract room layouts, object footprints, and provides methods for adding new instances and updating URDF/USD files.
Attributes:
| Name | Type | Description |
|---|---|---|
mesh_sample_num |
Number of points to sample from meshes. |
|
ignore_items |
List of item name patterns to ignore. |
|
instances |
dict[str, Polygon]
|
Dictionary of instance name to footprint polygon. |
instance_meta |
dict[str, dict]
|
Dictionary of instance metadata (mesh path, pose). |
rooms |
dict[str, Geometry]
|
Dictionary of room polygons. |
footprints |
dict[str, Geometry]
|
Dictionary of object footprints. |
occ_area |
Geometry
|
Union of all occupied areas. |
floor_union |
Geometry
|
Union of all floor polygons. |
Initialize the collector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_sample_num
|
int
|
Number of points to sample from meshes. |
DEFAULT_MESH_SAMPLE_NUM
|
ignore_items
|
list[str] | None
|
List of item name patterns to ignore during parsing. |
None
|
Source code in embodied_gen/skills/spatial-computing/core/collector.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
add_instance
add_instance(asset_path: str, instance_key: str, in_room: str | None = None, on_instance: str | None = None, beside_instance: str | None = None, beside_distance: float = DEFAULT_BESIDE_DISTANCE, rotation_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY, n_max_attempt: int = DEFAULT_MAX_PLACEMENT_ATTEMPTS, place_strategy: Literal['top', 'random'] = 'random') -> list[float] | None
Add a new instance to the scene with automatic placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset_path
|
str
|
Path to the asset mesh file. |
required |
instance_key
|
str
|
Unique key for the new instance. |
required |
in_room
|
str | None
|
Optional room name to constrain placement. |
None
|
on_instance
|
str | None
|
Optional instance name to place on top of. |
None
|
beside_instance
|
str | None
|
Optional instance name to place beside (on floor). |
None
|
beside_distance
|
float
|
Initial buffer distance from the target instance for beside placement (meters). Will auto-expand if needed. |
DEFAULT_BESIDE_DISTANCE
|
rotation_rpy
|
tuple[float, float, float]
|
Initial rotation in roll-pitch-yaw. |
DEFAULT_ROTATION_RPY
|
n_max_attempt
|
int
|
Maximum placement attempts. |
DEFAULT_MAX_PLACEMENT_ATTEMPTS
|
place_strategy
|
Literal['top', 'random']
|
Either "top" or "random". |
'random'
|
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the placed instance center, or None if failed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If instance_key already exists or room/instance not found. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
collect
collect(urdf_path: str) -> None
Parse URDF file and collect semantic information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
get_instance_center
get_instance_center(instance_key: str) -> list[float] | None
Get the center position of an instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_key
|
str
|
Name of the instance to query. |
required |
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the instance center, or None if not found. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | |
remove_instance
remove_instance(instance_key: str, in_room: str | None = None) -> bool
Remove an instance from the scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_key
|
str
|
Exact instance name or semantic description to remove. |
required |
in_room
|
str | None
|
Optional room constraint - only remove if instance is in this room. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if instance was removed, False if not found. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If instance_key is a protected item (walls, floors). |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | |
remove_usd_instance
remove_usd_instance(usd_path: str, output_path: str, instance_key: str) -> None
Remove an instance from a USD file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usd_path
|
str
|
Path to the source USD file. |
required |
output_path
|
str
|
Path to save the modified USD. |
required |
instance_key
|
str
|
Prim path name of the instance to remove. |
required |
Raises:
| Type | Description |
|---|---|
ImportError
|
If pxr (USD) library is not available. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | |
save_urdf
save_urdf(output_path: str) -> None
Save the current URDF tree to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Path to save the URDF file. |
required |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | |
update_urdf_info
update_urdf_info(output_path: str, instance_key: str, visual_mesh_path: str, collision_mesh_path: str | None = None, trans_xyz: tuple[float, float, float] = (0, 0, 0), rot_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY, joint_type: str = 'fixed') -> None
Add a new link to the URDF tree and save.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Path to save the updated URDF. |
required |
instance_key
|
str
|
Name for the new link. |
required |
visual_mesh_path
|
str
|
Path to the visual mesh file. |
required |
collision_mesh_path
|
str | None
|
Optional path to collision mesh. |
None
|
trans_xyz
|
tuple[float, float, float]
|
Translation (x, y, z). |
(0, 0, 0)
|
rot_rpy
|
tuple[float, float, float]
|
Rotation (roll, pitch, yaw). |
DEFAULT_ROTATION_RPY
|
joint_type
|
str
|
Type of joint (e.g., "fixed"). |
'fixed'
|
Source code in embodied_gen/skills/spatial-computing/core/collector.py
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | |
update_usd_info
update_usd_info(usd_path: str, output_path: str, instance_key: str, visual_mesh_path: str, trans_xyz: list[float], rot_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY) -> None
Add a mesh instance to an existing USD file.
Uses Blender (bpy) to convert OBJ to USD format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usd_path
|
str
|
Path to the source USD file. |
required |
output_path
|
str
|
Path to save the modified USD. |
required |
instance_key
|
str
|
Prim path name for the new instance. |
required |
visual_mesh_path
|
str
|
Path to the visual mesh (OBJ format). |
required |
trans_xyz
|
list[float]
|
Translation [x, y, z]. |
required |
rot_rpy
|
tuple[float, float, float]
|
Rotation (roll, pitch, yaw). |
DEFAULT_ROTATION_RPY
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If pxr (USD) library or bpy is not available. |
Source code in embodied_gen/skills/spatial-computing/core/collector.py
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | |
embodied_gen.skills.spatial-computing.core.visualizer
FloorplanVisualizer
Static utility class for visualizing floorplans.
draw_poly
staticmethod
draw_poly(ax: Axes, poly: Geometry, **kwargs) -> None
Draw a polygon or multi-polygon on matplotlib axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Axes
|
Matplotlib axes object. |
required |
poly
|
Geometry
|
Shapely Polygon or MultiPolygon to draw. |
required |
**kwargs
|
Additional arguments passed to ax.fill(). |
{}
|
Source code in embodied_gen/skills/spatial-computing/core/visualizer.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
plot
classmethod
plot(rooms: dict[str, Geometry], footprints: dict[str, Geometry], occ_area: Geometry, save_path: str, trajectory: ndarray | None = None, arrow_stride: int = 10, current_index: int | None = None, point_markers: bool = True, dpi: int = 300) -> None
Generate and save a floorplan visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rooms
|
dict[str, Geometry]
|
Dictionary mapping room names to floor polygons. |
required |
footprints
|
dict[str, Geometry]
|
Dictionary mapping object names to footprint polygons. |
required |
occ_area
|
Geometry
|
Union of all occupied areas. |
required |
save_path
|
str
|
Path to save the output image. |
required |
trajectory
|
ndarray | None
|
Optional (N, 2) or (N, 3) array of waypoints. When the third column (rot_deg, tangent heading) is present, heading arrows are drawn. Rendered as a red curve overlay. |
None
|
arrow_stride
|
int
|
Draw a heading arrow every |
10
|
current_index
|
int | None
|
Animation frame index. When set, only the traveled path (up to this index) is drawn, with a green dot at the current position and a red heading arrow; the future path is hidden. |
None
|
point_markers
|
bool
|
When True, mark every trajectory point with a small red dot (in addition to the curve). |
True
|
dpi
|
int
|
Output image resolution in dots per inch. |
300
|
Source code in embodied_gen/skills/spatial-computing/core/visualizer.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
embodied_gen.skills.spatial-computing.core.trajectory
DEFAULT_CLEARANCE
module-attribute
DEFAULT_CLEARANCE = 0.4
Minimum distance (m) required between the trajectory and any obstacle.
DEFAULT_ENDPOINT_CLEARANCE
module-attribute
DEFAULT_ENDPOINT_CLEARANCE = 1.5
Minimum distance (m) the start/end keep from walls and objects.
DEFAULT_NUM_WAYPOINTS
module-attribute
DEFAULT_NUM_WAYPOINTS = 8
Number of roam waypoints sampled across the navigable space.
DEFAULT_OBSTACLE_IGNORE
module-attribute
DEFAULT_OBSTACLE_IGNORE = ('door',)
Footprint name keywords excluded from obstacles (treated as open).
DEFAULT_POINT_SPACING
module-attribute
DEFAULT_POINT_SPACING = 0.1
Output spacing (m) between consecutive trajectory points.
DEFAULT_RESOLUTION
module-attribute
DEFAULT_RESOLUTION = 0.05
Occupancy-grid cell size in meters.
DEFAULT_TURN_RADIUS
module-attribute
DEFAULT_TURN_RADIUS = 0.5
Target turning-arc radius (m) for rounding corners.
HAIRPIN_REVERSAL_DOT
module-attribute
HAIRPIN_REVERSAL_DOT = -0.85
In/out direction dot product below which a turn is treated as a hairpin (near 180 deg) and collapsed; normal roam turns are preserved.
MIN_FILLET_RADIUS
module-attribute
MIN_FILLET_RADIUS = 0.15
Smallest fillet radius (m) tried when rounding a corner; below this a corner that still cannot be rounded is left sharp.
TURN_FRAME_STEP_DEG
module-attribute
TURN_FRAME_STEP_DEG = 20.0
Heading step (deg) of each inserted in-place rotation frame.
TURN_FRAME_TRIGGER_DEG
module-attribute
TURN_FRAME_TRIGGER_DEG = 45.0
Only heading jumps larger than this (a big U-turn at an unavoidable sharp corner) get extra in-place rotation frames; gentler turns flow continuously.
RoamTrajectoryGenerator
RoamTrajectoryGenerator(floor: Geometry, obstacles: Geometry, clearance: float = DEFAULT_CLEARANCE, resolution: float = DEFAULT_RESOLUTION, rooms: dict[str, Geometry] | None = None)
Generate smooth, collision-free roaming trajectories on a floorplan.
The drivable region is the floor area minus furniture footprints. An
occupancy grid and its distance transform give per-cell clearance; cells
with clearance >= clearance form the navigable space. Spread waypoints
are sampled within one connected navigable component, ordered by polar
angle into a non-self-intersecting loop, and linked with a clearance-aware
A* planner. Each segment is simplified inside the navigable region, dead-
end hairpins are removed, corners are rounded, and a final clearance pass
keeps every sample collision-free; the start and end are pushed into open
space.
Doors are treated as open passages by default (excluded from obstacles), matching scenes where doors are removed before rendering.
Initialize the generator and build the navigability grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
floor
|
Geometry
|
Drivable floor region (e.g. union of all room floors). |
required |
obstacles
|
Geometry
|
Union of obstacle footprints (e.g. furniture). |
required |
clearance
|
float
|
Minimum obstacle clearance (m) the path must keep. |
DEFAULT_CLEARANCE
|
resolution
|
float
|
Occupancy-grid cell size in meters. |
DEFAULT_RESOLUTION
|
rooms
|
dict[str, Geometry] | None
|
Optional room-name to polygon map, used only to report which rooms the trajectory can reach. |
None
|
Source code in embodied_gen/skills/spatial-computing/core/trajectory.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
from_collector
classmethod
from_collector(collector, clearance: float = DEFAULT_CLEARANCE, resolution: float = DEFAULT_RESOLUTION, obstacle_ignore: tuple[str, ...] = DEFAULT_OBSTACLE_IGNORE, obstacle_clearance: float | None = None) -> 'RoamTrajectoryGenerator'
Build a generator from a UrdfSemanticInfoCollector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collector
|
A collector that has already parsed a URDF scene. |
required | |
clearance
|
float
|
Minimum clearance (m) kept from walls (the floor boundary); keep it small so narrow doorways stay passable. |
DEFAULT_CLEARANCE
|
resolution
|
float
|
Occupancy-grid cell size in meters. |
DEFAULT_RESOLUTION
|
obstacle_ignore
|
tuple[str, ...]
|
Footprint name keywords to exclude from obstacles (treated as open passages, e.g. doors). |
DEFAULT_OBSTACLE_IGNORE
|
obstacle_clearance
|
float | None
|
Minimum clearance (m) kept from furniture and
objects. When larger than |
None
|
Returns:
| Type | Description |
|---|---|
'RoamTrajectoryGenerator'
|
A configured |
Source code in embodied_gen/skills/spatial-computing/core/trajectory.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
generate
generate(start_xy: tuple[float, float] | None = None, num_waypoints: int = DEFAULT_NUM_WAYPOINTS, point_spacing: float = DEFAULT_POINT_SPACING, turn_radius: float = DEFAULT_TURN_RADIUS, endpoint_clearance: float = DEFAULT_ENDPOINT_CLEARANCE, seed: int | None = None) -> TrajectoryResult
Generate a smooth roaming trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_xy
|
tuple[float, float] | None
|
Optional world (x, y) start. Defaults to a point in the largest navigable component. |
None
|
num_waypoints
|
int
|
Number of roam waypoints to visit. |
DEFAULT_NUM_WAYPOINTS
|
point_spacing
|
float
|
Output sampling spacing in meters. |
DEFAULT_POINT_SPACING
|
turn_radius
|
float
|
Target turning-arc radius (m); larger gives wider, rounder turns (clamped by segment length and clearance). |
DEFAULT_TURN_RADIUS
|
endpoint_clearance
|
float
|
Minimum clearance (m) kept at the start and end points so they are not placed close to walls. |
DEFAULT_ENDPOINT_CLEARANCE
|
seed
|
int | None
|
Optional RNG seed for reproducible roaming. |
None
|
Returns:
| Type | Description |
|---|---|
TrajectoryResult
|
A |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no navigable path can be planned. |
Source code in embodied_gen/skills/spatial-computing/core/trajectory.py
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | |
TrajectoryResult
dataclass
TrajectoryResult(points: ndarray, clearance: float, min_clearance: float, length: float, reachable_rooms: list[str] = list())
Result of a roaming-trajectory generation.
Attributes:
| Name | Type | Description |
|---|---|---|
points |
ndarray
|
Array (N, 3) of (x, y, rot_deg). rot_deg is the heading tangent to the curve: 0 deg points +Y (12 o'clock), increasing counter-clockwise in [0, 360). |
clearance |
float
|
Clearance radius (m) used for planning. |
min_clearance |
float
|
Minimum obstacle clearance (m) along the trajectory. |
length |
float
|
Total arc length (m) of the trajectory. |
reachable_rooms |
list[str]
|
Room keys reachable within the planning component. |
heading_to_rot_deg
heading_to_rot_deg(dx: float, dy: float) -> float
Convert a motion direction to the roaming heading convention.
The heading is the forward (tangent) direction of travel, where 0 deg points to +Y (12 o'clock) and the angle increases counter-clockwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dx
|
float
|
X component of the motion direction. |
required |
dy
|
float
|
Y component of the motion direction. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Heading in degrees within [0, 360). |
Source code in embodied_gen/skills/spatial-computing/core/trajectory.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
embodied_gen.skills.spatial-computing.api.floorplan_api
FloorplanConfig
dataclass
FloorplanConfig(urdf_path: str, output_path: str | None = None, usd_path: str | None = None, asset_path: str | None = None, instance_key: str = 'inserted_object', in_room: str | None = None, on_instance: str | None = None, beside_instance: str | None = None, beside_distance: float = DEFAULT_BESIDE_DISTANCE, place_strategy: Literal['top', 'random'] = 'random', rotation_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY, ignore_items: list[str] = (lambda: list(DEFAULT_IGNORE_ITEMS))(), mesh_sample_num: int = DEFAULT_MESH_SAMPLE_NUM, max_placement_attempts: int = 2000, update_urdf: bool = True, update_usd: bool = True, list_instances: bool = False, delete_instance: str | None = None, delete_in_room: str | None = None, query_instance: str | None = None, output_strategy: Literal['suffix', 'overwrite', 'timestamp'] = 'suffix', batch_insert_config: str | None = None)
Configuration for floorplan operations.
asset_path
class-attribute
instance-attribute
asset_path: str | None = None
Optional path to the asset mesh file (.obj).
batch_insert_config
class-attribute
instance-attribute
batch_insert_config: str | None = None
Path to JSON config file for batch insertion (3-4x faster than multiple CLI calls).
JSON format example: [ { "asset_path": "path/to/chair1.obj", "instance_key": "chair_1", "beside_instance": "table_dining_7178300", "in_room": "dining_room_0_floor" }, { "asset_path": "path/to/chair2.obj", "instance_key": "chair_2", "beside_instance": "table_dining_7178300", "in_room": "dining_room_0_floor" } ]
beside_distance
class-attribute
instance-attribute
beside_distance: float = DEFAULT_BESIDE_DISTANCE
Max distance (meters) from the target instance for beside placement.
beside_instance
class-attribute
instance-attribute
beside_instance: str | None = None
Optional instance name to place the asset beside (on floor, near the target).
delete_in_room
class-attribute
instance-attribute
delete_in_room: str | None = None
Optional room constraint for deletion - only delete if instance is in this room.
delete_instance
class-attribute
instance-attribute
delete_instance: str | None = None
Optional instance name to delete from the scene (supports fuzzy matching with LLM).
ignore_items
class-attribute
instance-attribute
ignore_items: list[str] = field(default_factory=lambda: list(DEFAULT_IGNORE_ITEMS))
List of item name patterns to ignore during parsing.
in_room
class-attribute
instance-attribute
in_room: str | None = None
Optional room name to constrain asset placement.
instance_key
class-attribute
instance-attribute
instance_key: str = 'inserted_object'
Unique key for the added instance.
list_instances
class-attribute
instance-attribute
list_instances: bool = False
If True, print instance and room names then exit (no placement/visualization).
max_placement_attempts
class-attribute
instance-attribute
max_placement_attempts: int = 2000
Maximum attempts for asset placement.
mesh_sample_num
class-attribute
instance-attribute
mesh_sample_num: int = DEFAULT_MESH_SAMPLE_NUM
Number of points to sample from meshes.
on_instance
class-attribute
instance-attribute
on_instance: str | None = None
Optional instance name to place the asset on top of (exact key from get_instance_names()).
output_path
class-attribute
instance-attribute
output_path: str | None = None
Path to save the floorplan visualization image.
output_strategy
class-attribute
instance-attribute
output_strategy: Literal['suffix', 'overwrite', 'timestamp'] = 'suffix'
File naming strategy for output files.
- "suffix": Add '_updated' suffix (default, non-destructive)
- "overwrite": Overwrite original files (use with caution)
- "timestamp": Add timestamp suffix (e.g., '_20260311_171500')
place_strategy
class-attribute
instance-attribute
place_strategy: Literal['top', 'random'] = 'random'
Placement strategy for the asset.
query_instance
class-attribute
instance-attribute
query_instance: str | None = None
Optional instance name to query and return its center coordinates (supports fuzzy matching with LLM).
rotation_rpy
class-attribute
instance-attribute
rotation_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY
Rotation in roll-pitch-yaw (radians).
update_urdf
class-attribute
instance-attribute
update_urdf: bool = True
Whether to update and save the URDF file.
update_usd
class-attribute
instance-attribute
update_usd: bool = True
Whether to update and save the USD file.
urdf_path
instance-attribute
urdf_path: str
Path to the input URDF scene file.
usd_path
class-attribute
instance-attribute
usd_path: str | None = None
Optional path to the USD scene file for USD export.
FloorplanManager
FloorplanManager(urdf_path: str, usd_path: str | None = None, mesh_sample_num: int = DEFAULT_MESH_SAMPLE_NUM, ignore_items: list[str] | None = None, output_strategy: Literal['suffix', 'overwrite', 'timestamp'] = 'suffix')
High-level API for floorplan operations.
This class provides simplified methods for: - Loading and analyzing URDF scenes - Visualizing floorplans - Inserting objects into scenes - Updating URDF and USD files
Example
manager = FloorplanManager(urdf_path="scene.urdf", usd_path="scene.usdc") manager.visualize(output_path="floorplan.png") position = manager.insert_object( ... asset_path="chair.obj", ... instance_key="chair_1", ... in_room="kitchen" ... )
URDF/USD are updated automatically after insert
Initialize the floorplan manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
usd_path
|
str | None
|
Optional path to the USD file for scene updates. |
None
|
mesh_sample_num
|
int
|
Number of points to sample from meshes. |
DEFAULT_MESH_SAMPLE_NUM
|
ignore_items
|
list[str] | None
|
List of item name patterns to ignore. |
None
|
output_strategy
|
Literal['suffix', 'overwrite', 'timestamp']
|
File naming strategy for output files. |
'suffix'
|
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
batch_insert_objects
batch_insert_objects(objects: list[dict], defer_update: bool = False) -> list[list[float] | None]
Batch insert multiple objects into the scene efficiently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
objects
|
list[dict]
|
List of object configs, each containing: asset_path: Path to the asset mesh file (.obj). instance_key: Unique key for the new instance. in_room: Optional room name to constrain placement. on_instance: Optional instance name to place on top of. beside_instance: Optional instance name to place beside. beside_distance: Max distance from target (default: 0.5m). rotation_rpy: Initial rotation (default: (0, 0, 0)). place_strategy: Either "top" or "random" (default: "random"). |
required |
defer_update
|
bool
|
If True, don't update URDF/USD after each insertion. Useful when inserting many objects at once. |
False
|
Returns:
| Type | Description |
|---|---|
list[list[float] | None]
|
List of centers [x, y, z] for each inserted object, |
list[list[float] | None]
|
or None if failed. |
Example
objects = [ ... {"asset_path": "chair1.obj", ... "instance_key": "chair_1", ... "beside_instance": "table"}, ... ] centers = manager.batch_insert_objects(objects)
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
delete_object
delete_object(instance_key: str, in_room: str | None = None, urdf_output_path: str | None = None, usd_output_path: str | None = None) -> bool
Delete an object from the scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_key
|
str
|
Exact instance name to delete. |
required |
in_room
|
str | None
|
Optional room constraint - only delete if instance is in this room. |
None
|
urdf_output_path
|
str | None
|
Optional custom path for URDF output. |
None
|
usd_output_path
|
str | None
|
Optional custom path for USD output. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if deletion succeeded, False otherwise. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | |
get_floor_union
get_floor_union() -> Geometry
Get the union of all floor areas.
Returns:
| Type | Description |
|---|---|
Geometry
|
Shapely geometry representing floor areas. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
791 792 793 794 795 796 797 798 | |
get_instance_names
get_instance_names() -> list[str]
Get list of instance names in the scene.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of instance names. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
500 501 502 503 504 505 506 507 508 509 510 511 | |
get_instance_names_in_room
get_instance_names_in_room(in_room: str) -> list[str]
Get instance names that are spatially inside a given room.
Buffers the room polygon slightly to handle mesh-sampling precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_room
|
str
|
Exact room key (must exist in get_room_names()). |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of instance names within the room. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
get_occupied_area
get_occupied_area() -> Geometry
Get the union of all occupied areas.
Returns:
| Type | Description |
|---|---|
Geometry
|
Shapely geometry representing occupied areas. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
782 783 784 785 786 787 788 789 | |
get_room_names
get_room_names() -> list[str]
Get list of room names in the scene.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of room names. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
513 514 515 516 517 518 519 520 | |
insert_object
insert_object(asset_path: str, instance_key: str, in_room: str | None = None, on_instance: str | None = None, beside_instance: str | None = None, beside_distance: float = DEFAULT_BESIDE_DISTANCE, rotation_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY, n_max_attempt: int = 2000, place_strategy: Literal['top', 'random'] = 'random') -> list[float] | None
Insert an object into the scene with automatic placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
asset_path
|
str
|
Path to the asset mesh file (.obj). |
required |
instance_key
|
str
|
Unique key for the new instance. |
required |
in_room
|
str | None
|
Optional room name to constrain placement. |
None
|
on_instance
|
str | None
|
Optional instance name to place on top of. |
None
|
beside_instance
|
str | None
|
Optional instance name to place beside (on floor). |
None
|
beside_distance
|
float
|
Max distance from target for beside placement. |
DEFAULT_BESIDE_DISTANCE
|
rotation_rpy
|
tuple[float, float, float]
|
Initial rotation in roll-pitch-yaw. |
DEFAULT_ROTATION_RPY
|
n_max_attempt
|
int
|
Maximum placement attempts. |
2000
|
place_strategy
|
Literal['top', 'random']
|
Either "top" or "random". |
'random'
|
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the placed instance center, or None if failed. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
query_instance_center
query_instance_center(instance_key: str) -> list[float] | None
Query the center coordinates of an instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_key
|
str
|
Exact instance name to query. |
required |
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the instance center, or None if not found. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
resolve_and_query_instance
resolve_and_query_instance(query_instance: str, gpt_client: object | None = None) -> tuple[str | None, list[float] | None]
Resolve instance name and return its center coordinates.
Combines fuzzy matching with coordinate query. If query_instance is already in get_instance_names(), return its center. Otherwise if gpt_client is provided, use LLM to resolve user description (e.g. "床", "沙发") to one exact instance key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query_instance
|
str
|
Exact instance key or semantic description. |
required |
gpt_client
|
object | None
|
Optional GPT client for semantic resolve. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[str | None, list[float] | None]
|
Tuple of (resolved_instance_name, center_coordinates), or (None, None) if not found. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | |
resolve_beside_instance
resolve_beside_instance(beside_instance: str, gpt_client: object | None = None, in_room: str | None = None) -> str | None
Resolve beside_instance to an exact key (for beside placement).
If beside_instance is already in get_instance_names(), return it. Otherwise if gpt_client is provided, use LLM to resolve user description (e.g. "桌子", "沙发") to one exact instance key.
When in_room is given, only instances spatially inside that room are
considered as candidates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beside_instance
|
str
|
Exact instance key or semantic description. |
required |
gpt_client
|
object | None
|
Optional GPT client for semantic resolve. |
None
|
in_room
|
str | None
|
Optional resolved room key to restrict candidate scope. |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Exact instance key, or None if not found / LLM returned NONE. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
resolve_delete_instance
resolve_delete_instance(delete_instance: str, gpt_client: object | None = None, in_room: str | None = None) -> str | None
Resolve delete_instance to an exact key (for deletion).
Similar to resolve_beside_instance but specifically for deletion. If delete_instance is already in get_instance_names(), return it. Otherwise if gpt_client is provided, use LLM to resolve user description (e.g. "桌子", "沙发") to one exact instance key.
When in_room is given, only instances spatially inside that room are
considered as candidates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delete_instance
|
str
|
Exact instance key or semantic description. |
required |
gpt_client
|
object | None
|
Optional GPT client for semantic resolve. |
None
|
in_room
|
str | None
|
Optional resolved room key to restrict candidate scope. |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Exact instance key, or None if not found / LLM returned NONE. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | |
resolve_in_room
resolve_in_room(in_room: str, gpt_client: object | None = None) -> str | None
Resolve in_room to an exact room name (for placement).
If in_room is already in get_room_names(), return it. Otherwise if gpt_client is provided, use LLM to resolve user description (e.g. \"kitchen\", \"the place for cooking\") to one exact room name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_room
|
str
|
Exact room name or semantic description. |
required |
gpt_client
|
object | None
|
Optional GPT client for semantic resolve (e.g. GPT_CLIENT). |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Exact room name, or None if not found / LLM returned NONE. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
resolve_on_instance
resolve_on_instance(on_instance: str, gpt_client: object | None = None) -> str | None
Resolve on_instance to an exact key (for placement).
If on_instance is already in get_instance_names(), return it. Otherwise if gpt_client is provided, use LLM to resolve user description (e.g. \"柜子\", \"书柜\") to one exact instance key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on_instance
|
str
|
Exact instance key or semantic description. |
required |
gpt_client
|
object | None
|
Optional GPT client for semantic resolve (e.g. GPT_CLIENT). |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Exact instance key, or None if not found / LLM returned NONE. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
update_scene
update_scene(urdf_output_path: str | None = None, usd_output_path: str | None = None) -> None
Update URDF and/or USD with inserted instances.
Updates URDF if self.urdf_path is set, USD if self.usd_path is set. Both are updated when both paths are set. No-op when no instance was inserted.
Note: USD updates require Blender (bpy) to convert .obj to .usdc format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_output_path
|
str | None
|
Optional custom path for URDF output. |
None
|
usd_output_path
|
str | None
|
Optional custom path for USD output. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no instance has been inserted. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
visualize
visualize(output_path: str) -> None
Generate and save a floorplan visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Path to save the output image. |
required |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
delete_object_from_scene
delete_object_from_scene(urdf_path: str, instance_key: str, in_room: str | None = None, output_path: str | None = None) -> bool
Quick function to delete an object from scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
instance_key
|
str
|
Exact instance name to delete. |
required |
in_room
|
str | None
|
Optional room constraint - only delete if instance is in this room. |
None
|
output_path
|
str | None
|
Optional path to save the floorplan image after deletion. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if deletion succeeded, False otherwise. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | |
insert_object_to_scene
insert_object_to_scene(urdf_path: str, asset_path: str, instance_key: str, output_path: str, usd_path: str | None = None, in_room: str | None = None, on_instance: str | None = None, beside_instance: str | None = None, beside_distance: float = DEFAULT_BESIDE_DISTANCE, place_strategy: Literal['top', 'random'] = 'random', rotation_rpy: tuple[float, float, float] = DEFAULT_ROTATION_RPY) -> list[float] | None
Quick function to insert an object and generate floorplan.
Note: USD updates require Blender (bpy) to convert .obj to .usdc format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
asset_path
|
str
|
Path to the asset mesh file (.obj). |
required |
instance_key
|
str
|
Unique key for the new instance. |
required |
output_path
|
str
|
Path to save the floorplan image. |
required |
usd_path
|
str | None
|
Optional path to the USD file (requires Blender). |
None
|
in_room
|
str | None
|
Optional room name to constrain placement. |
None
|
on_instance
|
str | None
|
Optional instance name to place on top of. |
None
|
beside_instance
|
str | None
|
Optional instance name to place beside (on floor). |
None
|
beside_distance
|
float
|
Max distance for beside placement (meters). |
DEFAULT_BESIDE_DISTANCE
|
place_strategy
|
Literal['top', 'random']
|
Either "top" or "random". |
'random'
|
rotation_rpy
|
tuple[float, float, float]
|
Initial rotation in roll-pitch-yaw. |
DEFAULT_ROTATION_RPY
|
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the placed instance center, or None if failed. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | |
query_instance_position
query_instance_position(urdf_path: str, instance_key: str) -> list[float] | None
Quick function to query instance center coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
instance_key
|
str
|
Exact instance name to query. |
required |
Returns:
| Type | Description |
|---|---|
list[float] | None
|
List [x, y, z] of the instance center, or None if not found. |
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | |
visualize_floorplan
visualize_floorplan(urdf_path: str, output_path: str, mesh_sample_num: int = DEFAULT_MESH_SAMPLE_NUM, ignore_items: list[str] | None = None) -> None
Quick function to visualize a floorplan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urdf_path
|
str
|
Path to the URDF file. |
required |
output_path
|
str
|
Path to save the output image. |
required |
mesh_sample_num
|
int
|
Number of points to sample from meshes. |
DEFAULT_MESH_SAMPLE_NUM
|
ignore_items
|
list[str] | None
|
List of item name patterns to ignore. |
None
|
Source code in embodied_gen/skills/spatial-computing/api/floorplan_api.py
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | |