Skip to content

4. Godot env interface

Manousos Linardakis edited this page Aug 16, 2023 · 1 revision

Godot Environment Interface

The Godot Environment Interface provides an abstract class GodotEnvInterface for interacting with the Godot simulator. This interface allows the user to control various aspects of the environment and manipulate objects within the simulation. Below is a detailed list of the methods available in this class:

3.0.1 spawn_fossbot(**kwargs)

Spawns a Fossbot in the Godot simulator with the specified parameters.

  • Optional Parameters (kwargs):
    • kwargs (optional):
      • pos_x (float): The X coordinate of the spawn position. Defaults to 1.
      • pos_y (float): The Y coordinate of the spawn position. Defaults to 1.
      • pos_z (float): The Z coordinate of the spawn position. Defaults to 0.
      • color (str): The color of the Fossbot. Defaults to "blue".
      • rotation (float): The initial rotation of the Fossbot (in degrees). Defaults to 0.
      • counterclockwise (bool): Whether the rotation parameter will be counterclockwise. Defaults to False.

3.0.2 spawn_cube(**kwargs)

Spawns a cube in the Godot simulator with the specified parameters.

  • Optional Parameters (kwargs):
    • kwargs (optional):
      • pos_x (float): The X coordinate of the spawn position. Defaults to 1.
      • pos_y (float): The Y coordinate of the spawn position. Defaults to 1.
      • pos_z (float): The Z coordinate of the spawn position. Defaults to 0.
      • scale_x (float): The scale of the cube along the X-axis. Defaults to 1.
      • scale_y (float): The scale of the cube along the Y-axis. Defaults to 1.
      • scale_z (float): The scale of the cube along the Z-axis. Defaults to 1.
      • color (str): The color of the cube. Defaults to "white".
      • rotation (float): The initial rotation of the cube (in degrees). Defaults to 0.
      • counterclockwise (bool): Whether the rotation parameter will be counterclockwise. Defaults to False.

3.0.3 spawn_sphere(**kwargs)

Spawns a sphere in the Godot simulator with the specified parameters.

  • Optional Parameters (kwargs):
    • kwargs (optional):
      • pos_x (float): The X coordinate of the spawn position. Defaults to 1.
      • pos_y (float): The Y coordinate of the spawn position. Defaults to 1.
      • pos_z (float): The Z coordinate of the spawn position. Defaults to 0.
      • color (str): The color of the sphere. Defaults to "white".
      • radius (float): The radius of the sphere. Defaults to 1.

3.0.4 spawn_cone(**kwargs)

Spawns a cone in the Godot simulator with the specified parameters.

  • Optional Parameters (kwargs):
    • kwargs (optional):
      • pos_x (float): The X coordinate of the spawn position. Defaults to 1.
      • pos_y (float): The Y coordinate of the spawn position. Defaults to 1.
      • pos_z (float): The Z coordinate of the spawn position. Defaults to 0.
      • scale_x (float): The scale of the cone along the X-axis. Defaults to 1.
      • scale_y (float): The scale of the cone along the Y-axis. Defaults to 1.
      • scale_z (float): The scale of the cone along the Z-axis. Defaults to 1.
      • color (str): The color of the cone. Defaults to "white".
      • rotation (float): The initial rotation of the cone (in degrees). Defaults to 0.
      • counterclockwise (bool): Whether the rotation parameter will be counterclockwise. Defaults to False.

3.0.5 change_fossbot(fossbot_name, **kwargs)

Changes an existing Fossbot's characteristics (like position, rotation, or color) in the Godot simulator.

  • Param:
    • fossbot_name (str): The name of the Fossbot you want to change in the scene. Defaults to "fossbot".
  • Optional Parameters (kwargs):
    • kwargs (optional):
      • pos_x (float): The X coordinate of the position to move the Fossbot. Defaults to 1.
      • pos_y (float): The Y coordinate of the position to move the Fossbot. Defaults to 1.
      • pos_z (float): The Z coordinate of the position to move the Fossbot. Defaults to 0.
      • color (str): The color of the Fossbot. Defaults to "blue".
      • rotation (float): The rotation of the Fossbot (in degrees). Defaults to 0.
      • counterclockwise (bool): Whether the rotation parameter will be counterclockwise. Defaults to False.

3.0.6 change_floor_size(**kwargs)

Changes the size of the floor in the Godot simulator. Make sure to change the Fossbot's position afterwards or spawn objects (so they don't fall off the scene).

  • Optional Parameters (kwargs):
    • floor_index (int): The index of the floor to apply the image to. Defaults to 0.
    • scale_x (float): The scale in the x-axis of the floor. If not specified, keeps the current floor x scale.
    • scale_y (float): The scale in the y-axis of the floor. If not specified, keeps the current floor y scale.

3.0.7 change_brightness(brightness)

Changes the brightness of the scene.

  • Param:
    • brightness (int): The value of the brightness. Defaults to 50. It should not be more than 100 or less than 0.

3.0.8 draw_image_floor(image_path: str, **kwargs)

Changes the appearance of the floor in the Godot simulator by drawing an image manually.

  • Param:
    • image_path (str): The path to the image file on your PC.
  • Optional Parameters (kwargs):
    • floor_index (int): The index of the floor to apply the image to. Defaults to 0.
    • color (str): The color of the image. Defaults to "white".
    • tripl (bool): If True, the image is drawn using the "triplanar" method; otherwise, the "manual" method is used. Defaults to False.
    • scale_x (float): The scale factor along the X-axis for the image. Defaults to 1.
    • scale_y (float): The scale factor along the Y-axis for the image. Defaults to 1.

3.0.9 draw_image_floor_auto(image_path, **kwargs)

Changes the appearance of the floor in the Godot simulator by drawing an image and automatically scaling it.

  • Param:
    • image_path (str): The path to the image file on your PC.
  • Optional Parameters (kwargs):
    • floor_index (int): The index of the floor to apply the image to. Defaults to 0.
    • color (str): The color of the image. Defaults to "white".

3.0.10 change_floor_terrain(image_path, **kwargs)

BETA VERSION: Changes the ground terrain in the Godot simulator based on the specified height map.

  • Param:
    • image_path (str): The path to the height map image file on your PC.
  • Optional Parameters (kwargs):
    • floor_index (int): The index of the floor to apply the terrain to. Defaults to 0.
    • intensity (float): The intensity of the terrain deformation. Defaults to 3.

3.0.11 reset_floor_terrain(floor_index)

Resets the terrain to the initial scene terrain of this floor index.

  • Param:
    • floor_index (int): The floor index to be reset. If only one floor exists in the scene, use index 0 (it is also the default value).

3.0.12 remove_all_objects()

Removes all objects from the scene (except for the floor and foss handler). Recommended to use it for changing scenes.

3.0.13 exit()

Exit for the environment user.