-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(arcor2_fit_demo): new OTs for simulated actions
- Loading branch information
ZdenekM
committed
Mar 21, 2024
1 parent
e0e766c
commit 335697b
Showing
7 changed files
with
92 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
docker_image(name="arcor2_upload_fit_demo", repository="arcor2/arcor2_upload_fit_demo", image_tags=["1.2.0"]) | ||
docker_image(name="arcor2_upload_fit_demo", repository="arcor2/arcor2_upload_fit_demo", image_tags=["1.3.0"]) |
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 |
---|---|---|
@@ -1 +1 @@ | ||
1.2.0 | ||
1.3.0 |
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,23 @@ | ||
import time | ||
|
||
from arcor2.data.common import ActionMetadata | ||
from arcor2.object_types.abstract import Generic | ||
|
||
|
||
class Erp(Generic): | ||
"""ObjectType that simulates Enterprise Resource Planning system.""" | ||
|
||
_ABSTRACT = False | ||
|
||
def log_production_step(self, step: str, success: bool, *, an: None | str = None) -> None: | ||
"""Logs finished production step. | ||
:param step: Name of the production step. | ||
:param success: Indicates whether the step was successful. | ||
:param an: | ||
:return: | ||
""" | ||
|
||
time.sleep(0.01) | ||
|
||
log_production_step.__action__ = ActionMetadata() # type: ignore |
26 changes: 26 additions & 0 deletions
26
src/python/arcor2_fit_demo/object_types/milling_machine.py
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,26 @@ | ||
import random | ||
import time | ||
|
||
from arcor2.data.common import ActionMetadata | ||
from arcor2.object_types.abstract import CollisionObject | ||
|
||
|
||
class MillingMachine(CollisionObject): | ||
_ABSTRACT = False | ||
|
||
def do_milling(self, *, an: None | str = None) -> bool: | ||
"""Performs a (simulated) milling process. Returns False if something | ||
goes wrong. | ||
:param an: | ||
:return: | ||
""" | ||
|
||
if random.uniform(0, 1) > 0.3: | ||
time.sleep(3) | ||
return True | ||
else: | ||
time.sleep(5) | ||
return False | ||
|
||
do_milling.__action__ = ActionMetadata() # type: ignore |
23 changes: 23 additions & 0 deletions
23
src/python/arcor2_fit_demo/object_types/optical_quality_control.py
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,23 @@ | ||
import random | ||
import time | ||
|
||
from arcor2.data.common import ActionMetadata | ||
from arcor2.object_types.abstract import CollisionObject | ||
|
||
|
||
class OpticalQualityControl(CollisionObject): | ||
mesh_filename = "kinect_azure.dae" | ||
_ABSTRACT = False | ||
|
||
def measure_quality(self, *, an: None | str = None) -> bool: | ||
"""Performs a (simulated) quality measurement. Returns False if | ||
something is wrong. | ||
:param an: | ||
:return: | ||
""" | ||
|
||
time.sleep(0.01) | ||
return random.uniform(0, 1) > 0.3 | ||
|
||
measure_quality.__action__ = ActionMetadata() # type: ignore |
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