Skip to content

Conversation

@Douglas-Tilley
Copy link
Collaborator

Summary

Complete Newton physics backend implementation for the ARK simulator framework. This adds Newton as a fourth backend option alongside PyBullet, MuJoCo, and Genesis.

The Newton backend provides GPU-accelerated physics simulation using Newton's XPBD (Extended Position-Based Dynamics) solver with full integration into ARK's existing architecture.

Files Changed (14 files)

Core Framework Changes (2 files)

File Description
ark/system/simulation/simulator_node.py Added Newton backend option to the backend selection logic. When backend_type: "newton" is specified in config, the simulator now imports and instantiates NewtonBackend.
ark/client/comm_handler/subscriber.py Minor enhancement to subscriber handling for improved message processing.

Newton Backend Implementation (12 files)

File Description
ark/system/newton/newton_backend.py Main backend class implementing SimulatorBackend ABC. Handles initialization, physics stepping via XPBD solver, collision detection, and component lifecycle management. Configurable via YAML with gravity, substeps, solver iterations, and joint control parameters.
ark/system/newton/newton_builder.py Wrapper around Newton's ModelBuilder with comprehensive defensive programming. Provides safe URDF loading, joint configuration defaults, and scene metadata tracking. Ensures robots are loaded before primitives to preserve body indices.
ark/system/newton/newton_robot_driver.py Robot driver implementing ARK's RobotDriver interface. Supports TARGET_POSITION, TARGET_VELOCITY, and FORCE joint control modes. Publishes joint_state_t messages and subscribes to joint_group_command_t for arm/gripper control.
ark/system/newton/newton_camera_driver.py Camera sensor driver for RGB and depth image capture. Integrates with Newton's viewer for GPU-accelerated rendering. Publishes images via ARK's standard image channels.
ark/system/newton/newton_lidar_driver.py LiDAR sensor driver for point cloud generation using Newton's ray-casting capabilities. Configurable scan parameters (range, resolution, FOV).
ark/system/newton/newton_multibody.py Rigid body management for non-articulated objects (cubes, spheres, etc.). Handles primitive shape creation and ground truth pose publishing.
ark/system/newton/newton_viewer.py Viewer manager abstracting Newton's visualization. Supports GUI mode (OpenGL viewer) and headless mode. Handles render loop and state visualization.
ark/system/newton/geometry_descriptors.py Solver-agnostic geometry representation. Defines shape descriptors (box, sphere, capsule, mesh) that can be adapted to different Newton solvers.

Solver Adapters (4 files)

File Description
ark/system/newton/scene_adapters/__init__.py Package exports for solver adapters.
ark/system/newton/scene_adapters/base_adapter.py Abstract base class defining the adapter interface. Adapters handle solver-specific scene building requirements (ground planes, contact parameters, etc.).
ark/system/newton/scene_adapters/xpbd_adapter.py XPBD solver adapter. Uses Newton's native add_ground_plane() and standard contact handling. Default adapter for most use cases.
ark/system/newton/scene_adapters/mujoco_adapter.py MuJoCo solver adapter. Works around MuJoCo's ground plane limitations by using explicit box geometry. Useful when MuJoCo solver is preferred for specific simulation characteristics.

Architecture

The Newton backend follows ARK's existing backend pattern:

  • Implements SimulatorBackend ABC (same interface as PyBullet/MuJoCo backends)
  • Provides NewtonRobotDriver implementing RobotDriver interface
  • Integrates via backend_type: "newton" in global config YAML
  • Uses LCM pub/sub for joint state/command communication

Configuration Example

simulator:
  name: "franka_newton_simulator"
  backend_type: "newton"
  node_frequency: 240
  config:
    connection_mode: "GUI"
    gravity: [0, 0, -9.81]
    sim_frequency: 120
    substeps: 20
    solver: "xpbd"
    solver_iterations: 10
    device: "cuda:0"

    newton_physics:
      joint_defaults:
        mode: "TARGET_POSITION"
        target_ke: 4000.0
        target_kd: 100.0
        armature: 1.0

