Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add documentation to the examples #21

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/01_basic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import asyncio
from nova import Nova

"""
Example: Getting the current state of a robot.

Prerequisites:
- At least one robot added to the cell.
"""

async def main():
nova = Nova()
Expand Down
6 changes: 6 additions & 0 deletions examples/02_plan_and_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
from nova.types import Pose
import asyncio

"""
Example: Perform relative movements with a robot.

Prerequisites:
- At least one robot added to the cell.
"""

async def main():
nova = Nova()
Expand Down
9 changes: 8 additions & 1 deletion examples/03_move_and_set_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
import asyncio


"""
Example: Move the robot and set I/Os on the path.

Prerequisites:
- At least one robot added to the cell.
- The robot must have a digital output named "digital_out[0]".
"""

async def main():
nova = Nova()
cell = nova.cell()
Expand All @@ -23,7 +31,6 @@ async def main():
target_pose = current_pose @ Pose((100, 0, 0, 0, 0, 0))
actions = [
jnt(home_joints),
# TODO: controller.write_on_path("digital_out[0]", value=False),
WriteAction(device_id="ur", key="digital_out[0]", value=False),
ptp(target_pose),
jnt(home_joints),
Expand Down
6 changes: 6 additions & 0 deletions examples/04_move_multiple_robots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
from nova.actions import ptp, jnt
import asyncio

"""
Example: Move multiple robots simultaneously.

Prerequisites:
- A cell with two robots: one named "ur" and another named "kuka".
"""

async def move_robot(controller: Controller):
async with controller[0] as motion_group:
Expand Down
19 changes: 7 additions & 12 deletions examples/05_selection_motion_group_activation.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
"""
This example demonstrates how to activate specific motion groups for two robot controllers
and execute simultaneous movements for both robots.

The robots used in this example are:
- A Universal Robots (UR) controller
- A KUKA controller

Each robot moves between a predefined home pose and a target pose sequentially.
"""

from math import pi
from nova import Nova, MotionGroup
from nova.types import Pose
from nova.actions import ptp
import asyncio

"""
Example: Move multiple robots to perform coordinated movements.

Prerequisites:
- A cell with two robots named "ur" and "kuka".
"""

async def move_robot(motion_group: MotionGroup, tcp: str):
home_pose = Pose((200, 200, 600, 0, pi, 0))
Expand Down Expand Up @@ -42,7 +37,7 @@ async def main():

# activate all motion groups
async with ur:
await move_robot(ur.motion_group(0))
await move_robot(ur.motion_group(0), tcp)

# activate motion group 0
async with ur.motion_group(0) as mg_0:
Expand Down
3 changes: 3 additions & 0 deletions examples/06_api_usage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from nova.api import models

"""
Example: Demonstrates how to use and access API models in the Nova SDK.
biering marked this conversation as resolved.
Show resolved Hide resolved
"""

def main():
pose = models.Pose2(position=[10, 20, 30], orientation=[1, 2, 3])
Expand Down
Loading