Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tutorials:advanced:new-robot [2019/02/21 09:52] – [Create a CRAM robot description package] vanessa | tutorials:advanced:new-robot [2019/02/23 08:47] – [Create a CRAM robot description package] 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 378: | Line 376: | ||
</ | </ | ||
- | If no **gripper_tool_joint** is defined for your robot you need to add one in the URDF it self. It is important that the parent will be the wrist_palm_link and the joint is fixed. The origin you will need to change yourself it should be directly in the middle of the gripper: | + | If no **gripper_tool_joint** is defined for your robot you need to add one in the URDF it self. It is important that the parent will be the wrist_palm_link and the joint is fixed. The origin you will need to change yourself it should be directly in the middle of the gripper. However since we dont want to change the original URDF we decided that there will be a setup-urdf.lisp file for the HSR that takes care of the necessary URDF changes. |
<code lisp> | <code lisp> | ||
- | <joint name=" | + | ;;the tool-frame for the hsrb, since the urdf does not provide one |
- | < | + | (defparameter *tool-frame* |
- | < | + | "<joint name=\" |
- | <child link=" | + | |
+ | < | ||
+ | <child link=\" | ||
</ | </ | ||
- | <link name=" | + | <link name=\" |
</ | </ | ||
{{: | {{: | ||
Line 392: | Line 392: | ||
Then the moveable arm-joints/ | Then the moveable arm-joints/ | ||
+ | |||
+ | |||
Next step is to define the general-knowledge.lisp: | Next step is to define the general-knowledge.lisp: | ||
Line 402: | Line 404: | ||
| | ||
arm | arm | ||
- | | + | |
+ | | ||
(<- (robot hsrb)) | (<- (robot hsrb)) | ||
Line 408: | Line 411: | ||
(<- (robot-base-frame hsrb " | (<- (robot-base-frame hsrb " | ||
- | (<- (robot-torso-link-joint hsrb " | ||
(<- (robot-torso-link-joint hsrb " | (<- (robot-torso-link-joint hsrb " | ||
- | (<- (arm hsrb :left)) | + | |
+ | ;(<- (robot-torso-link-joint | ||
- | (<- (camera-frame hsrb "/hsrb/ | + | |
+ | | ||
+ | (<- (robot-pan-tilt-links | ||
+ | (<- (robot-pan-tilt-joints hsrb " | ||
</ | </ | ||
It is important to describe the robot-base-frame here and the torso-link/ | It is important to describe the robot-base-frame here and the torso-link/ | ||
- | In the description package you can also define mimic joints you just need to specifying both joints in the torso-link-joint | + | In the description package you can also see that we declared |
==== 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)) | ||
+ | </ |