0
$\begingroup$

Rosanswers logo

I followed roslisp/Overview/Installation and Roslisp Basic Usage.

I run:

  roscreate-pkg sam_begin_lisp roslisp roslisp_runtime
  cd sam_begin_lisp/
  mkdir src

y src/talker.lisp:

  (in-package :sam_begin_lisp)
  
  (defun talker ()
    "Periodically print a string message on the /chatter topic"
    (with-ros-node ("talker")   
      (let ((i 0) (pub (advertise "chatter" "std_msgs/String")))
        (loop-at-most-every .1
           (publish-msg pub :data (format nil "foo ~a" (incf i)))
        )
      )
    )
  )

My src/listener.lisp

  (in-package :sam_begin_lisp)
  
  (defun listener ()
    (with-ros-node ("listener" :spin t)
      (subscribe "chatter" "std_msgs/String" #'print)
    )
  )

My CMakeLists.txt:

  cmake_minimum_required(VERSION 2.4.6)
  include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
  
  # Set the build type.  Options are:
  #  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
  #  Debug          : w/ debug symbols, w/o optimization
  #  Release        : w/o debug symbols, w/ optimization
  #  RelWithDebInfo : w/ debug symbols, w/ optimization
  #  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
  #set(ROS_BUILD_TYPE RelWithDebInfo)
  
  rosbuild_init()
  
  #set the default path for built executables to the "bin" directory
  set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
  #set the default path for built libraries to the "lib" directory
  set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
  
  #uncomment if you have defined messages
  #rosbuild_genmsg()
  #uncomment if you have defined services
  #rosbuild_gensrv()
  
  #common commands for building c++ executables and libraries
  #rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
  #target_link_libraries(${PROJECT_NAME} another_library)
  #rosbuild_add_boost_directories()
  #rosbuild_link_boost(${PROJECT_NAME} thread)
  #rosbuild_add_executable(example examples/example.cpp)
  #target_link_libraries(example ${PROJECT_NAME})
  rospack_add_lisp_executable(bin/talker sam_begin_lisp sam_begin_lisp:talker)
  rospack_add_lisp_executable(bin/listener sam_begin_lisp sam_begin_lisp:listener)
                                            

When I rosmake, it shows:

  sam@/home/sam/code/ros/lisp/sam_begin_lisp$ rosmake
  [ rosmake ] No package specified.  Building ['sam_begin_lisp']                                                                                              
  [ rosmake ] Packages requested are: ['sam_begin_lisp']                                                                                                      
  [ rosmake ] Logging to directory/home/sam/.ros/rosmake/rosmake_output-20120813-214948                                                                       
  [ rosmake ] Expanded args ['sam_begin_lisp'] to:
  ['sam_begin_lisp']                                                                                         
  [ rosmake ] Checking rosdeps compliance for packages sam_begin_lisp.  This may take a few seconds.                                                          
  [ rosmake ] rosdep check passed all system dependencies in packages                                                                                         
  [rosmake-0] Starting >>> roslib [ make ]                                                                                                                    
  [rosmake-0] Finished <<< roslib ROS_NOBUILD in package roslib                                                                                               
  [rosmake-1] Starting >>> rosbuild [ make ]                                                                                                                  
  [rosmake-1] Finished <<< rosbuild ROS_NOBUILD in package rosbuild
   No Makefile in package rosbuild                                                          
  [rosmake-2] Starting >>> std_srvs [ make ]                                                                                                                  
  [rosmake-2] Finished <<< std_srvs ROS_NOBUILD in package std_srvs                                                                                           
  [rosmake-3] Starting >>> sbcl [ make ]                                                                                                                      
  [rosmake-1] Starting >>> roslang [ make ]                                                                                                                   
  [rosmake-3] Finished <<< sbcl ROS_NOBUILD in package sbcl                                                                                                   
  [rosmake-1] Finished <<< roslang ROS_NOBUILD in package roslang
   No Makefile in package roslang                                                             
  [rosmake-0] Starting >>> std_msgs [ make ]                                                                                                                  
  [rosmake-0] Finished <<< std_msgs ROS_NOBUILD in package std_msgs                                                                                           
  [rosmake-1] Starting >>> roslisp [ make ]                                                                                                                   
  [rosmake-1] Finished <<< roslisp ROS_NOBUILD in package roslisp                                                                                             
  [rosmake-1] Starting >>> roslisp_runtime [ make ]                                                                                                           
  [rosmake-1] Finished <<< roslisp_runtime ROS_NOBUILD in package roslisp_runtime                                                                             
  [rosmake-1] Starting >>> sam_begin_lisp [ make ]                                                                                                            
  [ rosmake ] Last 40 linesm_begin_lisp: 1.1 sec ]                                                                                  [ 1 Active 9/10 Complete ]
  {-------------------------------------------------------------------------------
    make[3]: Entering directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    Scanning dependencies of target rospack_genmsg_libexe
    make[3]: Leaving directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    [  0%] Built target rospack_genmsg_libexe
    make[3]: Entering directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    Scanning dependencies of target rosbuild_precompile
    make[3]: Leaving directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    [  0%] Built target rosbuild_precompile
    make[3]: Entering directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    Scanning dependencies of target _roslisp_bin_talker
    make[3]: Leaving directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    make[3]: Entering directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    [  0%] Generating ../bin/talker, ../bin/talker.lisp
    ; loading system definition from
    ; /opt/ros/electric/stacks/ros_comm/clients/roslisp/asdf/ros-load-manifest.asd
    ; into #<PACKAGE "ASDF0">
    ; registering #<SYSTEM :ROS-LOAD-MANIFEST {1003486291}> as ROS-LOAD-MANIFEST
    ; loading system definition from
    ; /opt/ros/electric/stacks/roslisp_support/sbcl/sbcl/lib/sbcl/sb-posix/sb-posix.asd
    ; into #<PACKAGE "ASDF0">
    ; loading system definition from
    ; /opt/ros/electric/stacks/roslisp_support/sbcl/sbcl/lib/sbcl/sb-grovel/sb-grovel.asd
    ; into #<PACKAGE "ASDF1">
    ; registering #<SYSTEM SB-GROVEL {1002ED17E1}> as SB-GROVEL
    ; registering #<SYSTEM SB-POSIX {1002BBE7C1}> as SB-POSIX
    ; registering #<SYSTEM SB-POSIX-TESTS {1002F39741}> as SB-POSIX-TESTS
    STYLE-WARNING: Couldn't grovel for SIGEMT (unknown to the C compiler).
    STYLE-WARNING: Couldn't grovel for S_IFWHT (unknown to the C compiler).
    STYLE-WARNING: Couldn't grovel for O_DIRECT (unknown to the C compiler).
    Compilation failed due to condition: The value NIL
                                         is not of type
                                           (OR (VECTOR CHARACTER) (VECTOR NIL)
                                               BASE-STRING PATHNAME FILE-STREAM).
    make[3]: *** [CMakeFiles/_roslisp_bin_talker] Error 1
    make[3]: Leaving directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    make[2]: *** [CMakeFiles/_roslisp_bin_talker.dir/all] Error 2
    make[2]: Leaving directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/sam/code/ros/lisp/sam_begin_lisp/build'
  -------------------------------------------------------------------------------}
  [ rosmake ] Output from build of package sam_begin_lisp written to:
  [ rosmake ]    /home/sam/.ros/rosmake/rosmake_output-20120813-214948/sam_begin_lisp/build_output.log
  [rosmake-1] Finished <<< sam_begin_lisp [FAIL] [ 1.12 seconds ]                                                                                             
  [ rosmake ] Halting due to failure in package sam_begin_lisp. 
  [ rosmake ] Waiting for other threads to complete.                                           
  [ rosmake ] Results:                                                                                                                                        
  [ rosmake ] Built 10 packages with 1 failures.                                                                                                              
  [ rosmake ] Summary output to directory                                                                                                                     
  [ rosmake ] /home/sam/.ros/rosmake/rosmake_output-20120813-214948                                                                                           
  
  sam@/home/sam/code/ros/lisp/sam_begin_lisp$                                                                                                        

