This guide outlines the coding standards and conventions used in the AlpaSim repository.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/NVlabs/alpasim/llms.txt
Use this file to discover all available pages before exploring further.
Linting and Formatting
Linting is performed using pre-commit with black.Setup
To set up pre-commit hooks locally:Python Style Guide
General Guidelines
- Python version: 3.12+
- Indentation: 4 spaces (no tabs)
- Encoding: UTF-8 ASCII unless data demands otherwise
- Auto-format: Use
blackfor code formatting - Import sorting: Automatically sorted by pre-commit hooks
- Linting: Use
ruffto satisfy lint warnings before pushing
PEP 8 Compliance
Generally, follow the PEP 8 guidelines for naming conventions.Due to the subject matter in simulation, there are additional conventions that help with readability and prevent costly misunderstandings.
Naming Conventions
Coordinate Systems
There are four primary coordinate systems used in simulations:Local Frame
Local Frame
An inertial frame, fixed on a per-scenario basis, which represents an ENU frame defined by NRE.
Rig Frame
Rig Frame
A body-fixed frame with the following properties:
- The x-axis points forward
- The y-axis points to the left when looking forward
- The z-axis points up
- The origin is at the center of the rear axle, projected onto the ground plane
AABB Frame
AABB Frame
Axis-Aligned Bounding Box frame: a body-fixed frame, defined with the same orientation as the rig definition, but the origin at the center of the object bounding box.
ECEF Frame
ECEF Frame
Earth-Centered, Earth-Fixed frame: an inertial global frame, based on WGS84.
Transforms and Coordinate Frames
Definition: An active transform moves or rotates an object within a fixed coordinate frame, while a passive transform changes the coordinate frame itself in which the object is described.The position of
B in the coordinate frame of A is the same as the active transform from A to B (i.e., A->B).To change notation from coordinate frame A to B, use the passive transform B->A = (A->B).inverse().Vectors, Rotations, and Poses
Vectors representing positions, velocities, and accelerations should be named according to the frame in which they are defined.Position Naming Examples
Relative Position Examples
Rotation and Pose Examples
Complete Example
Testing Guidelines
Test Organization
- Place tests next to their module under
src/<module>/tests - Name test files
test_*.py - Default pytest config skips
@pytest.mark.manualsuites - Mark long-running or cluster-dependent cases accordingly
Best Practices
Running Tests
Import Guidelines
Documentation Guidelines
- Document complex flows with concise comments
- Prefer dataclasses and type hints for public APIs
- Keep documentation close to the code it describes
Commit Message Format
- Keep commits focused and imperative (e.g.,
runtime: guard invalid rig transforms) - Avoid
wipin final history - Reference issue IDs when applicable
Project Structure
Core packages live insrc/<module>. Each module (e.g., runtime, wizard, grpc, utils, ddb, physics, avmf, tools, controller, driver, eval) bundles its code with a colocated tests folder.
Static Type Checking
Next Steps
Contributing Guide
Learn how to contribute to AlpaSim
Maintainers
View project maintainers and roles