Ask Your Question
1

How to load an asdf system and run a lisp file within a launch file?

asked 2012-05-02 03:11:35 -0500

Jui Wang gravatar image

updated 2012-05-13 21:09:54 -0500

I followed ControllingTurtlesimFromLisp.

I open emacs and I use "rosrun" to open "turtlesim". Then I use asdf system to control my turtle.

I need to run a robot system which is opened by "roslaunch", but I can't open emacs by "roslaunch" to load asdf system and lisp file to control my turtle.

So I think I should not use emacs. Now I think I need to load an asdf system and run a lisp file within a launch file.

But how to run a lisp file and load an asdf system within a launch file?


My package name is "flower_cram_turtlesim_control". I made a flower_cram_turtlesim_control.asd in this package. I made a flower_cram_turtlesim_control.lisp in src. I add

  rospack_add_lisp_executable(bin/turtle_controller flower-cram-system flower_cram_turtlesim_control:main)

in my CMakeLists.txt.

After "rosmake", I tried executing it, but it didn't work. Here is the error message:

  flower@flower:~/ros/flower_cram_turtlesim_control/bin$ ./turtle_controller 
  Roslisp exiting due to condition: SB-INT:SIMPLE-READER-PACKAGE-ERROR at 34 (line 1, column 34) on #<SB-IMPL::STRING-INPUT-STREAM

                                                                                                      {10040722B1}>:
                                      package "FLOWER_CRAM_TURTLESIM_CONTROL" not found
  flower@flower:~/ros/flower_cram_turtlesim_control/bin$

What should I do?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-05-02 04:14:24 -0500

Lorenz gravatar image

Roslisp provides a way to create a script that loads an asdf system and run a lisp function. Assume you created the asdf file turtle-controller in the ROS package turtle_controller. The lisp package is call turtle-controller and your entry point is the lisp function main. To get an executable, do the following:

  1. Create a lisp "main" function that is the entry point for the script. Let's call it main for now.

  2. Open your package's CMakeLists.txt and add the following at the end:

    rospack_add_lisp_executable(bin/turtle_controller turtle-controller turtle-controller:main)

  3. rosmake turtle_controller

Now you should have a binary in turtle_controller/bin. Try executing it. If it works, you can also use it in launch files, e.g.:

<roslaunch>
  <node name="turtle_controller" type="turtle_controller" pkg="turtle_controller" />
</roslaunch>
edit flag offensive delete link more

Comments

I tried your solution, but I met some problem. I edited my question, and my problem is show on the above. Thank you very much. :)

Jui Wang gravatar imageJui Wang ( 2012-05-13 21:09:01 -0500 )edit

It seems like you didn't define the package FLOWER_CRAM_TURTLESIM_CONTROL. Can you please add how your defpackage call looks like? Maybe your complete asd file could help as well.

Lorenz gravatar imageLorenz ( 2012-05-13 21:59:36 -0500 )edit

I defined the package FLOWER_CRAM_TURTLESIM_CONTROL in my asd file. Then I met a new problem. Here is my error message: Roslisp exiting due to condition: The function COMMON-LISP-USER::SEND-VEL-CMD is undefined. How to solve it? Thank you.

Jui Wang gravatar imageJui Wang ( 2012-05-16 02:26:08 -0500 )edit

That's a package problem. SEND-VEL-CMD should be in package FLOWER-CRAM_TURTLESIM_CONTROL. I guess you are missing a (in-package :flower_cram_turtlesim_control) at the beginning of your source file. I suggest follow the instructions at http://ros.org/wiki/cram_pl/Tutorials/CreatingCramPackage

Lorenz gravatar imageLorenz ( 2012-05-16 02:47:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-05-02 03:11:35 -0500

Seen: 705 times

Last updated: May 13 '12