cram2 / pycram Goto Github PK
View Code? Open in Web Editor NEWCognitive Robot Abstract Machine in Python
Home Page: https://pycram.readthedocs.io/en/latest/index.html
License: GNU General Public License v3.0
Cognitive Robot Abstract Machine in Python
Home Page: https://pycram.readthedocs.io/en/latest/index.html
License: GNU General Public License v3.0
The "Run the demo"-section of the README.md points to a folder "demo" that does not exist.
I am trying to test new apartmenet urdf with pyCRAM, here is the code.
import pycram
from pycram.bullet_world import BulletWorld, Object
import pycram.bullet_world_reasoning as btr
from pycram.robot_descriptions.robot_description_handler import InitializedRobotDescription as robot_description
from pycram.designators.motion_designator import MotionDesignatorDescription, MoveArmJointsMotion
from pycram.process_module import simulated_robot, with_simulated_robot
from pycram.language import macros, par
from pycram.designators.location_designator import *
from pycram.designators.action_designator import *
from pycram.designators.object_designator import *
from pycram.resolver.plans import Arms
from pycram.enums import Arms
from pycram.robot_descriptions.robot_description_handler import InitializedRobotDescription as robot_description
import pycram.task
from pycram.resolver.plans import Arms
from pycram.process_module import simulated_robot
import anytree
import pycram.plan_failures
world = BulletWorld()
# spawn robot
pr2 = Object("pr2", "robot", "pr2.urdf")
robot_desig = ObjectDesignatorDescription(names=["pr2"]).resolve()
# spawn apartment
apartment = Object("apartment", "environment", "apartment.urdf")
apartment_desig = ObjectDesignatorDescription(names=['apartment']).resolve()
# spawn Milkbox
milk = Object("milk", "milk", "milk.stl", position=[1.4, 1, 0.95])
milk_desig = ObjectDesignatorDescription(names=["milk"])
I am getting following error:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/avyas/pyCRAM_ws/src/pycram/src/pycram/bullet_world.py", line 459, in run
shadow_obj.set_position(bulletworld_obj.get_position())
File "/home/avyas/pyCRAM_ws/src/pycram/src/pycram/bullet_world.py", line 818, in get_position
return p.getBasePositionAndOrientation(self.id, physicsClientId=self.world.client_id)[0]
pybullet.error: Not connected to physics server.
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "run.py", line 5, in <module>
import my_pouring_demo_apartment
File "/home/avyas/pyCRAM_ws/src/pycram/demos/pycram_bullet_world_demo/my_pouring_demo_apartment.py", line 32, in <module>
milk = Object("milk", "milk", "milk.stl", position=[1.4, 1, 0.95])
File "/home/avyas/pyCRAM_ws/src/pycram/src/pycram/bullet_world.py", line 717, in __init__
self.id, self.path = _load_object(name, path, position, orientation, self.world, color, ignoreCachedFiles)
File "/home/avyas/pyCRAM_ws/src/pycram/src/pycram/bullet_world.py", line 1300, in _load_object
raise (e)
File "/home/avyas/pyCRAM_ws/src/pycram/src/pycram/bullet_world.py", line 1294, in _load_object
obj = p.loadURDF(path, basePosition=position, baseOrientation=orientation, physicsClientId=world_id)
pybullet.error: Not connected to physics server.
I am trying to query all ProcessMetaData from my local postgres database, using the ORM.
But using the following command response = session.query(pycram.orm.base.ProcessMetaData).all()
returns only a list containing one object instead of all objects as expected.
I am using the following postgres version:
PostgreSQL 14.10 (Ubuntu 14.10-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit
My ProcessMetaData has the following definition:
pycram=# \d "ProcessMetaData"
Table "public.ProcessMetaData"
Column | Type | Collation | Nullable | Default
----------------+-----------------------------+-----------+----------+-----------------------------------------------
created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP
created_by | character varying(255) | | not null |
description | character varying(255) | | not null |
pycram_version | character varying(255) | | |
id | integer | | not null | nextval('"ProcessMetaData_id_seq"'::regclass)
Indexes:
"ProcessMetaData_pkey" PRIMARY KEY, btree (id)
Referenced by:
TABLE ""Code"" CONSTRAINT "code_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Color"" CONSTRAINT "color_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Designator"" CONSTRAINT "designator_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Object"" CONSTRAINT "object_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Pose"" CONSTRAINT "pose_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Position"" CONSTRAINT "position_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Quaternion"" CONSTRAINT "quaternion_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""RobotState"" CONSTRAINT "robotstate_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""TaskTreeNode"" CONSTRAINT "tasktreenode_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
It contains the following data:
pycram=# select * from "ProcessMetaData";
created_at | created_by | description | pycram_version | id
----------------------------+------------+-----------------------------------------------------+------------------------------------------+----
2023-12-22 14:16:49.281148 | nleusmann | Unittest: All that is gold does not glitter, 0 | af343656dd2d615259c5df4543b56260cf8d358e | 7
2023-12-22 14:17:01.399586 | nleusmann | Unittest: Not all those who wander are lost; 1 | af343656dd2d615259c5df4543b56260cf8d358e | 8
2023-12-22 14:17:13.865826 | nleusmann | Unittest: The old that is strong does not wither, 2 | af343656dd2d615259c5df4543b56260cf8d358e | 9
2023-12-22 13:22:11 | nleusmann | Database merger Unittest: Example pick and place 0 | af343656dd2d615259c5df4543b56260cf8d358e | 10
2023-12-22 13:22:24 | nleusmann | Database merger Unittest: Example pick and place 1 | af343656dd2d615259c5df4543b56260cf8d358e | 11
2023-12-22 13:22:36 | nleusmann | Database merger Unittest: Example pick and place 2 | af343656dd2d615259c5df4543b56260cf8d358e | 12
2023-12-22 13:22:11 | nleusmann | Database merger Unittest: Example pick and place 0 | af343656dd2d615259c5df4543b56260cf8d358e | 1
2023-12-22 13:22:24 | nleusmann | Database merger Unittest: Example pick and place 1 | af343656dd2d615259c5df4543b56260cf8d358e | 2
2023-12-22 13:22:36 | nleusmann | Database merger Unittest: Example pick and place 2 | af343656dd2d615259c5df4543b56260cf8d358e | 3
2023-12-22 13:22:50 | nleusmann | Database merger Unittest: Example pick and place 0 | af343656dd2d615259c5df4543b56260cf8d358e | 4
2023-12-22 13:23:03 | nleusmann | Database merger Unittest: Example pick and place 1 | af343656dd2d615259c5df4543b56260cf8d358e | 5
2023-12-22 13:23:15 | nleusmann | Database merger Unittest: Example pick and place 2 | af343656dd2d615259c5df4543b56260cf8d358e | 6
When using the response = session.query(pycram.orm.base.ProcessMetaData).all()
command, the only value that gets returned is the following:
[ProcessMetaData(id=6, created_at=datetime.datetime(2023, 12, 22, 13, 23, 15), created_by='nleusmann', description='Database merger Unittest: Example pick and place 2', pycram_version='af343656dd2d615259c5df4543b56260cf8d358e')]
Which is the most recently added object.
Curiously the count = session.query(pycram.orm.base.ProcessMetaData).count()
returns the correct amount of 12.
Utilizing the select statement.
select_statement = sqlalchemy.select('*').select_from(pycram.orm.base.ProcessMetaData)
select_result = session.execute(select_statement).all()
I receive the expected return value:
[(datetime.datetime(2023, 12, 22, 14, 16, 49, 281148), 'nleusmann', 'Unittest: All that is gold does not glitter, 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 7), (datetime.datetime(2023, 12, 22, 14, 17, 1, 399586), 'nleusmann', 'Unittest: Not all those who wander are lost; 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 8), (datetime.datetime(2023, 12, 22, 14, 17, 13, 865826), 'nleusmann', 'Unittest: The old that is strong does not wither, 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 9), (datetime.datetime(2023, 12, 22, 13, 22, 11), 'nleusmann', 'Database merger Unittest: Example pick and place 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 10), (datetime.datetime(2023, 12, 22, 13, 22, 24), 'nleusmann', 'Database merger Unittest: Example pick and place 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 11), (datetime.datetime(2023, 12, 22, 13, 22, 36), 'nleusmann', 'Database merger Unittest: Example pick and place 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 12), (datetime.datetime(2023, 12, 22, 13, 22, 11), 'nleusmann', 'Database merger Unittest: Example pick and place 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 1), (datetime.datetime(2023, 12, 22, 13, 22, 24), 'nleusmann', 'Database merger Unittest: Example pick and place 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 2), (datetime.datetime(2023, 12, 22, 13, 22, 36), 'nleusmann', 'Database merger Unittest: Example pick and place 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 3), (datetime.datetime(2023, 12, 22, 13, 22, 50), 'nleusmann', 'Database merger Unittest: Example pick and place 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 4), (datetime.datetime(2023, 12, 22, 13, 23, 3), 'nleusmann', 'Database merger Unittest: Example pick and place 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 5), (datetime.datetime(2023, 12, 22, 13, 23, 15), 'nleusmann', 'Database merger Unittest: Example pick and place 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 6)]
But instead of an list of all the different ProcessMetaData stored within my database I only receive an single object.
What is even more surprising is the fact that the counting command returns the :
count = session.query(pycram.orm.base.ProcessMetaData).count()
returns the correct amount of possible objects.
If needed I can provide additional information, please just ask.
see this post: https://answers.ros.org/question/233331/timesleep-in-a-node/
to avoid potential future issues this should be implemented.
(Line 293)
Should be an empty list, I guess.
This prevents the demo from running.
There is no information about the license that this used to publish this code.
Note that you are infringing the macropy license by redistributing its code without its license!
As PyCRAM tutorials and docs moved to their own sublink, it would be nice to update the readme accordingly to point to http://cram-system.org/pycram
The trace is a follows:
Traceback (most recent call last):
File "/home/chris/mt/pycram-ws/src/pycram/pycram_pr2_bullet_world_demo/scripts/run.py", line 6, in
import demo
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "/home/chris/mt/pycram-ws/src/pycram/pycram/src/macropy/core/import_hooks.py", line 46, in exec_module
exec(self.code, module.dict)
File "/home/chris/mt/pycram-ws/src/pycram/pycram_pr2_bullet_world_demo/scripts/demo.py", line 76, in
move_object(object_types[i], targets[object_types[i]][0], targets[object_types[i]][1])
File "/home/chris/mt/pycram-ws/src/pycram/pycram_pr2_bullet_world_demo/scripts/demo.py", line 46, in move_object
block = btr.blocking(det_obj, BulletWorld.robot, gripper)
File "/home/chris/mt/pycram-ws/src/pycram/pycram/src/pycram/bullet_world_reasoning.py", line 240, in blocking
inv = p.calculateInverseKinematics(robot.id, robot.get_link_id(gripper_name), object.get_pose(),
AttributeError: 'NoneType' object has no attribute 'get_pose'
And the PR2 just stands in front of an open drawer with the spoon inside.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.