Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorials:intermediate:moveit [2015/06/05 07:01] – [Forward and Inverse Kinematics] mpomarlantutorials:intermediate:moveit [2016/03/07 19:55] – [Accessing the robot state] gkazhoya
Line 11: Line 11:
 Fortunately, CRAM already offers you interfaces to some other useful software packages, and this tutorial will present one of them: MoveIt!. Of course, to run the tutorial, you will have to make sure MoveIt! exists on your system. For installation guidelines, [[http://moveit.ros.org/install/|see here]]. Fortunately, CRAM already offers you interfaces to some other useful software packages, and this tutorial will present one of them: MoveIt!. Of course, to run the tutorial, you will have to make sure MoveIt! exists on your system. For installation guidelines, [[http://moveit.ros.org/install/|see here]].
  
-You will also need the tutorial initialization code. Go to the src folder of your ROS workspace and check whether the cram_tutorials folder exists, and whether it contains cram_intermediate_tutorials. If not, retrieve this code [[https://github.com/cram-code/cram_tutorials|from github]].+You will also need the tutorial initialization code. Go to the src folder of your ROS workspace and check whether the cram_tutorials folder exists, and whether it contains cram_intermediate_tutorials. If not, retrieve this code [[https://github.com/cram2/cram_tutorials|from github]].
  
 ===== Initializing cram_moveit ===== ===== Initializing cram_moveit =====
Line 23: Line 23:
 In another tab, run In another tab, run
  
-<code>roscd pr2_moveit_config +<code> 
-roslaunch ./launch/demo.launch+roslaunch pr2_moveit_config demo.launch
 </code> </code>
  
Line 31: Line 31:
 Finally, in the last tab run the roslisp REPL. Once it has started up, type the following at its command prompt: Finally, in the last tab run the roslisp REPL. Once it has started up, type the following at its command prompt:
  
-<code lisp>(swank:operate-on-system-for-emacs "cram-intermediate-tutorial" (quote load-op)+<code lisp
- +CL-USER> (ros-load:load-system "cram_intermediate_tutorial" :cram-intermediate-tutorial) 
-(in-package :moveit) +CL-USER> (tuti:init-cram-moveit-tutorial) 
- +CL-USER> (in-package :cram-moveit) 
-(tuti:init-cram-moveit-tutorial)</code>+</code>
  
-This will load the tutorial code (and its dependencies, in particular cram-moveit), and will initialize a few variables we'll be using later. Also, it will start a ROS node from the REPL, which you need to do in order to send messages and service requests to other ROS nodes like move_group, and it will initialize the communication with MoveIt!. It defines publishers for updates to the planning scene (so you can modify what objects exist in the robot's environment), subscribes to robot joint state updates, and creates an actionclient object so that you can send requests to move_group.+This will load the tutorial code (and its dependencies, in particular ''cram-moveit''), and will initialize a few variables we'll be using later. Also, it will start a ROS node from the REPL, which you need to do in order to send messages and service requests to other ROS nodes like ''move_group'', and it will initialize the communication with MoveIt!. It defines publishers for updates to the planning scene (so you can modify what objects exist in the robot's environment), subscribes to robot joint state updates, and creates an ActionLib client object so that you can send requests to ''move_group''.
  
-For now, tuti:init-cram-moveit-tutorial will do all that for you. In your own programs, if you need to make sure those steps happen then you will have to call (or make sure that they are called)+For now, ''tuti:init-cram-moveit-tutorial'' will do all that for you. In your own programs you will have to do the initialization yourself by calling:
  
 <code lisp> <code lisp>
-  (roslisp:start-ros-node node-name+  (roslisp:start-ros-node NODE-NAME
-  (moveit:init-moveit-bridge)+  (cram-moveit:init-moveit-bridge)
 </code> </code>
  
Line 84: Line 84:
 </code> </code>
  
-Notice that it's a list of lists (joint-name joint-values), which you could search for the joints that interest you. Or, better, you could just ask MoveIt! for the joints you're interested in:+Notice that it's a list of lists ''(joint-name joint-values)'', which you could search for the joints that interest you. Or, better, you could just ask MoveIt! for the joints you're interested in:
  
 <code lisp> <code lisp>
Line 104: Line 104:
 </code> </code>
  
-Play a bit with the robot in RViz: move one arm (remember to click Plan and Execute to make sure the movement actually happens!), then use joint-states to look at some joint on the arm and see that it changes.+Play a bit with the robot in RViz: move one arm (remember to click Plan and Execute to make sure the movement actually happens!), then use ''joint-states'' to look at some joint on the arm and see that it changes.
  
-Another function you can use to get the current robot state is get-planning-scene-info. To get a robot state ROS message (as opposed to a list of name-value pairs), use the following:+Another function you can use to get the current robot state is ''get-planning-scene-info''. To get a robot state ROS message (as opposed to a list of name-value pairs), use the following:
  
 <code lisp> <code lisp>
Line 159: Line 159:
                         "right_arm"                          "right_arm" 
                         "r_wrist_roll_link"                          "r_wrist_roll_link" 
-                        tuti:*pose-right-msg* +                        (list tuti:*pose-right-msg*)
                         0.1                          0.1 
                         1.5                          1.5