-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RPS-999): activate motion groups seperatly (#11)
- Loading branch information
1 parent
09f22fb
commit e7a77ba
Showing
9 changed files
with
113 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
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, ptp, MotionGroup, Pose | ||
import asyncio | ||
|
||
|
||
async def move_robot(motion_group: MotionGroup): | ||
home_pose = Pose((200, 200, 600, 0, pi, 0)) | ||
target_pose = home_pose @ (100, 0, 0, 0, 0, 0) | ||
actions = [ | ||
ptp(home_pose), | ||
ptp(target_pose), | ||
ptp(target_pose @ (0, 0, 100, 0, 0, 0)), | ||
ptp(target_pose @ (0, 100, 0, 0, 0, 0)), | ||
ptp(home_pose), | ||
] | ||
|
||
await motion_group.run(actions, tcp="Flange") | ||
|
||
|
||
async def main(): | ||
nova = Nova() | ||
cell = nova.cell() | ||
ur = await cell.controller("ur") | ||
kuka = await cell.controller("kuka") | ||
|
||
flange_state = await ur[0].get_state("Flange") | ||
print(flange_state) | ||
|
||
# activate all motion groups | ||
async with ur: | ||
await move_robot(ur.motion_group(0)) | ||
|
||
# activate motion group 0 | ||
async with ur.motion_group(0) as mg_0: | ||
await move_robot(mg_0) | ||
|
||
# activate motion group 0 | ||
async with ur[0] as mg_0: | ||
await move_robot(mg_0) | ||
|
||
# activate motion group 0 from two different controllers | ||
async with ur[0] as ur_0_mg, kuka[0] as kuka_0_mg: | ||
await asyncio.gather(move_robot(ur_0_mg), move_robot(kuka_0_mg)) | ||
|
||
# activate motion group 0 from two different controllers | ||
mg_0 = ur.motion_group(0) | ||
mg_1 = kuka.motion_group(0) | ||
async with mg_0, mg_1: | ||
await asyncio.gather(move_robot(mg_0), move_robot(mg_1)) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters