Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorials:advanced:new-robot [2019/02/21 09:59] – [Create a CRAM robot description package] vanessa | tutorials:advanced:new-robot [2019/02/23 08:44] – [Spawn the robot in Bullet] vanessa | ||
---|---|---|---|
Line 201: | Line 201: | ||
The HSR does not have so many links and joins as the PR2 so our life is much easier on that point. | The HSR does not have so many links and joins as the PR2 so our life is much easier on that point. | ||
- | Which files are needed in the // | + | Which files are later needed in the // |
* **cram_hsrb_description** | * **cram_hsrb_description** | ||
* arms.lisp | * arms.lisp | ||
Line 219: | Line 219: | ||
For reference and starting point take a look at those package for the pr2 or hsrb. | For reference and starting point take a look at those package for the pr2 or hsrb. | ||
- | Open your '' | + | |
Line 226: | Line 226: | ||
==== Spawn the robot in Bullet ==== | ==== Spawn the robot in Bullet ==== | ||
- | Use the Prolog assertion predicates. See example of how PR2 is spawned from a URDF in the bullet tutorial: http:// | + | Use the Prolog assertion predicates. See example of how PR2 is spawned from a URDF in the bullet tutorial: http:// |
Line 260: | Line 260: | ||
(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: | ||
(assert (btr: | (assert (btr: | ||
(assert (btr: | (assert (btr: | ||
Line 272: | Line 271: | ||
{{: | {{: | ||
- | + | The '' | |
- | At this moment the command: | + | |
<code lisp> | <code lisp> | ||
(defvar *robot-base-frame* nil | (defvar *robot-base-frame* nil | ||
Line 289: | Line 287: | ||
"Tool frame of the right arm. Initialized from CRAM robot desciption." | "Tool frame of the right arm. Initialized from CRAM robot desciption." | ||
</ | </ | ||
- | Usually u will define those parameters in the ROBOT_description package. For now to simply test the beginning | + | Usually u will define those parameters in the ROBOT_description package. For now to simply test the beginning |
Line 304: | Line 302: | ||
(btr:object btr: | (btr:object btr: | ||
</ | </ | ||
- | To get the instance of the spawned Bullet object there is a function. | + | |
After lifting the torso the HSR should looks like this: | After lifting the torso the HSR should looks like this: | ||
Line 428: | Line 426: | ||
==== Create a CRAM YOUR_ROBOT_NAME projection package ==== | ==== Create a CRAM YOUR_ROBOT_NAME projection package ==== | ||
- | Similar to '' | + | Similar to '' |
+ | <code lisp> | ||
+ | ;;in low-level.lisp | ||
+ | ;;;;;;;;;;;;;;;;; | ||
+ | (defun move-torso (joint-angle) | ||
+ | (declare (type number joint-angle)) | ||
+ | (let* ((bindings | ||
+ | (car | ||
+ | (prolog: | ||
+ | `(and (cram-robot-interfaces: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | (if (< joint-angle lower-limit) | ||
+ | | ||
+ | (if (> joint-angle upper-limit) | ||
+ | | ||
+ | | ||
+ | (prolog: | ||
+ | | ||
+ | | ||
+ | (prolog: | ||
+ | | ||
+ | | ||
+ | (unless (< (abs (- joint-angle cropped-joint-angle)) 0.0001) | ||
+ | (cpl:fail ' | ||
+ | : | ||
+ | :torso joint-angle))) | ||
+ | ;; (cram-occasions-events: | ||
+ | ;; (make-instance ' | ||
+ | ) | ||
+ | </ | ||
+ | **setup-urdf.lisp** | ||
+ | In the setup-urdf.lisp we make sure that the original urdf from the hsrb is working with our bullet world. This function needs to be called in the setup.lisp before spawning the robot. | ||
+ | <code lisp> | ||
+ | (in-package :hsrb-proj) | ||
+ | (defparameter *robot-parameter* " | ||
+ | ;;the collision-box for base_footprint, | ||
+ | (defparameter *collision-box* | ||
+ | "> | ||
+ | < | ||
+ | <origin rpy=\" | ||
+ | < | ||
+ | <box size=\" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ;;the tool-frame for the hsrb, since the urdf does not provide one | ||
+ | (defparameter *tool-frame* | ||
+ | "< | ||
+ | < | ||
+ | < | ||
+ | <child link=\" | ||
+ | </ | ||
+ | <link name=\" | ||
+ | |||
+ | |||
+ | ;;call this function in your demo seutp.lisp it also takes care of the parameter in rob-int e.g | ||
+ | ;; (defun setup-bullet-world () | ||
+ | ;; (setf btr: | ||
+ | ;; (let* ((robot (hsrb-proj:: | ||
+ | ;; (kitchen (or *kitchen-urdf* ..... | ||
+ | |||
+ | (defun get-urdf () | ||
+ | (let* ((robi (substitute #\SPACE #\` | ||
+ | | ||
+ | | ||
+ | (cl-urdf: | ||
+ | | ||
+ | ;;plus 15 because of base_footprint" | ||
+ | (subseq robi 0 (+ 15 (search " | ||
+ | *collision-box* | ||
+ | ;;plus 17 because of base_footprint"/> | ||
+ | (subseq robi (+ 17 (search " | ||
+ | (search "< | ||
+ | *tool-frame* | ||
+ | (subseq robi (search "< | ||
+ | robot)) | ||
+ | </ |