CameraCfg API Reference#
Complete API reference for CameraCfg configuration class.
Class Definition#
from genesislab.engine.scene import CameraCfg
@configclass
class CameraCfg:
"""Camera configuration for scene rendering and recording."""
Parameters#
Resolution#
res: tuple[int, int]#
Type:
tuple[int, int]Default:
(1280, 720)Description: Camera resolution (width, height)
Example:
res=(1920, 1080) # Full HD res=(1280, 720) # HD res=(640, 480) # SD
Position & Orientation#
pos: tuple[float, float, float]#
Type:
tuple[float, float, float]Default:
(3.5, 0.0, 2.5)Description: Camera position (x, y, z)
If
entity_name=None: world frame positionIf
entity_nameset: offset from entity in local frame
Example:
pos=(5.0, 0.0, 3.0) # World: 5m forward, 3m up pos=(-3.0, 0.0, 2.5) # Local: 3m behind, 2.5m up
lookat: tuple[float, float, float]#
Type:
tuple[float, float, float]Default:
(0.0, 0.0, 0.5)Description: Camera look-at target (x, y, z)
If
entity_name=None: world frame targetIf
entity_nameset: target direction in local frame
Example:
lookat=(0.0, 0.0, 0.5) # World: look at origin lookat=(1.0, 0.0, 0.0) # Local: look forward (+X)
up: tuple[float, float, float]#
Type:
tuple[float, float, float]Default:
(0.0, 0.0, 1.0)Description: Camera up direction (x, y, z)
Note: Usually keep default (Z-up)
fov: float#
Type:
floatDefault:
40.0Range:
(0, 180)Description: Vertical field of view in degrees
Example:
fov=30.0 # Narrow (telephoto) fov=45.0 # Normal fov=75.0 # Wide (first person) fov=90.0 # Very wide
Tracking#
track_mode: Optional[str]#
Type:
Optional[Literal["static", "chase", "follow", "side", "top", "first_person"]]Default:
NoneDescription: Camera tracking mode preset
Values:
None: Manual configuration"static": Static camera (world frame)"chase": Chase camera (behind and above) ⭐"follow": Follow camera (over-the-shoulder)"side": Side view"top": Top-down view"first_person": First-person view
Example:
track_mode="chase" # Use chase preset track_mode=None # Manual configuration
entity_name: Optional[str]#
Type:
Optional[str]Default:
NoneDescription: Entity name to attach camera to
None: Static camera in world frame"robot": Attach to robot entity
Example:
entity_name="robot" # Follow robot entity_name="robot_0" # Follow specific robot entity_name=None # Static camera
link_name: Optional[str]#
Type:
Optional[str]Default:
NoneDescription: Link name to attach camera to (if entity_name is set)
None: Attach to entity rootLink name: Attach to specific link
Common values:
"pelvis","base_link","head","torso"Example:
link_name="pelvis" # Attach to pelvis link_name="head" # Attach to head link_name=None # Attach to root
Backend#
backend: str#
Type:
Literal["rasterizer", "raytracer", "batch_renderer"]Default:
"rasterizer"Description: Camera rendering backend
Values:
"rasterizer": Fast, real-time (default)"raytracer": High-quality, slow"batch_renderer": Very fast for multi-env RL
Example:
backend="rasterizer" # Default, fast backend="raytracer" # High quality backend="batch_renderer" # Multi-env RL
Display#
show_in_gui: bool#
Type:
boolDefault:
FalseDescription: Whether to show camera window in viewer GUI
Note: Only works when
viewer=TrueExample:
show_in_gui=True # Show camera window show_in_gui=False # No GUI window
Methods#
__post_init__()#
Validates configuration and applies track_mode presets.
Validation:
resmust be 2-tuple with positive valuesfovmust be in range (0, 180)
Track mode application:
If
track_modeis set, applies preset values forpos,lookat,fov,link_name
Usage Examples#
Basic Static Camera#
from genesislab.engine.scene import CameraCfg
camera = CameraCfg(
res=(1920, 1080),
pos=(5.0, 0.0, 3.0),
lookat=(0.0, 0.0, 0.5),
fov=45.0,
)
Chase Tracking (Preset)#
camera = CameraCfg(
track_mode="chase",
entity_name="robot",
res=(1920, 1080),
)
Custom Entity Attachment#
camera = CameraCfg(
entity_name="robot",
link_name="pelvis",
pos=(-3.0, 0.0, 2.5), # Behind and above
lookat=(1.0, 0.0, 0.5), # Look forward
fov=50.0,
backend="rasterizer",
)
First Person View#
camera = CameraCfg(
track_mode="first_person",
entity_name="robot",
res=(1280, 720),
)
# Equivalent to:
# camera = CameraCfg(
# entity_name="robot",
# link_name="pelvis",
# pos=(0.0, 0.0, 0.2),
# lookat=(1.0, 0.0, 0.0),
# fov=75.0,
# )
Override Preset#
camera = CameraCfg(
track_mode="chase", # Use chase preset
entity_name="robot",
pos=(-4.0, 0.5, 3.0), # Override position
fov=55.0, # Override FOV
)
Track Mode Presets#
Complete preset configurations:
Static#
{
"pos": (5.0, 0.0, 3.0),
"lookat": (0.0, 0.0, 0.5),
"entity_name": None, # Force static
"fov": 45.0,
}
Chase#
{
"pos": (-3.5, 0.0, 2.5), # Behind and above
"lookat": (1.0, 0.0, 0.5), # Look forward
"fov": 50.0,
}
Follow#
{
"pos": (-2.0, 0.5, 1.8), # Behind, slight side
"lookat": (1.0, 0.0, 0.8), # Look forward, up
"fov": 45.0,
}
Side#
{
"pos": (0.0, -3.0, 1.5), # Right side
"lookat": (0.0, 0.5, 0.8), # Look inward
"fov": 45.0,
}
Top#
{
"pos": (0.0, 0.0, 5.0), # Above
"lookat": (0.5, 0.0, -1.0), # Look down
"fov": 60.0,
}
First Person#
{
"pos": (0.0, 0.0, 0.2), # Slightly above link
"lookat": (1.0, 0.0, 0.0), # Look forward
"link_name": "pelvis",
"fov": 75.0,
}
Integration with SceneCfg#
from genesislab.engine.scene import SceneCfg, CameraCfg
scene_cfg = SceneCfg(
viewer=False,
camera=CameraCfg(
track_mode="chase",
entity_name="robot",
),
)
See Also#
RecordingCfg API - Recording configuration
SceneCfg Extensions - Scene configuration
Tracking Guide - Robot tracking guide
Configuration Guide - Detailed configuration