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

[detectaction] Robokudo real robot #235

Merged
merged 17 commits into from
Dec 5, 2024
Merged
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
Prev Previous commit
Next Next commit
[detectingAction] changed example and demo
sunava committed Dec 4, 2024
commit e6f5355d04ce56e571e001c850557d6d2ae91b26
7 changes: 4 additions & 3 deletions demos/pycram_bullet_world_demo/demo.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
from pycram.designators.action_designator import *
from pycram.designators.location_designator import *
from pycram.designators.object_designator import *
from pycram.datastructures.enums import WorldMode
from pycram.datastructures.enums import WorldMode
from pycram.datastructures.pose import Pose
from pycram.process_module import simulated_robot, with_simulated_robot
from pycram.object_descriptors.urdf import ObjectDescription
@@ -77,8 +77,9 @@ def move_and_detect(obj_type):
# Detect and pickup the spoon
LookAtAction([apartment.get_link_pose("handle_cab10_t")]).resolve().perform()

spoon_desig = DetectAction(technique=DetectionTechnique.TYPES, object_designator_description=BelieveObject(types=[Spoon])).resolve().perform()

spoon_desigs = DetectAction(technique=DetectionTechnique.TYPES,
object_designator_description=BelieveObject(types=[Spoon])).resolve().perform()
spoon_desig = spoon_desigs[0]
pickup_arm = Arms.LEFT if drawer_open_loc.arms[0] == Arms.RIGHT else Arms.RIGHT
PickUpAction(spoon_desig, [pickup_arm], [Grasp.TOP]).resolve().perform()

14 changes: 11 additions & 3 deletions examples/motion_designator.md
Original file line number Diff line number Diff line change
@@ -105,22 +105,30 @@ with simulated_robot:
## Detecting

This is the motion designator implementation of detecting, if an object with the given object type is in the field of
view (FOV) this motion designator will return an object designator describing the object.
view (FOV) this motion designator will return a list of object designators describing the objects. It is important to specify the
technique and state of the detection. You can also optional specify a region in which the object should be detected.


Since we need an object that we can detect, we will spawn a milk for this.

```python
from pycram.designators.motion_designator import DetectingMotion, LookingMotion
from pycram.process_module import simulated_robot
from pycram.datastructures.pose import Pose
from pycram.datastructures.enums import DetectionTechnique, DetectionState
from pycrap import Milk
from pycram.designators.object_designator import BelieveObject


with simulated_robot:
LookingMotion(target=Pose([1.5, 0, 1], [0, 0, 0, 1])).perform()

motion_description = DetectingMotion(object_type=pycrap.Milk)
motion_description = DetectingMotion(technique=DetectionTechnique.TYPES,state=DetectionState.START, object_designator_description=BelieveObject(types=[Milk]),
region=None)

obj = motion_description.perform()

print(obj)
print(obj[0])
```

## Move Arm Joints
9 changes: 7 additions & 2 deletions src/pycram/process_modules/default_process_modules.py
Original file line number Diff line number Diff line change
@@ -95,7 +95,6 @@ def _execute(self, designator: DetectingMotion):
query_result = []
world_objects = []
object_types = designator.object_designator_description.types
# print(object_types.name)
if designator.technique == DetectionTechnique.TYPES:
for obj_type in object_types:
list1 = World.current_world.get_object_by_type(obj_type)
@@ -289,7 +288,13 @@ def _execute(self, designator: DetectingMotion) -> List[Object]:

perceived_objects.append(generic_obj)

return perceived_objects
object_dict = []

for obj in perceived_objects:
object_dict.append(ObjectDesignatorDescription.Object(obj.name, obj.obj_type,
obj))

return object_dict


class DefaultManager(ProcessModuleManager):