fastdev.sim_webui

Submodules

Package Contents

class fastdev.sim_webui.SimWebUI(host: str = 'localhost', port: int = 8080, enable_geometry_option: bool = False)[source]

WebUI for simulator and 3D scene visualization.

Parameters:
  • host (str)

  • port (int)

  • enable_geometry_option (bool)

__repr__() str[source]
Return type:

str

__str__() str[source]
Return type:

str

property scene_index: int
Return type:

int

set_scene_index(value: int)[source]
Parameters:

value (int)

add_robot_asset(urdf_or_mjcf_path: str | pathlib.Path | None = None, mesh_dir: str | pathlib.Path | None = None, articulation: fastdev.robo.articulation.Articulation | None = None) str[source]

Add a robot asset to the asset library.

Parameters:
  • urdf_or_mjcf_path (Union[str, Path]) – Path to the URDF or MJCF file of the robot.

  • mesh_dir (Optional[Union[str, Path]], optional) – Directory path of the robot meshes. Will use the directory of the URDF/MJCF file if not provided. Defaults to None.

  • articulation (Optional[fastdev.robo.articulation.Articulation])

Returns:

Asset ID of the robot asset.

Return type:

str

add_mesh_asset(vertices: VerticesLike | None = None, faces: FacesLike | None = None, trimesh_mesh: trimesh.Trimesh | None = None, mesh_path: str | pathlib.Path | None = None, disable_cache: bool = False) str[source]

Add a mesh asset to the asset library.

Parameters:
  • vertices (Optional[VerticesLike], optional) – Vertices of the mesh. Defaults to None.

  • faces (Optional[FacesLike], optional) – Faces of the mesh. Defaults to None.

  • trimesh_mesh (Optional[trimesh.Trimesh], optional) – Trimesh mesh object. Defaults to None.

  • mesh_path (Optional[Union[str, Path]], optional) – Path to the mesh file. Defaults to None.

  • disable_cache (bool)

Returns:

Asset ID of the mesh asset.

Return type:

str

Note

Either trimesh_mesh or vertices and faces or mesh_path must be provided, but not both.

add_sphere_asset(radius: ScaleLike, subdivisions: int = 3, disable_cache: bool = False) str[source]

Add a single sphere asset to the asset library.

Parameters:
  • radius (float) – Radius of the sphere.

  • subdivisions (int, optional) – Number of subdivisions. Defaults to 3.

  • disable_cache (bool)

Returns:

Asset ID of the sphere asset.

Return type:

str

add_point_cloud_asset(points: VerticesLike) str[source]

Add a point cloud asset to the asset library.

Parameters:

points (VerticesLike) – Points of the point cloud.

Returns:

Asset ID of the point cloud asset.

Return type:

str

add_axes_asset(positions: AxesPositionsLike, rotations: AxesWXYZsLike) str[source]

Add an axes asset to the asset library.

Parameters:
  • positions (AxesPositionLike) – Positions of the axes.

  • rotations (AxesWXYZsLike) – Rotations of the axes, could be in rotation matrices or wxyz quaternions.

Returns:

Asset ID of the axes asset.

Return type:

str

set_robot_state(asset_id: str, scene_index: int | None = None, joint_values: JointValuesLike | None = None, root_poses: PosesLike | None = None, color: ColorLike = 'silver')[source]

Set the state of a robot asset.

Parameters:
  • asset_id (str) – Asset ID of the robot asset.

  • joint_values (Optional[JointValuesT], optional) – Multi-frame (or single-frame) joint values. Defaults to None.

  • root_poses (Optional[PosesT], optional) – Multi-frame (or single-frame) root poses. Defaults to None.

  • scene_index (Optional[int], optional) – Scene index. Defaults to None.

  • color (ColorLike)

Note

The number of frames of the asset state is determined by the number of joint values provided.

set_mesh_state(asset_id: str, scene_index: int | None = None, poses: PosesLike | None = None, scale: ScaleLike = 1.0, color: ColorLike | None = None, frame_range: int | Tuple[int, int] | None = None)[source]

Set the state of a mesh asset.

Parameters:
  • asset_id (str) – Asset ID of the mesh asset.

  • scene_index (Optional[int], optional) – Scene index. Defaults to None.

  • poses (Optional[PosesLike], optional) – Multi-frame (or single-frame) poses. Defaults to None.

  • scale (ScaleLike, optional) – Scale factor. Defaults to 1.0.

  • color (ColorLike, optional) – Color of the mesh, use random color if not provided. Defaults to None.

  • frame_range (Optional[Union[int, Tuple[int, int]]])

Note

The number of frames of the asset state is determined by the number of poses provided.

set_sphere_state(asset_id: str, scene_index: int | None = None, poses: PosesLike | None = None, scale: ScaleLike = 1.0, color: ColorLike | None = None, frame_range: int | Tuple[int, int] | None = None)[source]

Set the state of a sphere asset.

Parameters:
  • asset_id (str) – Asset ID of the sphere asset.

  • scene_index (Optional[int], optional) – Scene index. Defaults to None.

  • poses (Optional[PosesLike], optional) – Multi-frame (or single-frame) poses. Defaults to None.

  • scale (ScaleLike, optional) – Scale factor. Defaults to 1.0.

  • color (Optional[ColorLike], optional) – Color of the sphere. Defaults to None.

  • frame_range (Optional[Union[int, Tuple[int, int]]])

Note

The number of frames of the asset state is determined by the number of poses provided.

set_point_cloud_state(asset_id: str, scene_index: int | None = None, poses: PosesLike | None = None, point_size: ScaleLike = 0.02, color: ColorLike | None = None, frame_range: int | Tuple[int, int] | None = None)[source]

Set the state of a point cloud asset.

Parameters:
  • asset_id (str) – Asset ID of the point cloud asset.

  • scene_index (Optional[int], optional) – Scene index. Defaults to None.

  • poses (Optional[PosesLike], optional) – Multi-frame (or single-frame) poses. Defaults to None.

  • scale (ScaleLike, optional) – Scale factor. Defaults to 1.0.

  • color (Optional[ColorLike], optional) – Color of the point cloud. Defaults to None.

  • point_size (ScaleLike)

  • frame_range (Optional[Union[int, Tuple[int, int]]])

Note

The number of frames of the asset state is determined by the number of poses provided.

set_axes_state(asset_id: str, scene_index: int | None = None, axes_length: ScaleLike = 0.1, axes_radius: ScaleLike = 0.005, poses: PosesLike | None = None)[source]

Set the state of a point cloud asset.

Parameters:
  • asset_id (str) – Asset ID of the point cloud asset.

  • scene_index (Optional[int], optional) – Scene index. Defaults to None.

  • axes_length (ScaleLike, optional) – Length of the axes. Defaults to 0.1.

  • axes_radius (ScaleLike, optional) – Radius of the axes. Defaults to 0.005.

  • poses (Optional[PosesLike], optional) – Multi-frame (or single-frame) poses. Defaults to None.

Note

The number of frames of the asset state is determined by the number of poses provided.

reset()[source]

Reset the state manager and Viser server.