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
doc:beginner:creating_a_cram_package [2013/12/17 13:42] gkazhoyadoc:beginner:creating_a_cram_package [2014/03/11 13:39] (current) hmess
Line 9: Line 9:
 ===== Creating a ROS package ===== ===== Creating a ROS package =====
  
-First we need to create a ROS package. It needs to depend on ''cram_language''.+First we need to create a ROS package that depend on ''cram_language''
 +You can do this with either catkin or rosbuild.
  
-**catkin** +**For catkin**
-Go to ''src'' subdirectory of your catkin workspace:+
  
 +Go to the ''src'' subdirectory of your catkin workspace:
 <code bash>$ cd MY_CATKIN_WORKSPACE_PATH/src</code> <code bash>$ cd MY_CATKIN_WORKSPACE_PATH/src</code>
- 
 and execute the following: and execute the following:
- +<code bash>$ catkin_create_pkg cram_beginner_tutorial cram_language </code>
-<code bash>$ catkin_create_pkg cram_tutorial cram_language </code> +
 More information on ''catkin_create_pkg'' can be found by executing More information on ''catkin_create_pkg'' can be found by executing
 +<code>$ catkin_create_pkg --help</code>
 +or on the [[http://wiki.ros.org/catkin/Tutorials/CreatingPackage|ROS Website]].
  
-<code bash>$ catkin_create_pkg --help</code> +**For rosbuild**
- +
-or on [[http://wiki.ros.org/catkin/Tutorials/CreatingPackage|ROS Website]]. +
- +
-**rosbuild** +
-Please use ''rosbuild'' only if you reeeeally need to. And keep in mind that it is deprecated and will be removed from ROS at some point.+
  
 +Please use ''rosbuild'' only if you really need to. And keep in mind that it is deprecated and will be removed from ROS at some point.
 In your rosbuild workspace root do: In your rosbuild workspace root do:
- +<code bash>$ roscreate-pkg cram_beginner_tutorial cram_language</code>
-<code bash>$ roscreate-pkg cram_tutorial cram_language</code> +
 That was easy. Now we need to set up the Lisp infrastructure. That was easy. Now we need to set up the Lisp infrastructure.
- 
  
 ===== Setting up the Lisp infrastructure ===== ===== Setting up the Lisp infrastructure =====
Line 43: Line 36:
 ==== Creating an ASDF system ==== ==== Creating an ASDF system ====
  
-Switch into the root directory of the ''cram_tutorial'' package:+Switch into the root directory of the ''cram_beginner_tutorial'' package:
  
 <code bash> <code bash>
 $ rospack profile $ rospack profile
-$ roscd cram_tutorial+$ roscd cram_beginner_tutorial
 </code> </code>
      
-and create a file ''cram-tutorial.asd''. You shouldn't use underscores but dashes in asd file names. The reason is that the system that is defined in the asd file should be named like the file itself and in Lisp it is very uncommon to use underscores in general.+and create a file ''cram-beginner-tutorial.asd''. You shouldn't use underscores but dashes in asd file names. The reason is that the system that is defined in the asd file should be named like the file itself and in Lisp it is very uncommon to use underscores in general.
  
 === The code === === The code ===
  
-Put the following content into ''cram-tutorial.asd'':+Put the following content into ''cram-beginner-tutorial.asd'':
  
 <code lisp> <code lisp>
-(defsystem cram-tutorial+(defsystem cram-beginner-tutorial
   :depends-on (cram-language)   :depends-on (cram-language)
   :components   :components
Line 81: Line 74:
  
 <code lisp> <code lisp>
-(defpackage cram-tutorial+(defpackage cram-beginner-tutorial
   (:nicknames :tut)   (:nicknames :tut)
   (:use #:cpl))   (:use #:cpl))
Line 88: Line 81:
 === The code explained === === The code explained ===
  
-We define a package with the name ''cram-tutorial''. Packages in Common Lisp can have an arbitrary number of nicknames. In our case we nickname ''cram-tutorial'' as ''tut''. Finally, we define that the package uses another package ''cpl'' which is the nickname of a package of the CRAM Plan Language. Please note that most Common Lisp packages actually use the package ''common-lisp'' which exports all symbols of the Common Lisp standard. The packages ''cpl'' and ''common-lisp'' cannot be used together because the CRAM Language re-defines some of the symbols of the ''common-lisp'' package and thus ''cpl'' and ''common-lisp'' would conflict.+We define a package with the name ''cram-beginner-tutorial''. Packages in Common Lisp can have an arbitrary number of nicknames. In our case we nickname ''cram-beginner-tutorial'' as ''tut''. Finally, we define that the package uses another package ''cpl'' which is the nickname of a package of the CRAM Plan Language. Please note that most Common Lisp packages actually use the package ''common-lisp'' which exports all symbols of the Common Lisp standard. The packages ''cpl'' and ''common-lisp'' cannot be used together because the CRAM Language re-defines some of the symbols of the ''common-lisp'' package and thus ''cpl'' and ''common-lisp'' would conflict.
  
 ==== Exporting the ASDF system to ROS ==== ==== Exporting the ASDF system to ROS ====
  
-To actually load the ASDF system, all files referenced in the system definition must be present and we are missing the file ''src/tutorial.lisp'', so create it with the following content:+To actually load the ASDF system, all files referenced in the system definition must be present and we are missing the file ''tutorial.lisp'' in ''src'', so create it with the following content:
  
 <code lisp> <code lisp>
Line 110: Line 103:
  
 <code lisp> <code lisp>
-(ros-load:load-system "cram_tutorial" :cram-tutorial)+(ros-load:load-system "cram_beginner_tutorial" :cram-beginner-tutorial)
 </code> </code>
  
Line 118: Line 111:
 , ,
 ros-load-system ros-load-system
-cram_tutorial +cram_beginner_tutorial 
-cram-tutorial+cram-beginner-tutorial
 </code> </code>
  
-The first parameter to ''ros-load-system'' names the ROS package in which to search for the system, the second parameter names the system to be loaded. Executing the above command should load our new ASDF system. Now the package ''cram-tutorial'' should be defined. Test it by evaluating+The first parameter to ''ros-load-system'' names the ROS package in which to search for the system, the second parameter names the system to be loaded. Executing the above command should load our new ASDF system. Now the package ''cram-beginner-tutorial'' should be defined. Test it by evaluating
  
 <code lisp> <code lisp>