Trajectory

DSL supports adding trajectory to the entity. Trajectory is an important component especially for robotic related tasks. In the MINERVAS system, users could sample a random trajectory or add a handcrafted trajectory to the camera.

There are three types of trajectories:

Attributes

AttributeTypeDescriptionDefault valueRequired
typestrRANDOM (random trajectory); COVERAGE (bow-shape trajectory); DEFINED (user customized trajectory, usually by tapping the key frame in the scene).-Yes
pitchfloatThe angle of pitch-Yes
heightfloatThe height of camera. The unit is mm.-Yes

Get trajectory and its attributes

Function explanation

  • self.shader.world.trajectories: Get trajectory list in the scene.
  • trajectory.{attr_name}: Get attributes of trajectory.

example:

from ksecs.ECS.processors.entity_processor import EntityProcessor
class ReadTrajDsl(EntityProcessor):
    def process(self):
        # loop all trajectories
        for traj in self.shader.world.trajectories:
            cameraHeight = traj.height

Add trajectory

Add coverage trajectory

  • self.shader.world.add_trajectory({attr_name}={attr_value}): create a new trajectory and add to the scene.

example:

from ksecs.ECS.processors.entity_processor import EntityProcessor
class CreateTrajDsl(EntityProcessor):
  def process(self):
    for room in self.shader.world.rooms:

            # Get room center
            room_center_x, room_center_y = room.position

            # Create trajectory of initial camera
            camera = self.shader.world.create_camera(
                id=room.id,

                hfov=110,
                vfov=125,

                imageWidth=1280,
                imageHeight=720,

                position=[room_center_x, room_center_y, 70],

                fnumber=8,
                iso=100,
                shutterSpeed=2
            )

            self.shader.world.add_trajectory(
                id=room.id,

                initCamera=camera,

                fps=3,

                speed=1500,

                pitch=0,

                height=70,

                collisionPadding=350,

                boundary=room.boundary,

                type="COVERAGE"
            )

Add Customized trajectory

from ksecs.ECS.processors.entity_processor import EntityProcessor
class CreateTrajDsl(EntityProcessor):
    def process(self):
        self.make_traj(**param)

Example

The example for customized trajectory is shown in SLAM section.