How to solve it?

Thank you~


I added src/libs.lisp:

   (defpackage sam-begin-lisp
    (:nicknames :first-package)
    (:use #:roslisp #:roslisp_runtime)
  )

change src/talker.lisp to: (revise the first line)

  (in-package :sam-begin-lisp)
  
  (defun talker ()
    "Periodically print a string message on the /chatter topic"
    (with-ros-node ("talker")   
      (let ((i 0) (pub (advertise "chatter" "std_msgs/String")))
        (loop-at-most-every .1
           (publish-msg pub :data (format nil "foo ~a" (incf i)))
        )
      )
    )
  )

Change src/listener.lisp to: (revise the first line)

  (in-package :sam-begin-lisp)
  
  (defun listener ()
    (with-ros-node ("listener" :spin t)
      (subscribe "chatter" "std_msgs/String" #'print)
    )
  )

Add sam-lisp-system.asd:

  (defsystem sam-lisp-system
    :depends-on (roslisp)
    :components
    ((:module "src"
              :components
              (
               (:file "libs")
               (:file "talker" :depends-on ("libs"))
               (:file "listener" :depends-on ("libs"))
              )
     ))
  )

I also run:

  mkdir asdf
  cd asdf/
  ln -s ../sam-lisp-system.asd .
  cd ..
  rosmake

Then it shows:

  sam@sam:~/code/ros/ai/lisp/sam_begin_lisp$ rosmake
  [ rosmake ] No package specified.  Building ['sam_begin_lisp']                                                                                                                   
  [ rosmake ] Packages requested are: ['sam_begin_lisp']                                                                                                                           
  [ rosmake ] Logging to directory/home/sam/.ros/rosmake/rosmake_output-20120814-162006                                                                                            
  [ rosmake ] Expanded args ['sam_begin_lisp'] to:
  ['sam_begin_lisp']                                                                                                              
  [ rosmake ] Checking rosdeps compliance for packages sam_begin_lisp.  This may take a few seconds.                                                                               
  [ rosmake ] rosdep check passed all system dependencies in packages                                                                                                              
  [rosmake-0] Starting >>> roslib [ make ]                                                                                                                                         
  [rosmake-0] Finished <<< roslib ROS_NOBUILD in package roslib                                                                                                                    
  [rosmake-0] Starting >>> rosbuild [ make ]                                                                                                                                       
  [rosmake-0] Finished <<< rosbuild ROS_NOBUILD in package rosbuild
   No Makefile in package rosbuild                                                                               
  [rosmake-0] Starting >>> roslang [ make ]                                                                                                                                        
  [rosmake-0] Finished <<< roslang ROS_NOBUILD in package roslang
   No Makefile in package roslang                                                                                  
  [rosmake-0] Starting >>> std_srvs [ make ]                                                                                                                                       
  [rosmake-0] Finished <<< std_srvs ROS_NOBUILD in package std_srvs                                                                                                                
  [rosmake-0] Starting >>> roslisp [ make ]                                                                                                                                        
  [rosmake-0] Finished <<< roslisp ROS_NOBUILD in package roslisp                                                                                                                  
  [rosmake-0] Starting >>> sbcl [ make ]                                                                                                                                           
  [rosmake-0] Finished <<< sbcl ROS_NOBUILD in package sbcl                                                                                                                        
  [rosmake-0] Starting >>> std_msgs [ make ]                                                                                                                                       
  [rosmake-0] Finished <<< std_msgs ROS_NOBUILD in package std_msgs                                                                                                                
  [rosmake-0] Starting >>> roslisp_runtime [ make ]                                                                                                                                
  [rosmake-0] Finished <<< roslisp_runtime ROS_NOBUILD in package roslisp_runtime                                                                                                  
  [rosmake-0] Starting >>> sam_begin_lisp [ make ]                                                                                                                                 
  [ rosmake ] All 37 linesam_begin_lisp: 2.7 sec ]                                                                                                       [ 1 Active 9/10 Complete ]
  {-------------------------------------------------------------------------------
    mkdir -p bin
    cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake  ..
    [rosbuild] Building package sam_begin_lisp
    [rosbuild] Including /home/sam/code/ros/call_graph_roscpp/roscpp/cmake/roscpp.cmake
    [rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/rospy/cmake/rospy.cmake
    [rosbuild] Including /opt/ros/electric/stacks/client_rosjava_jni/rosjava_jni/cmake/rosjava.cmake
    -- Java version 1.6.0.24 configured successfully!
    [rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/roslisp/cmake/roslisp.cmake
    [rosbuild] WARNING: rospack_add_lisp_executable is deprecated; please use rosbuild_add_lisp_executable instead
    [rosbuild] WARNING: rospack_add_lisp_executable is deprecated; please use rosbuild_add_lisp_executable instead
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/sam/code/ros/ai/lisp/sam_begin_lisp/build
    cd build && make -l2
    make[1]: Entering directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[2]: Entering directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[3]: Entering directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[3]: Leaving directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    [  0%] Built target rospack_genmsg_libexe
    make[3]: Entering directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[3]: Leaving directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    [  0%] Built target rosbuild_precompile
    make[3]: Entering directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[3]: Leaving directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[3]: Entering directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    [  0%] Generating ../bin/talker, ../bin/talker.lisp
    STYLE-WARNING: Couldn't grovel for SIGEMT (unknown to the C compiler).
    STYLE-WARNING: Couldn't grovel for S_IFWHT (unknown to the C compiler).
    STYLE-WARNING: Couldn't grovel for O_DIRECT (unknown to the C compiler).
    Compilation failed due to condition: Component "sam_begin_lisp" not found
    make[3]: *** [CMakeFiles/_roslisp_bin_talker] Error 1
    make[3]: Leaving directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[2]: *** [CMakeFiles/_roslisp_bin_talker.dir/all] Error 2
    make[2]: Leaving directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/sam/code/ros/ai/lisp/sam_begin_lisp/build'
  -------------------------------------------------------------------------------}
  [ rosmake ] Output from build of package sam_begin_lisp written to:
  [ rosmake ]    /home/sam/.ros/rosmake/rosmake_output-20120814-162006/sam_begin_lisp/build_output.log         
  [rosmake-0] Finished <<< sam_begin_lisp [FAIL] [ 2.80 seconds ]                                                                                                                  
  [ rosmake ] Halting due to failure in package sam_begin_lisp. 
  [ rosmake ] Waiting for other threads to complete.                                                                
  [ rosmake ] Results:                                                                                                                                                             
  [ rosmake ] Built 10 packages with 1 failures.                                                                                                                                   
  [ rosmake ] Summary output to directory                                                                                                                                          
  [ rosmake ] /home/sam/.ros/rosmake/rosmake_output-20120814-162006                                                                                                                
  sam@sam:~/code/ros/ai/lisp/sam_begin_lisp$                                                       

How to solve it?

Thank you~

=====================================

I change src/libs.lisp to:

   (defpackage sam-begin-lisp
    (:nicknames :first-package)
    (:use #:common-lisp #:roslisp)
    (:export talker listener))
  )

And I change CMakeLists.txt to:

  cmake_minimum_required(VERSION 2.4.6)
  include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
  
  # Set the build type.  Options are:
  #  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
  #  Debug          : w/ debug symbols, w/o optimization
  #  Release        : w/o debug symbols, w/ optimization
  #  RelWithDebInfo : w/ debug symbols, w/ optimization
  #  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
  #set(ROS_BUILD_TYPE RelWithDebInfo)
  
  rosbuild_init()
  
  #set the default path for built executables to the "bin" directory
  set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
  #set the default path for built libraries to the "lib" directory
  set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
  
  #uncomment if you have defined messages
  #rosbuild_genmsg()
  #uncomment if you have defined services
  #rosbuild_gensrv()
  
  #common commands for building c++ executables and libraries
  #rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
  #target_link_libraries(${PROJECT_NAME} another_library)
  #rosbuild_add_boost_directories()
  #rosbuild_link_boost(${PROJECT_NAME} thread)
  #rosbuild_add_executable(example examples/example.cpp)
  #target_link_libraries(example ${PROJECT_NAME})
  rospack_add_lisp_executable(bin/talker sam-lisp-system sam_begin_lisp:talker)
  rospack_add_lisp_executable(bin/listener sam-lisp-system sam_begin_lisp:listener)
  

Then I compile passed!

But when I run roscore,listener,and talker, it shows:

listener:

  sam@sam:~/code/ros/ai/lisp/sam_begin_lisp$ ./bin/listener 
  Roslisp exiting due to condition: SB-INT:SIMPLE-READER-PACKAGE-ERROR at 23 (line 1, column 23) on #<SB-IMPL::STRING-INPUT-STREAM
  
                                                                                                      {1003E31E91}>:
                                      package "SAM_BEGIN_LISP" not found
  sam@sam:~/code/ros/ai/lisp/sam_begin_lisp$       

talker:

  sam@sam:~/code/ros/ai/lisp/sam_begin_lisp$ ./bin/talker 
  Roslisp exiting due to condition: SB-INT:SIMPLE-READER-PACKAGE-ERROR at 21 (line 1, column 21) on #<SB-IMPL::STRING-INPUT-STREAM
  
                                                                                                      {1003E29D11}>:
                                      package "SAM_BEGIN_LISP" not found
  sam@sam:~/code/ros/ai/lisp/sam_begin_lisp$       

How to solve it?

Thank you~


Originally posted by sam on ROS Answers with karma: 2570 on 2012-08-13

Post score: 0


Original comments

Comment by KruseT on 2012-08-13:
I don't see what causes the problem, maybe you can first try out rosmake for the tutorial source code, by checking out from svn: svn checkout https://code.ros.org/svn/ros/stacks/roslisp_support/trunk/roslisp_tutorials

Comment by Lorenz on 2012-08-13:
To be able to help we will need a little more information: can you please add the contents of your .asd file and your package definition (usually in the file package.lisp)?

Comment by sam on 2012-08-13:
I revised my original post to add few src. And roslisp_tutorials package is pass the rosmake.

Comment by Lorenz on 2012-08-13:
You still have sam_begin_lisp somewhere in in-package. It should be (in-package :sam-begin-lisp)

Comment by sam on 2012-08-13:
Thank you~I find it. It is in CMakeLists.txt.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You are missing #:common-lisp in the use section of your package definition and you must not use #:roslisp_runtime. Another issue is that you don't export the symbols TALKER and LISTENER although you use them in the CMakeLists.txt. It should be something like that:

(defpackage sam-begin-lisp
  (:nicknames :first-package)
  (:use #:common-lisp #:roslisp)
  (:export talker listener))

You then need to change your asd file to use your new, renamed package:

rospack_add_lisp_executable(bin/talker sam-lisp-system sam-begin-lisp:talker)
rospack_add_lisp_executable(bin/listener sam-lisp-system sam-begin-lisp:listener)

Btw. it is really uncommon to use rosmake while developing a lisp node. Rather, people use the REPL to interactively develop their code. That makes debugging much easier because you get backtraces that show where an error happened.

Try the following:

rosrun roslisp_repl repl

This will start up an emacs instance with a lisp shell. Then inside the lisp shell in emacs, run:

(ros-load:load-system "sam_begin_lisp" :sam-lisp-system)
(in-package :sam-begin-lisp)
(talker)

If the first line of the lisp commands above should fail, please copy-paste the complete backtrace to this question.

Now the talker should be running in lisp. You can check in a terminal with

rostopic echo /chatter

In the lisp repl, press Ctrl-c Ctrl-c and then click on abort. That shuts down the talker. Then execute in the lisp repl:

(listener)

Execute in a terminal:

rostopic pub /chatter std_msgs/String 'foo' -r 1

Now you should receive data in the lisp shell. After all of these steps worked, you can call rosmake again and it should not error out anymore. Then you can use your lisp wrapper binaries from the command line.


Originally posted by Lorenz with karma: 22731 on 2012-08-13

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by sam on 2012-08-14:
I can't see 'foo' string on listener of emacs. But I can see that on 'rostopic echo /chatter '. Is that correct? Thank you~

Comment by sam on 2012-08-14:
I also find typo errors on this answer. Should I point out? Thank you~

Comment by Lorenz on 2012-08-14:
The listener should actually show something if it is running. It could be a problem with multi-threading though. Try: 'cp rospack find roslisp_repl/swank.lisp ~/.swank.lisp' (note there is a . at the beginning of the destination file). And sure. I'll fix all the typos you found.

Comment by sam on 2012-08-14:
The type I found: '#:commin-lisp' -> '#:common-lisp', 'in-package :sam_begin_lisp' -> 'in-package :sam-begin-lisp'. And the last comment's 'lsitener' -> 'listener'. I also want to thank you for so detail describe.

Comment by sam on 2012-08-14:
Great~~ I try 'cp `rospack find roslisp_repl`/swank.lisp ~/.swank.lisp' success!! Thank you~

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.