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
tutorials:beginner:package_for_turtlesim [2016/01/21 17:32] – [Creating an ASDF system] gkazhoyatutorials:beginner:package_for_turtlesim [2019/07/09 18:02] (current) – [Exporting the ASDF system to ROS] gkazhoya
Line 1: Line 1:
 ====== Creating a CRAM package ====== ====== Creating a CRAM package ======
  
-**Description:** In this tutorial you will set up a ROS package to use the CRAM plan language within the lisp repl.+**Description:** In this tutorial you will set up a ROS package to use the CRAM plan language within the Lisp REPL. You can find the code resulting from the beginner tutorials on [[https://github.com/cram2/cram_tutorials|GitHub]]..
  
 **Next Tutorial:** [[tutorials:beginner:controlling_turtlesim_2|Controlling turtlesim from CRAM]] **Next Tutorial:** [[tutorials:beginner:controlling_turtlesim_2|Controlling turtlesim from CRAM]]
Line 10: Line 10:
  
 In the ''src'' subdirectory of your ROS workspace execute the following command: In the ''src'' subdirectory of your ROS workspace execute the following command:
-<code bash>$ catkin_create_pkg cram_beginner_tutorial cram_language </code>+<code bash>$ catkin_create_pkg cram_my_beginner_tutorial cram_language </code>
 ===== Setting up the Lisp infrastructure ===== ===== Setting up the Lisp infrastructure =====
  
Line 18: Line 18:
 ==== Creating an ASDF system ==== ==== Creating an ASDF system ====
  
-Switch into the root directory of the ''cram_beginner_tutorial'' package   +Switch into the root directory of the ''cram_my_beginner_tutorial'' package   
-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.+and create a file ''cram-my-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.
  
-Put the following content into ''cram-beginner-tutorial.asd'':+Put the following content into ''cram-my-beginner-tutorial.asd'':
  
 <code lisp> <code lisp>
-(defsystem cram-beginner-tutorial+(defsystem cram-my-beginner-tutorial
   :depends-on (cram-language)   :depends-on (cram-language)
   :components   :components
Line 45: Line 45:
  
 <code lisp> <code lisp>
-(defpackage cram-beginner-tutorial+(defpackage :cram-my-beginner-tutorial
   (:nicknames :tut)   (:nicknames :tut)
-  (:use #:cpl))+  (:use :cpl))
 </code>   </code>  
      
-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 a nickname of the package  ''cram-language'' from the metapackage ''cram_core''+We define a package with the name ''cram-my-beginner-tutorial''. Packages in Common Lisp can have an arbitrary number of nicknames. In our case we nickname ''cram-my-beginner-tutorial'' as ''tut''. Finally, we define that the package uses another package ''cpl'' which is a nickname of the package  ''cram-language'' from the metapackage ''cram_core''
  
 ==== Exporting the ASDF system to ROS ==== ==== Exporting the ASDF system to ROS ====
Line 62: Line 62:
 This just selects the namespace of the file by the nickname '':tut'' we defined in ''package.lisp''. We will fill it with more content in the next tutorial. This just selects the namespace of the file by the nickname '':tut'' we defined in ''package.lisp''. We will fill it with more content in the next tutorial.
  
-Now we are ready to compile and load our new system. Launch the Lisp REPL (''$ roslisp_repl''). +Now we are ready to compile and load our new system. First of all, let us compile the ROS workspace, such that ROS knows about our new ''cram_my_beginner_tutorial'' package: 
 + 
 +<code bash> 
 +$ roscd && cd .. && catkin_make 
 +</code> 
 + 
 +Then launch the Lisp REPL (''$ roslisp_repl'', if you already have a REPL running, keep in mind that you need to restart it whenever a new ROS package is added to the workspace). 
 Then load your newly created system by typing: Then load your newly created system by typing:
  
 <code lisp> <code lisp>
-(ros-load:load-system "cram_beginner_tutorial" :cram-beginner-tutorial)+CL-USER> (ros-load:load-system "cram_my_beginner_tutorial" :cram-my-beginner-tutorial)
 </code> </code>
  
-This loads the ''cram-beginner-tutorial'' of the package ''cram_beginner_tutorial''.+This loads the ''cram-my-beginner-tutorial'' of the package ''cram_my_beginner_tutorial''.
 Test it by evaluating Test it by evaluating
  
 <code lisp> <code lisp>
-(in-package :tut)+CL-USER> (in-package :tut)
 </code> </code>