Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:intermediate:bullet_world [2019/07/08 17:17] – [Moving the robot in the Bullet world] gkazhoya | tutorials:intermediate:bullet_world [2023/05/02 14:15] (current) – [Abstract entity descriptions] gkazhoya | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **//Tested with Cram v0.7.0, ROS version: | + | **//Tested with Cram v0.8.0, ROS version: |
====== Bullet world demonstration ====== | ====== Bullet world demonstration ====== | ||
Line 153: | Line 153: | ||
(cram-robot-interfaces: | (cram-robot-interfaces: | ||
(assert (btr:object ?world :urdf ?robot ((0 0 0) (0 0 0 1)) :urdf , | (assert (btr:object ?world :urdf ?robot ((0 0 0) (0 0 0 1)) :urdf , | ||
- | (cram-robot-interfaces:robot-arms-parking-joint-states ?robot ? | + | (-> (rob-int: |
- | (assert (btr: | + | (assert (btr: |
- | (assert (btr: | + | (true)) |
+ | | ||
+ | | ||
+ | (true))))) | ||
</ | </ | ||
Line 223: | Line 226: | ||
<code lisp> | <code lisp> | ||
- | BTW-TUT> (btr:object btr: | + | BTW-TUT> (btr:object btr: |
</ | </ | ||
Line 232: | Line 235: | ||
(btr: | (btr: | ||
' | ' | ||
- | | + | |
</ | </ | ||
Line 305: | Line 308: | ||
<code lisp> | <code lisp> | ||
BTW-TUT> (prolog: | BTW-TUT> (prolog: | ||
- | (cram-robot-interfaces:robot ?robot) | + | (rob-int:robot ?robot) |
(btr: | (btr: | ||
NIL | NIL | ||
Line 329: | Line 332: | ||
BTW-TUT> | BTW-TUT> | ||
(def-fact-group costmap-metadata () | (def-fact-group costmap-metadata () | ||
- | (<- (location-costmap: | + | (<- (costmap-size 12 12)) |
- | (<- (location-costmap: | + | (<- (costmap-origin -6 -6)) |
- | (<- (location-costmap: | + | (<- (costmap-resolution 0.04)) |
- | + | ||
- | (<- (location-costmap: | + | (<- (costmap-padding 0.3)) |
- | (<- (location-costmap: | + | (<- (costmap-manipulation-padding 0.4)) |
- | (<- (location-costmap: | + | (<- (costmap-in-reach-distance 0.7)) |
- | (<- (location-costmap: | + | (<- (costmap-reach-minimal-distance 0.2)) |
- | (<- (location-costmap: | + | (<- (visibility-costmap-size 2)) |
- | (<- (location-costmap: | + | (<- (orientation-samples 2)) |
- | (<- (location-costmap: | + | (<- (orientation-sample-step 0.1))) |
</ | </ | ||
Now, we create an abstract location description that we call a // | Now, we create an abstract location description that we call a // | ||
Line 365: | Line 368: | ||
(type counter-top) | (type counter-top) | ||
| | ||
- | | + | |
| | ||
| | ||
Line 417: | Line 420: | ||
(btr: | (btr: | ||
' | ' | ||
- | | + | |
</ | </ | ||
The drawer is called ''" | The drawer is called ''" | ||
Line 438: | Line 441: | ||
(prolog '(and (btr: | (prolog '(and (btr: | ||
(btr: | (btr: | ||
- | (assert (btr: | + | (assert (btr: |
</ | </ | ||
Notice, that the joint name differs from the link name. Now the fork moves when the drawer is moved. | Notice, that the joint name differs from the link name. Now the fork moves when the drawer is moved. | ||
Line 444: | Line 447: | ||
(btr: | (btr: | ||
' | ' | ||
- | | + | |
</ | </ | ||
Every attachment can be checked with the following predicate: | Every attachment can be checked with the following predicate: | ||
<code lisp> | <code lisp> | ||
(prolog '(and (btr: | (prolog '(and (btr: | ||
- | (btr: | + | (btr: |
</ | </ | ||
This checks if there is any attachments between kitchen and fork. If needed, it is possible to set the name of a link to be specifically checked. Or set the ''? | This checks if there is any attachments between kitchen and fork. If needed, it is possible to set the name of a link to be specifically checked. Or set the ''? | ||
Line 455: | Line 458: | ||
(prolog '(and (btr: | (prolog '(and (btr: | ||
(btr: | (btr: | ||
- | (btr: | + | (btr: |
</ | </ | ||
This detaches the fork from all the links of the kitchen that it has been attached to. | This detaches the fork from all the links of the kitchen that it has been attached to. | ||
Line 535: | Line 538: | ||
and the following does: | and the following does: | ||
<code lisp> | <code lisp> | ||
- | BTW-TUT> (pr2-proj: | + | BTW-TUT> (urdf-proj: |
| | ||
</ | </ | ||
Line 542: | Line 545: | ||
==== Moving the robot in the Bullet world ==== | ==== Moving the robot in the Bullet world ==== | ||
- | In this part of the tutorial we will look into moving the robot and it's body parts as well as perceiving objects through the Bullet world. We will use functions from the '' | + | In this part of the tutorial we will look into moving the robot and it's body parts as well as perceiving objects through the Bullet world. We will use functions from the '' |
- | This teleporting is done by directly calling Prolog predicates that move objects in the world (for navigating the robot, simply teleport it to the goal), changing joint angles (to move the arm simply teleport the arm to given joint values) etc. '' | + | This teleporting is done by directly calling Prolog predicates that move objects in the world (for navigating the robot, simply teleport it to the goal), changing joint angles (to move the arm simply teleport the arm to given joint values) etc. '' |
Another package that we will use in this part of the tutorial is '' | Another package that we will use in this part of the tutorial is '' | ||
Line 566: | Line 569: | ||
BTW-TUT> (btr-utils: | BTW-TUT> (btr-utils: | ||
(cl-transforms: | (cl-transforms: | ||
- | | + | |
| | ||
</ | </ | ||
Line 595: | Line 598: | ||
< | < | ||
To execute any plan in CRAM, we need a top-level context. Besides that we also use a macro to specify that the demo should be executed in simulation, not on the real robot. Putting your plan under '' | To execute any plan in CRAM, we need a top-level context. Besides that we also use a macro to specify that the demo should be executed in simulation, not on the real robot. Putting your plan under '' | ||
+ | We can execute some movements in parallel, if they use different joints of the robot. That's what '' | ||
+ | We have used a simple call to low level methods to achieve motions like move to the ''? | ||
--></ | --></ | ||
Line 600: | Line 605: | ||
<code lisp> | <code lisp> | ||
BTW-TUT> | BTW-TUT> | ||
- | (pr2-proj: | + | (urdf-proj: |
- | (pr2-proj:: | + | (urdf-proj:: |
| | ||
| | ||
Line 615: | Line 620: | ||
| | ||
| | ||
- | (pr2-proj:: | + | (urdf-proj:: |
- | (pr2-proj:: | + | (urdf-proj:: |
</ | </ | ||
- | As some of the functions in '' | + | As some of the functions in '' |
- | We can execute some movements in parallel, if they use different joints of the robot. That's what '' | + | The function '' |
+ | <code lisp> | ||
+ | (prolog: | ||
+ | </ | ||
+ | '' | ||
- | To grasp the bottle we need to have its pose in the room. Therefore, we first perceive | + | Now, let us finally |
<code lisp> | <code lisp> | ||
BTW-TUT> | BTW-TUT> | ||
(defvar *perceived-object* nil " | (defvar *perceived-object* nil " | ||
- | (pr2-proj: | + | (urdf-proj: |
(setf *perceived-object* | (setf *perceived-object* | ||
- | (pr2-proj:: | + | (urdf-proj:: |
</ | </ | ||
- | With that resulting perceived object we perform the picking up action. With the torso so far down we might not be able to reach for the bottle, so we need to also push the torso up: | + | With that resulting perceived object we could perform the picking up action. With the torso so far down we might not be able to reach the bottle, so we need to push the torso up: |
<code lisp> | <code lisp> | ||
- | (pr2-proj: | + | (urdf-proj: |
- | (let ((? | + | (urdf-proj:: |
- | (pr2-proj:: | + | |
</ | </ | ||
As there is no atomic motion for picking up an object, in fact, picking up is comprised of multiple move-arm motions, | As there is no atomic motion for picking up an object, in fact, picking up is comprised of multiple move-arm motions, | ||
- | so pick up is implemented within a plan and called by performing an action designator. | + | pick up is implemented within a plan and called by performing an action designator. |