Skip to content

Commit

Permalink
[examples] added local transfomer to sphinx and new sym link
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigul committed Feb 7, 2024
1 parent a0003a8 commit ff0295d
Show file tree
Hide file tree
Showing 26 changed files with 48 additions and 102 deletions.
5 changes: 3 additions & 2 deletions doc/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ Misc
notebooks/pose
notebooks/custom_resolver
notebooks/language
notebooks/local_transformer

Interface Examples
==================

.. nbgallery::
notebooks/giskard
notebooks/robokudo
notebooks/interface_examples/giskard
notebooks/interface_examples/robokudo

Object Relational Mapping
=========================
Expand Down
1 change: 0 additions & 1 deletion doc/source/notebooks/action_designator.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/bullet_world.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/custom_resolver.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/giskard.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/intro.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/language.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/location_designator.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/migrate_neems.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/minimal_task_tree.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/motion_designator.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/object_designator.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/orm_example.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/orm_querying_examples.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/pose.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/robokudo.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/action_designator.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/bullet_world.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/default.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/location_designator.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/motion_designator.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/object_designator.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/overview.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/pose.png

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/notebooks/thumbnails/tree.png

This file was deleted.

121 changes: 45 additions & 76 deletions examples/local_transformer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"id": "611b7e76",
"metadata": {},
"source": [
"# Local Transformer\n",
"The local transformer is used to handle transforms between different frames in PyCRAM. This is useful when you want to transform a pose from one frame to another, for example, from the map frame to the frame of an object. This example will introduce the Local Transformer and how to use it to transform poses between frames.\n",
"\n",
"## Setting up the Environment\n",
"\n",
Expand All @@ -17,25 +19,11 @@
"id": "615cb805",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:32.010116177Z",
"start_time": "2024-01-29T16:28:31.439191974Z"
"end_time": "2024-02-07T09:18:56.397119146Z",
"start_time": "2024-02-07T09:18:56.384091718Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"pybullet build time: May 20 2022 19:44:17\n",
"Unknown attribute \"type\" in /robot[@name='pr2']/link[@name='base_laser_link']\n",
"Unknown attribute \"type\" in /robot[@name='pr2']/link[@name='wide_stereo_optical_frame']\n",
"Unknown attribute \"type\" in /robot[@name='pr2']/link[@name='narrow_stereo_optical_frame']\n",
"Unknown attribute \"type\" in /robot[@name='pr2']/link[@name='laser_tilt_link']\n",
"[WARN] [1706545711.997153]: Failed to import Giskard messages\n",
"[WARN] [1706545712.001630]: Could not import RoboKudo messages, RoboKudo interface could not be initialized\n"
]
}
],
"outputs": [],
"source": [
"from pycram.bullet_world import BulletWorld, Object\n",
"from pycram.pose import Transform, Pose\n",
Expand All @@ -51,29 +39,17 @@
"## Initializing the World\n",
"\n",
"Every robot simulation requires a world where it can interact. This world serves as the playground where the robot performs tasks. \n",
"Let's start by creating this world.\n"
"Let's start by creating this world.\n",
"\n",
"Since the local transformer can only transform between frames of objects which are in the world, we need to create a world first.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "7a3222c2",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:32.323570586Z",
"start_time": "2024-01-29T16:28:32.085550201Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Unknown tag \"material\" in /robot[@name='plane']/link[@name='planeLink']/collision[1]\n",
"Unknown tag \"contact\" in /robot[@name='plane']/link[@name='planeLink']\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"# Create an instance of the BulletWorld\n",
"world = BulletWorld()\n"
Expand All @@ -89,12 +65,12 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"id": "c019c259",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:32.326842316Z",
"start_time": "2024-01-29T16:28:32.324154465Z"
"end_time": "2024-02-07T09:20:31.566964425Z",
"start_time": "2024-02-07T09:20:31.309671668Z"
}
},
"outputs": [],
Expand All @@ -112,31 +88,24 @@
"\n",
"For our robot to perform meaningful tasks, we need to populate its world with objects. \n",
"In this section, we'll add a variety of objects, from a simple floor plane to kitchen setups and items like milk and bowls. \n",
"These objects will be used in subsequent tasks.\n"
"These objects will be used in subsequent tasks, to provide the frames to which we will transform poses.\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "14494539",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:35.474604282Z",
"start_time": "2024-01-29T16:28:32.329041645Z"
"end_time": "2024-02-07T09:19:12.883651520Z",
"start_time": "2024-02-07T09:19:09.027873229Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Unknown tag \"material\" in /robot[@name='plane']/link[@name='planeLink']/collision[1]\n",
"Unknown tag \"contact\" in /robot[@name='plane']/link[@name='planeLink']\n",
"Unknown tag \"material\" in /robot[@name='plane']/link[@name='planeLink']/collision[1]\n",
"Unknown tag \"contact\" in /robot[@name='plane']/link[@name='planeLink']\n",
"Scalar element defined multiple times: limit\n",
"Unknown tag \"material\" in /robot[@name='plane']/link[@name='planeLink']/collision[1]\n",
"Unknown tag \"contact\" in /robot[@name='plane']/link[@name='planeLink']\n",
"Scalar element defined multiple times: limit\n"
]
}
Expand All @@ -145,8 +114,6 @@
"from pycram.bullet_world import Object\n",
"from pycram.enums import ObjectType\n",
"\n",
"plane = Object(\"floor\", ObjectType.ENVIRONMENT, \"plane.urdf\", world=world)\n",
"\n",
"kitchen = Object(\"kitchen\", ObjectType.ENVIRONMENT, \"kitchen.urdf\")\n",
"milk = Object(\"milk\", ObjectType.MILK, \"milk.stl\", Pose([0.9, 1, 0.95]))\n",
"bowl = Object(\"bowl\", ObjectType.BOWL, \"bowl.stl\", Pose([1.6, 1, 0.90]))"
Expand All @@ -163,21 +130,21 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"id": "708606eb",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:35.481284612Z",
"start_time": "2024-01-29T16:28:35.472994214Z"
"end_time": "2024-02-07T09:19:17.445812011Z",
"start_time": "2024-02-07T09:19:17.433695422Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<pycram.local_transformer.LocalTransformer object at 0x7ff688f4e1f0>\n",
"<pycram.local_transformer.LocalTransformer object at 0x7ff688f4e1f0>\n"
"<pycram.local_transformer.LocalTransformer object at 0x7fbc5a24c6d0>\n",
"<pycram.local_transformer.LocalTransformer object at 0x7fbc5a24c6d0>\n"
]
}
],
Expand All @@ -202,12 +169,12 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"id": "988ffda1",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:35.509096003Z",
"start_time": "2024-01-29T16:28:35.483520847Z"
"end_time": "2024-02-07T09:19:19.412829961Z",
"start_time": "2024-02-07T09:19:19.398278560Z"
}
},
"outputs": [
Expand All @@ -218,9 +185,9 @@
"header: \n",
" seq: 0\n",
" stamp: \n",
" secs: 1706545715\n",
" nsecs: 495329141\n",
" frame_id: \"milk_4\"\n",
" secs: 1707297559\n",
" nsecs: 407153367\n",
" frame_id: \"milk_3\"\n",
"pose: \n",
" position: \n",
" x: 0.09999999999999998\n",
Expand All @@ -231,11 +198,12 @@
" y: 0.0\n",
" z: 0.0\n",
" w: 1.0\n",
"-------------------\n",
"header: \n",
" seq: 0\n",
" stamp: \n",
" secs: 1706545715\n",
" nsecs: 496921062\n",
" secs: 1707297559\n",
" nsecs: 407913208\n",
" frame_id: \"map\"\n",
"pose: \n",
" position: \n",
Expand All @@ -259,6 +227,7 @@
"transformed_pose = l.transform_to_object_frame(test_pose, milk)\n",
"print(transformed_pose)\n",
"\n",
"print(\"-------------------\")\n",
"new_pose = l.transform_pose(transformed_pose, \"map\")\n",
"print(new_pose)"
]
Expand All @@ -269,17 +238,17 @@
"metadata": {},
"source": [
"In the above code, we first transformed a pose to the object frame of the milk object, and then we transformed it back to the map frame. This demonstrates how we can easily manipulate poses relative to objects in our environment.\n",
"You can also transform poses relative to other poses. by using the transform_pose method. Further u can set a Transform."
"You can also transform poses relative to other poses. by using the transform_pose method. Further you can set a Transform."
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"id": "dd2bafc5",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:35.509520802Z",
"start_time": "2024-01-29T16:28:35.500190623Z"
"end_time": "2024-02-07T09:19:24.941756539Z",
"start_time": "2024-02-07T09:19:24.929728567Z"
}
},
"outputs": [],
Expand All @@ -302,12 +271,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"id": "6b23f540",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:35.509787045Z",
"start_time": "2024-01-29T16:28:35.504069535Z"
"end_time": "2024-02-07T09:19:26.995686220Z",
"start_time": "2024-02-07T09:19:26.983125610Z"
}
},
"outputs": [],
Expand All @@ -331,21 +300,21 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"id": "bd619710",
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-29T16:28:35.552242116Z",
"start_time": "2024-01-29T16:28:35.508694526Z"
"end_time": "2024-02-07T09:20:26.251771677Z",
"start_time": "2024-02-07T09:20:26.240730107Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"milk_4\n",
"kitchen_3/kitchen_island_surface\n"
"milk_3\n",
"kitchen_2/kitchen_island_surface\n"
]
}
],
Expand Down

0 comments on commit ff0295d

Please sign in to comment.