Both sides previous revisionPrevious revisionNext revision | Previous revision |
tutorials:beginner:package_for_turtlesim [2019/07/03 11:45] – [Creating an ASDF system] tlipps | tutorials:beginner:package_for_turtlesim [2019/07/09 18:02] (current) – [Exporting the ASDF system to ROS] gkazhoya |
---|
| |
<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 ==== |
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'', 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). | 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> |
CL-USER> (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 |
| |