Test Plan

  • Verified backend_type: "newton" correctly loads NewtonBackend
  • Verified Newton IK solver works for pick-and-place sequence
  • Verified joint command pipeline (publish command → physics step → state feedback)
  • Verified XPBD solver stepping and collision detection
  • Verified viewer renders robot and scene correctly
  • Tested with Franka Panda robot using keyboard controller

Verification

The Newton backend is 100% Newton-native - it uses only Newton APIs for physics, kinematics, and collision detection. No PyBullet or MuJoCo code is used within the Newton backend implementation.

Future Work (TODO)

  • Add Featherstone solver adapter for articulated body dynamics
  • Add Semi-Implicit solver adapter for faster but less stable simulations
  • Implement force/torque sensor driver
  • Add contact force reporting via LCM messages
  • Support for soft body simulation (Newton's FEM capabilities)
  • Expose parallel environment replication via YAML config

Complete Newton physics backend implementation for the ARK simulator
framework. This adds Newton as a fourth backend option alongside
PyBullet, MuJoCo, and Genesis.

The Newton backend provides GPU-accelerated physics simulation using
Newton's XPBD (Extended Position-Based Dynamics) solver with full
integration into ARK's existing architecture.

Core Framework Changes:
- simulator_node.py: Added Newton backend option to backend selection
  logic. When backend_type: "newton" is specified, the simulator
  imports and instantiates NewtonBackend.
- subscriber.py: Minor enhancement to subscriber handling for improved
  message processing.

Newton Backend Implementation:
- newton_backend.py: Main backend class implementing SimulatorBackend
  ABC. Handles initialization, physics stepping, collision detection,
  and component lifecycle management. Configurable via YAML with
  gravity, substeps, solver iterations, and joint control parameters.
- newton_builder.py: Wrapper around Newton's ModelBuilder with
  comprehensive defensive programming. Provides safe URDF loading,
  joint configuration defaults, and scene metadata tracking.
- newton_robot_driver.py: Robot driver implementing RobotDriver
  interface. Supports TARGET_POSITION, TARGET_VELOCITY, and FORCE
  joint control modes. Publishes joint_state_t and subscribes to
  joint_group_command_t for arm/gripper control.
- newton_camera_driver.py: Camera sensor driver for RGB and depth
  capture using Newton's viewer for GPU-accelerated rendering.
- newton_lidar_driver.py: LiDAR sensor driver using Newton's
  ray-casting capabilities with configurable scan parameters.
- newton_multibody.py: Rigid body management for non-articulated
  objects (cubes, spheres, etc.).
- newton_viewer.py: Viewer manager supporting GUI mode (OpenGL)
  and headless mode for render loop and state visualization.
- geometry_descriptors.py: Solver-agnostic geometry representation
  for shape descriptors adaptable to different Newton solvers.

Solver Adapters:
- scene_adapters/base_adapter.py: Abstract base class defining the
  adapter interface for solver-specific scene building.
- scene_adapters/xpbd_adapter.py: XPBD solver adapter using Newton's
  native add_ground_plane() and standard contact handling.
- scene_adapters/mujoco_adapter.py: MuJoCo solver adapter with
  workaround for ground plane limitations using box geometry.

The Newton backend is 100% Newton-native - it uses only Newton APIs
for physics, kinematics, and collision detection.
"""

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Dict
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use 'dict' type instead of Dict

Comment on lines -34 to -37
observation_channels: dict[str, type] | None = None,
action_channels: dict[str, type] | None = None,
namespace: str = "ark",
):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove this . please keep latest changes

Comment on lines -50 to -53
self.global_config["observation_channels"] = observation_channels
self.global_config["action_channels"] = action_channels
self.global_config["namespace"] = namespace

Copy link
Contributor

@Refinath Refinath Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the latest changes exists in the main branch [not only these changes]

Copy link
Contributor

@Refinath Refinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants