Using NEEMs database with the help of NEEMQuery python package to redo or replay neems using PyCRAM
Project description
NEEMPyCRAMInterface
A python library for using the SQL NEEMs database (with the help of NEEMQuery) in combination with PyCRAM to be able to replay the NEEM motions or redo the executed plan in the NEEM using the PyCRAM framework.
Installation
MariaDB Installation
Make sure you have MariaDB installed on your device.
PyCRAM Installation
If you already have PyCRAM:
Step 1: Add the other fork as a new remote
git remote add multiverse https://github.com/AbdelrhmanBassiouny/pycram.git
Step 2: Fetch the branches from the other fork
git fetch multiverse
Step 3: Check out the branch from the other fork
git checkout -b multiverse_interface multiverse/multiverse_interface
If you do not have PyCRAM:
You need to have PyCRAM installed on your device,
- clone the PyCRAM repository,
- follow the PyCRAM installation instructions
- checkout the 'multiverse_interface' branch.
git checkout multiverse_interface
Install NEEMPyCRAMInterface
pip install neem_pycram_interface
Example Usage
All below examples assume the neems are located in a 'test' database at 'localhost' which can be accessed by 'newuser' using password 'password'.
Replaying the motions of multiple NEEMs:
This is done by using the PyCRAMNEEMInterface class which provides a higher level of abstraction, and uses PyCRAM to replay the motions retrieved from the SQL queries. This shows the replay of three NEEMs in real time.
from neem_pycram_interface.neem_pycram_interface import PyCRAMNEEMInterface
from pycram.datastructures.enums import WorldMode
from pycram.worlds.bullet_world import BulletWorld
from pycram.ros.viz_marker_publisher import VizMarkerPublisher
pni = PyCRAMNEEMInterface('mysql+pymysql://newuser:password@localhost/test')
world = BulletWorld(mode=WorldMode.DIRECT)
vis_mark_publisher = VizMarkerPublisher()
neem_ids = [14, 15, 16]
pni.replay_motion_of_neem(neem_ids, real_time=False)
vis_mark_publisher._stop_publishing()
world.exit()
Redoing a task in a NEEM:
Similar to replaying the motions, but now we try to redo a single task using PyCRAM actions.
from neem_pycram_interface.neem_pycram_interface import PyCRAMNEEMInterface
from pycram.datastructures.enums import WorldMode
from pycram.worlds.bullet_world import BulletWorld
from pycram.ros.viz_marker_publisher import VizMarkerPublisher
pni = PyCRAMNEEMInterface('mysql+pymysql://newuser:password@localhost/test')
world = BulletWorld(mode=WorldMode.DIRECT)
vis_mark_publisher = VizMarkerPublisher()
pni.redo_grasping_action(14)
vis_mark_publisher._stop_publishing()
world.exit()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file neem_pycram_interface-1.0.15.tar.gz
.
File metadata
- Download URL: neem_pycram_interface-1.0.15.tar.gz
- Upload date:
- Size: 54.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c42cbe2ebe7e2c7af176b67466ebe11593c89289cf5338d362b0a63f0b5e9d7 |
|
MD5 | f97cef30a4a29f4eb49cbb786a6527f0 |
|
BLAKE2b-256 | 8c8cf89b030e6a4e4983bf4eb60eea6bfd7e79e7e83fe94722ca8fe2dd4cf12e |
File details
Details for the file neem_pycram_interface-1.0.15-py3-none-any.whl
.
File metadata
- Download URL: neem_pycram_interface-1.0.15-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 894f84bddc4b4fe0dafa999fe16d37e905d9ff4f5f65ab6207d993d3b8b33107 |
|
MD5 | 175661ed5e19a87bcbbb88ceedf88d9b |
|
BLAKE2b-256 | 86bf642fd712cb0a3f1751656268160e0333939aef478066e3c093d28bf9e0bb |