### Run Wandelbots Nova Examples (Bash) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/examples/README.md Demonstrates how to execute the provided Wandelbots Nova examples using the command line. It requires setting the PYTHONPATH environment variable and using the 'uv run' command to execute Python scripts within the examples directory. ```bash PYTHONPATH=. uv run python examples/.py ``` ```bash PYTHONPATH=. uv run python examples/01_basic.py ``` -------------------------------- ### Configure Nova SDK with NovaConfig (Python) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/docs/getting_started.md Demonstrates how to manually configure the Nova SDK for different environments like the Wandelbots Portal or an IPC. The NovaConfig class holds connection details such as host and access token, which are then passed to the Nova instance. ```python from nova.config import NovaConfig portal_config = NovaConfig( host="https://xxxxx.instance.wandelbots.io", access_token="your_access_token", ) ipc_config = NovaConfig( host="http://192.168.0.10", ) async with Nova(config=portal_config) as nova: print("Connected to the Portal instance") async with Nova(config=ipc_config) as nova: print("Connected to the IPC instance") ``` -------------------------------- ### Install a development build of wandelbots-nova Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Installs a development version of the 'wandelbots-nova' library directly from a Git commit. This is useful for testing specific commits or unreleased changes. ```bash pip install "wandelbots-nova @ git+https://github.com/wandelbotsgmbh/wandelbots-nova.git@" ``` -------------------------------- ### Manually Install Robot Models Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/helper_scripts/README.md This describes the manual process for installing robot models, which involves copying files from a GitHub repository and running a shell script. This method is a fallback if automated methods fail or are not preferred. It's necessary because trimesh, a dependency, does not support Draco compressed models. ```bash # manually # Copy the models from [the react component lib](https://github.com/wandelbotsgmbh/wandelbots-js-react-components/tree/main/public/models) into the draco folder. # Run the unpack_models.sh script to unpack the models. # This is necessary as trimesh does not support draco compressed models. ``` -------------------------------- ### Install Wandelbots Nova with Wandelscript (Shell) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Command to install the wandelbots-nova package along with Wandelscript extras using uv. This enables the use of Wandelscript for robot programming. ```shell uv add wandelbots-nova --extra wandelscript ``` -------------------------------- ### Basic Wandelscript Program Example Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md A simple Wandelscript program demonstrating robot control, including setting velocity, moving via point-to-point (ptp) and linear (line) paths, and using a reference pose. ```python robot = get_controller("controller")[0] tcp("Flange") home = read(robot, "pose") sync # Set the velocity of the robot to 200 mm/s velocity(200) for i = 0..3: move via ptp() to home # Move to a pose concatenating the home pose move via line() to (50, 20, 30, 0, 0, 0) :: home move via line() to (100, 20, 30, 0, 0, 0) :: home move via line() to (50, 20, 30, 0, 0, 0) :: home move via ptp() to home ``` -------------------------------- ### Configure Nova SDK using Environment Variables (Python) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/docs/getting_started.md Explains how to configure the Nova SDK by storing connection details in environment variables, typically within a .env file. This approach is useful for deployment and sharing code, as the SDK automatically picks up these variables. ```plaintext NOVA_API=https://xxxxx.instance.wandelbots.io NOVA_ACCESS_TOKEN=your_access_token ``` ```python from nova import Nova async with Nova() as nova: print("Connected using environment variables") ``` -------------------------------- ### Initialize Nova SDK in VS Code Workspace (Python) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/docs/getting_started.md This snippet shows the simplest way to initialize the Nova SDK when running code within the Visual Studio Code workspace. It leverages automatic configuration provided by the Nova platform, eliminating the need for explicit hostnames, tokens, or certificates. ```python from nova import Nova async with Nova() as nova: ... ``` -------------------------------- ### Install Wandelbots NOVA Python SDK Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Installs the Wandelbots NOVA Python SDK using pip or uv. The uv command also allows for installing with extra visualization support and downloading necessary models. ```bash # Install with pip pip install wandelbots-nova # Install with uv and visualization support uv add wandelbots-nova --extra nova-rerun-bridge uv run download-models ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Installs project dependencies, including the 'nova-rerun-bridge' extra, using the 'uv sync' command. This is the primary method for setting up the project's required packages. ```bash uv sync --extra "nova-rerun-bridge" ``` -------------------------------- ### Create a new NOVAx app using Python Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md This command uses the NOVA CLI to generate a new NOVAx application with a Python backend. Ensure you have the NOVA CLI installed. ```bash nova app create "your-nova-app" -g python_app ``` -------------------------------- ### Download Robot Models using uv Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/helper_scripts/README.md This command downloads robot models when Wandelbots Nova is installed using uv. It's a straightforward command-line execution. ```bash # If installed via uv uv run download-models ``` -------------------------------- ### Python: Setup Virtual Robot Controller for Simulation Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt This Python script shows how to create and configure a virtual robot controller for simulation purposes using the Wandelbots Nova library. It defines the controller's manufacturer and type, ensures its existence in the cell, and sets its mounting position and coordinate system. This is useful for testing robot programs without physical hardware. ```python import asyncio from nova import Nova, api from nova.cell import virtual_controller async def setup_virtual_robot(): async with Nova() as nova: cell = nova.cell() # Define virtual controller configuration config = virtual_controller( name="virtual_kuka", manufacturer=api.models.Manufacturer.KUKA, type=api.models.VirtualControllerTypes.KUKA_KR16_R2010_2, ) # Ensure controller exists (creates if not present) controller = await cell.ensure_controller(config) # Or explicitly add a new controller # controller = await cell.add_controller(config) # Configure mounting position await nova.api.virtual_robot_setup_api.set_virtual_controller_mounting( cell=cell.id, controller=controller.id, motion_group=f"0@{controller.id}", coordinate_system=api.models.CoordinateSystem( name="mounting", coordinate_system="world", position=api.models.Vector3d([0, 0, 500]), # 500mm height orientation=api.models.Orientation([0, 0, 0]), orientation_type=api.models.OrientationType.EULER_ANGLES_EXTRINSIC_XYZ, ), ) # Available virtual controller types: # - KUKA: KUKA_KR16_R2010_2, KUKA_KR6_R900_2, etc. # - Universal Robots: UNIVERSALROBOTS_UR3E, UR5E, UR10E, UR16E, UR20, UR30 # - ABB: ABB_IRB_1200_5_90, ABB_IRB_6700_155_285, etc. # - Fanuc: FANUC_CRX_10IA_L, FANUC_M20IA_35M, etc. # - Yaskawa: YASKAWA_GP12, YASKAWA_HC10, etc. asyncio.run(setup_virtual_robot()) ``` -------------------------------- ### Build Package with uv Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Builds the Python package using the 'uv build' command. This prepares the package for distribution or installation. ```bash uv build ``` -------------------------------- ### Python: Setup Collision Geometries and Plan Collision-Free Motion Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt This Python script demonstrates how to define various collision geometries (spheres, boxes), retrieve robot link collision models, create a collision setup, store it, and then plan and execute a collision-free motion using an RRT-based algorithm. It requires the 'nova' library and uses asyncio for asynchronous operations. ```python import asyncio from nova import Nova, api from nova.actions import cartesian_ptp, collision_free from nova.types import Pose, MotionSettings async def collision_example(): async with Nova() as nova: cell = nova.cell() controller = await cell.controller("ur10e") async with controller[0] as motion_group: # Define obstacle colliders sphere_obstacle = api.models.Collider( shape=api.models.Sphere(radius=100, shape_type="sphere"), pose=api.models.Pose( position=api.models.Vector3d([300, 0, 200]), orientation=api.models.RotationVector([0, 0, 0]), ), ) box_obstacle = api.models.Collider( shape=api.models.Box( size_x=200, size_y=100, size_z=300, shape_type="box", box_type=api.models.BoxType.FULL ), pose=api.models.Pose( position=api.models.Vector3d([0, 400, 150]), orientation=api.models.RotationVector([0, 0, 0]), ), ) # Get robot link collision model description = await motion_group.get_description() collision_model = await nova.api.motion_group_models_api.get_motion_group_collision_model( motion_group_model=description.motion_group_model.root ) link_chain = api.models.LinkChain( [api.models.Link(link) for link in collision_model] ) # Create collision setup collision_setup = api.models.CollisionSetup( colliders=api.models.ColliderDictionary({ "sphere": sphere_obstacle, "box": box_obstacle, }), link_chain=link_chain, ) # Store collision setup await nova.api.store_collision_setups_api.store_collision_setup( cell=cell.id, setup="my_collision_scene", collision_setup=collision_setup ) # Plan collision-free motion tcp = (await motion_group.tcp_names())[0] target = Pose((500, -300, 200, 3.14, 0, 0)) action = collision_free( target=target, collision_setup=collision_setup, settings=MotionSettings(tcp_velocity_limit=50), algorithm=api.models.CollisionFreeAlgorithm( api.models.RRTConnectAlgorithm(max_iterations=10000) ) ) trajectory = await motion_group.plan([action], tcp) await motion_group.execute(trajectory, tcp, actions=[action]) asyncio.run(collision_example()) ``` -------------------------------- ### Download Robot Models using pip Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/helper_scripts/README.md This command downloads robot models when Wandelbots Nova is installed using pip. It utilizes the python module to execute the download process. ```bash # If installed via pip python -m nova_rerun_bridge.models.download_models ``` -------------------------------- ### Initialize NovaRerunBridge and Setup Visualization Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This Python code initializes the Nova and NovaRerunBridge objects, connecting to a Nova instance using either a config object or environment variables. It then sets up the visualization blueprint. ```python from nova_rerun_bridge import NovaRerunBridge from nova import Nova, NovaConfig # Connect to your Nova instance (or use .env file) nova = Nova( config=NovaConfig( host="https://your-instance.wandelbots.io", access_token="your-access-token" ) ) bridge = NovaRerunBridge(nova) # Setup visualization await bridge.setup_blueprint() ``` -------------------------------- ### Install Rerun and Nova Rerun Bridge Nova Apps Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md These bash commands install the rerun and nova-rerun-bridge applications on your Nova instance using the Nova CLI. This enables automatic collection of planned motions and provides a rerun bridge app for downloading visualization data. ```bash nova catalog install rerun nova catalog install nova-rerun-bridge ``` -------------------------------- ### Coordinate Multiple Robots Simultaneously (Python) Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Demonstrates how to coordinate and execute motion sequences on multiple robots concurrently using asyncio tasks. This example defines a program that controls two different virtual robot controllers in parallel, showcasing distributed robot control. ```python import asyncio import nova from nova import Controller, api, run_program from nova.actions import cartesian_ptp, joint_ptp from nova.cell import virtual_controller from nova.types import Pose async def move_robot(controller: Controller, robot_name: str): """Move a single robot through a motion sequence.""" async with controller[0] as motion_group: home_joints = await motion_group.joints() tcp = (await motion_group.tcp_names())[0] current_pose = await motion_group.tcp_pose(tcp) target_pose = current_pose @ Pose((100, 0, 0, 0, 0, 0)) actions = [ joint_ptp(home_joints), cartesian_ptp(target_pose), joint_ptp(home_joints) ] await motion_group.plan_and_execute(actions, tcp) print(f"{robot_name} completed motion") @nova.program( name="Multi Robot Demo", preconditions=nova.ProgramPreconditions( controllers=[ virtual_controller( name="robot1", manufacturer=api.models.Manufacturer.UNIVERSALROBOTS, type=api.models.VirtualControllerTypes.UNIVERSALROBOTS_UR10E, ), virtual_controller( name="robot2", manufacturer=api.models.Manufacturer.KUKA, type=api.models.VirtualControllerTypes.KUKA_KR16_R2010_2, ), ], cleanup_controllers=False, ), ) def multi_robot_program(ctx: nova.ProgramContext): cell = ctx.nova.cell() robot1 = await cell.controller("robot1") robot2 = await cell.controller("robot2") # Execute both robots simultaneously await asyncio.gather( move_robot(robot1, "Robot 1"), move_robot(robot2, "Robot 2") ) print("All robots completed!") if __name__ == "__main__": run_program(multi_robot_program) ``` -------------------------------- ### Install Development Branch Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This snippet shows how to add the wandelbots-nova package from a specific git branch to your pyproject.toml. This is useful for testing features from a development branch. ```toml nova-rerun-bridge = { git = "https://github.com/wandelbotsgmbh/nova-rerun-bridge.git", branch = "feature/branchname" } ``` -------------------------------- ### Real-time 3D Robot Motion Visualization with Python and Rerun Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt This Python code snippet demonstrates how to enable real-time 3D visualization of robot movements, trajectories, and collision setups using the Rerun viewer integrated with the Wandelbots NOVA SDK. It sets up a virtual KUKA robot, logs safety zones, plans and logs a motion trajectory, and then executes the trajectory with visualization enabled. Dependencies include the 'nova' and 'nova_rerun_bridge' libraries. ```python import nova from nova import api, run_program from nova.cell import virtual_controller from nova.actions import joint_ptp, cartesian_ptp from nova.types import Pose, MotionSettings from nova_rerun_bridge import NovaRerunBridge @nova.program( name="Visualized Motion", viewer=nova.viewers.Rerun(), # Enable Rerun visualization preconditions=nova.ProgramPreconditions( controllers=[ virtual_controller( name="robot", manufacturer=api.models.Manufacturer.KUKA, type=api.models.VirtualControllerTypes.KUKA_KR16_R2010_2, ) ], ), ) async def visualized_motion(ctx: nova.ProgramContext): async with NovaRerunBridge(ctx.nova) as bridge: await bridge.setup_blueprint() cell = ctx.nova.cell() controller = await cell.controller("robot") async with controller[0] as motion_group: tcp = (await motion_group.tcp_names())[0] home = await motion_group.joints() current = await motion_group.tcp_pose(tcp) # Log safety zones await bridge.log_safety_zones(motion_group) actions = [ joint_ptp(home), cartesian_ptp(current @ Pose((200, 0, 0, 0, 0, 0))), cartesian_ptp(current @ Pose((200, 200, 0, 0, 0, 0))), joint_ptp(home), ] trajectory = await motion_group.plan(actions, tcp) # Log trajectory to Rerun viewer await bridge.log_trajectory(trajectory, tcp, motion_group) # Execute with visualization await motion_group.execute(trajectory, tcp, actions=actions) if __name__ == "__main__": run_program(visualized_motion) ``` -------------------------------- ### Log Collision Scene Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This Python code logs collision setups to the Rerun visualizer. This feature is useful for analyzing potential collisions in a robot's workspace. ```python # Log collision scenes await bridge.log_collision_setups() ``` -------------------------------- ### Add wandelbots-nova to pyproject.toml Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This snippet shows how to add the wandelbots-nova package with the nova-rerun-bridge extra to your project's pyproject.toml file. This ensures the necessary components for the rerun bridge are installed. ```toml wandelbots-nova = { version = ">=0.12", extras = ["nova-rerun-bridge"] } ``` -------------------------------- ### Interact with Robot Controllers and Motion Groups in Wandelbots NOVA Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Shows how to access and interact with robot controllers and their motion groups using the Nova client. It covers getting specific controllers, listing all controllers, and accessing motion group states like joint positions and TCP poses. ```python import asyncio from nova import Nova async def main(): async with Nova() as nova: cell = nova.cell() # Get a specific controller by name controller = await cell.controller("ur10e") # List all controllers all_controllers = await cell.controllers() # Access motion group (use as context manager) async with controller[0] as motion_group: # Get current state joints = await motion_group.joints() print(f"Joint positions: {joints}") tcp_names = await motion_group.tcp_names() print(f"Available TCPs: {tcp_names}") pose = await motion_group.tcp_pose(tcp_names[0]) print(f"TCP pose: {pose}") # Get robot state state = await motion_group.get_state() print(f"Robot state - joints: {state.joints}, pose: {state.pose}") asyncio.run(main()) ``` -------------------------------- ### Stream Robot State Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md These Python snippets demonstrate how to start and stop streaming the current robot state to the Rerun visualizer. Continuous monitoring of the robot's state is enabled by this functionality. ```python # Start streaming robot state await bridge.start_streaming(motion_group) # Stop streaming all robot states await bridge.stop_streaming() ``` -------------------------------- ### Initialize Nova Client for Wandelbots NOVA Platform Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Demonstrates how to initialize the Nova client to connect to the Wandelbots NOVA platform. It shows both recommended context manager usage and manual connection management with open() and close() methods. ```python import asyncio from nova import Nova async def main(): # Using context manager (recommended) async with Nova() as nova: cell = nova.cell() controllers = await cell.controllers() print(f"Found {len(controllers)} controllers") # Manual connection management nova = Nova() await nova.open() try: cell = nova.cell() # ... perform operations finally: await nova.close() asyncio.run(main()) ``` -------------------------------- ### Import Wandelbots Nova SDK (Python) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Demonstrates how to import the main Nova class from the Wandelbots Nova SDK in Python. This is essential for interacting with the NOVA API. ```python from nova import Nova ``` -------------------------------- ### Configure Environment Variables (.env.template to .env) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md This snippet shows how to copy the environment template file and rename it to .env. This is the first step in configuring the Wandelbots NOVA server instance, requiring NOVA_API and NOVA_ACCESS_TOKEN. ```bash cp .env.template .env ``` -------------------------------- ### Core Usage Pattern with Nova SDK Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Demonstrates the core usage pattern for the Wandelbots NOVA Python SDK. It shows how to initialize the Nova client, access cell and controller information, plan and execute motion actions asynchronously. ```python from nova import Nova async with Nova() as nova: cell = nova.cell() controller = await cell.controller("robot-name") motion_group = controller[0] actions = [joint_ptp(joints), linear(pose)] trajectory = await motion_group.plan(actions, tcp_name) await motion_group.execute(trajectory, tcp_name, actions=actions) ``` -------------------------------- ### Build Robot Application Servers with NOVAx and FastAPI Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt This snippet illustrates how to use the NOVAx Application Framework to build robot application servers with FastAPI. It covers program registration, lifecycle management, and exposes robot programs via a REST API. Dependencies include 'fastapi', 'novax', and 'nova'. ```python from fastapi import FastAPI, APIRouter from novax import Novax import nova from nova import api from nova.cell import virtual_controller # Initialize NOVAx novax = Novax() # Define a robot program @nova.program( id="pick_and_place", name="Pick and Place", preconditions=nova.ProgramPreconditions( controllers=[ virtual_controller( name="robot", manufacturer=api.models.Manufacturer.UNIVERSALROBOTS, type=api.models.VirtualControllerTypes.UNIVERSALROBOTS_UR10E, ) ] ), ) async def pick_and_place(ctx: nova.ProgramContext, pick_x: float = 100, pick_y: float = 200): """Pick and place operation.""" cell = ctx.cell controller = await cell.controller("robot") async with controller[0] as motion_group: # ... implement pick and place logic pass # Register programs novax.register_program(pick_and_place) # Create FastAPI app with NOVAx lifecycle router = APIRouter() @router.get("/programs") async def list_programs(): return await novax.get_programs() app = FastAPI(lifespan=novax.program_store_lifespan(router)) app.include_router(router) # Run with: uvicorn app:app --reload ``` -------------------------------- ### Import Wandelbots Nova API Module (Python) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Shows how to import the api module from the Wandelbots Nova SDK in Python. This module provides access to the automatically generated NOVA API client. ```python from nova import api ``` -------------------------------- ### Run Pre-commit Hooks Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Executes pre-commit hooks on specified files. This command is used to ensure code quality and consistency before committing changes. Replace '' with the actual file paths. ```bash pre-commit run --files ``` -------------------------------- ### Define Robot Programs with Wandelbots NOVA Decorator Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Illustrates defining robot programs using the `@nova.program` decorator. This includes setting program metadata, preconditions for controllers, and defining the program's asynchronous function which receives a `ProgramContext`. ```python import nova from nova import api, run_program from nova.cell import virtual_controller from nova.types import Pose, MotionSettings from nova.actions import joint_ptp, cartesian_ptp @nova.program( id="my_robot_program", name="My Robot Program", # viewer=nova.viewers.Rerun(), # Enable 3D visualization preconditions=nova.ProgramPreconditions( controllers=[ virtual_controller( name="ur10e", manufacturer=api.models.Manufacturer.UNIVERSALROBOTS, type=api.models.VirtualControllerTypes.UNIVERSALROBOTS_UR10E, ) ], cleanup_controllers=False, ), ) async def my_program(ctx: nova.ProgramContext, speed: int = 100): """A sample robot program that moves to a target pose.""" cell = ctx.cell controller = await cell.controller("ur10e") async with controller[0] as motion_group: home_joints = await motion_group.joints() tcp = (await motion_group.tcp_names())[0] current_pose = await motion_group.tcp_pose(tcp) target_pose = current_pose @ Pose((100, 50, 0, 0, 0, 0)) actions = [ joint_ptp(home_joints, settings=MotionSettings(tcp_velocity_limit=speed)), cartesian_ptp(target_pose, settings=MotionSettings(tcp_velocity_limit=speed)), joint_ptp(home_joints), ] await motion_group.plan_and_execute(actions, tcp) print("Program completed!") if __name__ == "__main__": run_program(my_program) ``` -------------------------------- ### Run Wandelscript CLI Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Executes Wandelscript code using the Wandelscript CLI. The command 'uv run wandelscript my_script.ws' runs the specified script, and 'uv run ws my_script.ws' is a shortcut for the same action. ```bash uv run wandelscript my_script.ws uv run ws my_script.ws # shortcut ``` -------------------------------- ### Format and Check Code with Ruff Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/examples/your-nova-app/README.md This snippet demonstrates how to format and check Python code using Ruff, a fast Python linter and formatter. It ensures code style consistency and identifies potential issues. ```bash uv run ruff format uv run ruff check --select I --fix ``` -------------------------------- ### Deploy with Skaffold Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This bash command uses skaffold to build and deploy the application to a local Kubernetes cluster. It's configured to disable cleanup and status checks for development purposes. ```bash skaffold dev --cleanup=false --status-check=false ``` -------------------------------- ### Run Unit Tests with pytest Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Runs all unit tests, excluding integration tests, using 'pytest'. The 'PYTHONPATH=.' prefix ensures the current directory is in the Python path for test discovery. The '-rs -v' flags provide verbose output and show the reason for skipped tests. ```bash PYTHONPATH=. uv run pytest -rs -v -m "not integration" ``` -------------------------------- ### Program Decorator Pattern with Nova SDK Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Illustrates the program decorator pattern for defining executable robot programs using the Wandelbots NOVA Python SDK. The `@nova.program` decorator registers a function as a robot program, providing context for execution. ```python @nova.program(id="my-program", name="My Program") cell = ctx.cell async def my_program(ctx: nova.ProgramContext): cycle = ctx.cycle() ``` -------------------------------- ### Lint YAML files with Docker Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Runs Yamllint inside a Docker container to lint YAML configuration files within the current directory. This ensures YAML files adhere to specified linting rules. ```bash docker run --rm -it -v $(pwd):/data cytopia/yamllint -d .yamllint . ``` -------------------------------- ### Control Robot IO: Read and Write Digital/Analog Signals (Python) Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Demonstrates how to read and write digital and analog I/O signals on a robot controller. This is useful for interfacing with external equipment like grippers and sensors. It shows direct I/O operations and I/O actions within a motion sequence. ```python import asyncio from nova import Nova async def io_example(): async with Nova() as nova: cell = nova.cell() controller = await cell.controller("ur10e") # Read digital output value = await controller.read("tool_out[0]") print(f"tool_out[0] = {value}") # Write digital output (e.g., activate gripper) await controller.write("tool_out[0]", True) await asyncio.sleep(0.5) await controller.write("tool_out[0]", False) # Read analog input analog_value = await controller.read("analog_in[0]") print(f"Analog input: {analog_value}") # IO actions within motion sequence from nova.actions import io_write, cartesian_ptp actions = [ cartesian_ptp(target_pose), io_write(key="tool_out[0]", value=True), # Activate at position cartesian_ptp(next_pose), io_write(key="tool_out[0]", value=False), # Deactivate ] asyncio.run(io_example()) ``` -------------------------------- ### Python: Build Robot Trajectories with TrajectoryBuilder Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Demonstrates using the `TrajectoryBuilder` class in Python for creating complex motion sequences fluently. Allows setting default motion settings and overriding them for specific actions or using context managers. Supports various motion types and IO actions. Requires `nova.actions` and `nova.types`. ```python from nova.actions import TrajectoryBuilder, cartesian_ptp, joint_ptp, linear, io_write from nova.types import MotionSettings, Pose async def trajectory_builder_example(motion_group, tcp): home_joints = await motion_group.joints() current_pose = await motion_group.tcp_pose(tcp) slow = MotionSettings(tcp_velocity_limit=50) normal = MotionSettings(tcp_velocity_limit=200) fast = MotionSettings(tcp_velocity_limit=500, position_zone_radius=10) # Create builder with default settings t = TrajectoryBuilder(settings=normal) # Add single motion (overrides default with slow) t.move(joint_ptp(home_joints, settings=slow)) # Add sequence of actions (uses default settings) t.sequence( cartesian_ptp(current_pose @ Pose((100, 0, 0, 0, 0, 0))), cartesian_ptp(current_pose @ Pose((100, 100, 0, 0, 0, 0))), linear(current_pose @ Pose((100, 100, 50, 0, 0, 0))), io_write(key="tool_out[0]", value=True), # Trigger IO during motion ) # Use context manager for temporary settings with t.set(settings=fast): t.move(cartesian_ptp(current_pose @ Pose((200, 0, 0, 0, 0, 0)))) t.move(joint_ptp(home_joints)) # Final slow move back t.move(joint_ptp(home_joints, settings=slow)) # Plan and execute trajectory trajectory = await motion_group.plan(t.actions, tcp) async for motion_state in motion_group.stream_execute(trajectory, tcp, actions=t.actions): print(f"Progress: {motion_state.path_parameter:.1%}") ``` -------------------------------- ### Specify branch for wandelbots-nova dependency (PEP 508) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Specifies the 'wandelbots-nova' dependency using a direct URL with a specific Git branch. This method is an alternative to the PEP 621 syntax for managing dependencies from Git repositories. ```python wandelbots-nova @ git+https://github.com/wandelbotsgmbh/wandelbots-nova.git@fix/http-prefix ``` -------------------------------- ### Configure Nova API Credentials Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This snippet demonstrates how to set up your Nova API credentials and instance URL in a .env file. These are necessary for the NovaRerunBridge to connect to your Nova instance. ```env NOVA_API="https://your-instance.wandelbots.io" NOVA_ACCESS_TOKEN="your-access-token" ``` -------------------------------- ### Execute Wandelscript Programs from Python Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt This snippet demonstrates how to execute Wandelscript programs directly from Python. It requires the 'wandelscript' and 'nova' libraries. The function takes a Wandelscript program code, input variables, and Nova connection details to run the script. ```python import asyncio from pathlib import Path from nova import Nova, api from nova.cell import virtual_controller from nova.types import Pose from wandelscript import run_wandelscript_program # Example Wandelscript program (save as program.ws): """ robot = get_controller("controller")[0] tcp("Flange") home = read(robot, "pose") sync velocity(200) for i = 0..count: move via ptp() to home move via line() to pose_a :: home move via ptp() to home """ async def run_wandelscript(): async with Nova() as nova: cell = nova.cell() await cell.ensure_controller( virtual_controller( name="ur10e", manufacturer=api.models.Manufacturer.UNIVERSALROBOTS, type=api.models.VirtualControllerTypes.UNIVERSALROBOTS_UR10E, ) ) program_code = Path("program.ws").read_text() await run_wandelscript_program( program_id="my_wandelscript_program", code=program_code, inputs={ "pose_a": Pose((100, 50, 0, 0, 0, 0)), "count": 3, }, nova=Nova(), default_robot="0@ur10e", default_tcp="Flange", ) asyncio.run(run_wandelscript()) ``` -------------------------------- ### Format Code with Ruff Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Formats the project's code according to Black-compatible standards using the 'ruff format' command. This ensures consistent code style across the repository. ```bash uv run ruff format ``` -------------------------------- ### Run a Specific Test File with pytest Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Executes tests within a specific file using 'pytest'. This is useful for targeted testing during development. Replace 'path/to/test_file.py' with the actual file path. ```bash PYTHONPATH=. uv run pytest -rs -v path/to/test_file.py ``` -------------------------------- ### Perform Kinematics Calculations with Nova Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt This Python snippet demonstrates how to perform forward and inverse kinematics calculations using the Nova library. It's useful for reachability analysis and pose validation. The code requires the 'nova' library and establishes a connection to a robot controller to compute joint configurations from TCP poses and vice versa. ```python import asyncio from nova import Nova from nova.types import Pose async def kinematics_example(): async with Nova() as nova: cell = nova.cell() controller = await cell.controller("ur10e") async with controller[0] as motion_group: tcp = (await motion_group.tcp_names())[0] # Forward kinematics: joints -> TCP pose joint_configs = [ (0, -1.57, 1.57, 0, 0, 0), (0.5, -1.2, 1.2, 0, 0.5, 0), ] poses = await motion_group.forward_kinematics(joint_configs, tcp) for joints, pose in zip(joint_configs, poses): print(f"Joints {joints} -> Pose {pose}") # Inverse kinematics: TCP pose -> joint solutions target_poses = [ Pose((400, 0, 500, 3.14, 0, 0)), Pose((300, 200, 400, 3.14, 0, 0)), ] # Get motion group setup for IK with collision checking setup = await motion_group.get_setup(tcp) # Returns list of solutions for each pose (multiple valid configs possible) solutions = await motion_group._inverse_kinematics( poses=target_poses, tcp=tcp, motion_group_setup=setup, ) for pose, joint_solutions in zip(target_poses, solutions): print(f"Pose {pose} has {len(joint_solutions)} IK solutions") if joint_solutions: print(f" First solution: {joint_solutions[0]}") asyncio.run(kinematics_example()) ``` -------------------------------- ### Lint and Sort Imports with Ruff Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Performs code linting and sorts imports using 'ruff check'. The '--select I' flag targets import sorting, and '--fix' attempts to automatically correct issues. This helps maintain code quality and organization. ```bash uv run ruff check --select I --fix uv run ruff check . ``` -------------------------------- ### Configure Wandelbots NOVA Environment Variables Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Sets up required environment variables for the Wandelbots NOVA platform, including the API endpoint and an access token. These are typically stored in a .env file. ```bash # Required environment variables in .env file NOVA_API=https://nova.example.com NOVA_ACCESS_TOKEN=eyJhbGciOi... ``` -------------------------------- ### Python: Execute Robot Motions with Motion Types Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Shows how to perform various robot motions like joint PTP, Cartesian PTP, linear, circular, and collision-free movements using functions from `nova.actions`. Requires `nova.actions`, `nova.types`, and `nova.api`. Motion settings can be configured for velocity, acceleration, and blending. ```python from nova.actions import joint_ptp, cartesian_ptp, linear, circular, collision_free from nova.types import Pose, MotionSettings from nova import api async def motion_examples(motion_group, tcp): home_joints = await motion_group.joints() current_pose = await motion_group.tcp_pose(tcp) settings = MotionSettings( tcp_velocity_limit=200, # mm/s tcp_acceleration_limit=500, # mm/s^2 position_zone_radius=10, # mm blending radius ) # Joint PTP - move in joint space (fastest, non-linear path) action1 = joint_ptp(home_joints, settings=settings) # Cartesian PTP - move to pose via fastest path action2 = cartesian_ptp( target=current_pose @ Pose((100, 0, 0, 0, 0, 0)), settings=settings ) # Linear - straight line motion action3 = linear( target=current_pose @ Pose((200, 100, 0, 0, 0, 0)), settings=settings ) # Circular - arc motion through intermediate point start = current_pose @ Pose((0, 100, 0, 0, 0, 0)) intermediate = current_pose @ Pose((50, 150, 0, 0, 0, 0)) end = current_pose @ Pose((100, 100, 0, 0, 0, 0)) action4 = circular(target=end, intermediate=intermediate, settings=settings) # Collision-free motion (requires collision setup) action5 = collision_free( target=Pose((500, -400, 200, 3.14, 0, 0)), collision_setup=collision_setup, settings=MotionSettings(tcp_velocity_limit=30), algorithm=api.models.CollisionFreeAlgorithm(api.models.RRTConnectAlgorithm()) ) # Plan and execute actions = [action1, action2, action3, action4] trajectory = await motion_group.plan(actions, tcp) await motion_group.execute(trajectory, tcp, actions=actions) ``` -------------------------------- ### Stream Robot State Updates in Real-Time (Python) Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Shows how to stream real-time robot state updates, including joint positions, TCP pose, and velocity. This is essential for monitoring, logging, or building reactive control applications. It covers streaming for motion groups and the entire controller. ```python import asyncio from nova import Nova from nova.cell.robot_cell import RobotCell async def stream_state_example(): async with Nova() as nova: cell = nova.cell() controller = await cell.controller("ur10e") # Stream motion group state async with controller[0] as motion_group: async for state in motion_group.stream_state(response_rate_msecs=100): print(f"Joints: {state.joint_position}") print(f"TCP Pose: {state.tcp_pose}") print(f"Velocity: {state.joint_velocity}") # Break after 10 updates break # Stream controller state async for controller_state in controller.stream_state(rate_msecs=500): print(f"Controller state: {controller_state}") break async def robot_cell_stream(): async with Nova() as nova: cell = nova.cell() controller = await cell.controller("controller") rc = RobotCell(**{"controller": controller}) async for state in rc.stream_state(rate_msecs=500): print(f"Robot cell state: {state}") break asyncio.run(stream_state_example()) ``` -------------------------------- ### Python: Manipulate Robot Poses with the Pose Class Source: https://context7.com/wandelbotsgmbh/wandelbots-nova/llms.txt Demonstrates creating, concatenating, inverting, and converting robot poses using the `Pose` class in Python. Supports initialization from tuples, named vectors, and Euler angles. Requires the `nova.types` and `numpy` libraries. ```python from nova.types import Pose import numpy as np # Create poses from different formats pose1 = Pose((100, 200, 300, 0, 0, 0)) # x, y, z, rx, ry, rz pose2 = Pose((50, 0, 0, 0, 0, 0)) pose3 = Pose(position=Vector3d(x=100, y=200, z=300), orientation=Vector3d(x=0, y=0, z=0)) # Pose concatenation (transforms pose2 in pose1's frame) combined = pose1 @ pose2 # Results in (150, 200, 300, 0, 0, 0) # Create from Euler angles pose_euler = Pose.from_euler( position=(100, 200, 300), euler_angles=(0, 45, 0), convention="xyz", degrees=True ) # Inverse pose inverse = ~pose1 # Convert to tuple values = pose1.to_tuple() # (100, 200, 300, 0, 0, 0) # Iterate over pose values for val in pose1: print(val) # Use with relative movements async with controller[0] as motion_group: current = await motion_group.tcp_pose("Flange") # Move 100mm in X direction relative to current pose target = current @ Pose((100, 0, 0, 0, 0, 0)) ``` -------------------------------- ### Check code quality with Ruff Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Checks Python code for style and potential errors using Ruff, specifically focusing on imports ('I' select) and attempting to fix them automatically. This helps maintain code quality and adherence to best practices. ```bash uv run ruff check --select I --fix ``` -------------------------------- ### Perform Type Checking with mypy Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Executes static type checking on the project using 'mypy'. This command helps catch type-related errors before runtime, improving code reliability. ```bash uv run mypy ``` -------------------------------- ### Run Code Formatting and Linting with Ruff Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md These bash commands utilize ruff, a fast Python linter and formatter, to check and fix code style issues in the scripts directory. This ensures code quality and consistency. ```bash uv run ruff check scripts/. --fix uv run ruff format ``` -------------------------------- ### Log Planned Actions Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This Python code logs planned actions to the Rerun visualizer. This allows for the visualization and analysis of sequences of robot operations. ```python # Log planned actions await bridge.log_actions(actions) ``` -------------------------------- ### Run a Specific Test Function with pytest Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/CLAUDE.md Executes a single test function within a file using 'pytest'. This allows for the most granular level of testing. Replace 'path/to/test_file.py::test_function_name' with the correct path and function name. ```bash PYTHONPATH=. uv run pytest -rs -v path/to/test_file.py::test_function_name ``` -------------------------------- ### Specify branch for wandelbots-nova dependency (PEP 621) Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/README.md Configures the 'wandelbots-nova' dependency in 'pyproject.toml' to use a specific Git branch. This is useful for testing changes from feature branches or forks before merging. ```toml wandelbots-nova = { git = "https://github.com/wandelbotsgmbh/wandelbots-nova.git", branch = "fix/http-prefix" } ``` -------------------------------- ### Log Robot Trajectory Source: https://github.com/wandelbotsgmbh/wandelbots-nova/blob/main/nova_rerun_bridge/README.md This Python snippet shows how to log a robot's joint trajectory, TCP (Tool Center Point) information, and motion group to the Rerun visualizer. This is a core function for visualizing robot movements. ```python # Log a trajectory await bridge.log_trajectory(joint_trajectory, tcp, motion_group) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.