Ask Your Question
0

Custom message generated C , Python and Lisp code location

asked 2013-05-13 08:38:08 -0500

Benjamin Blumer gravatar image

Hi all,

I'm following the tutorial here: http://www.ros.org/wiki/ROS/Tutorials/CreatingMsgAndSrv#Common_step_for_msg_and_srv .

I created the package in the previous tutorial. My catkin_ws is in a different location than used in the tutorial though. Mine is in a dropbox folder (~/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/src/beginner_tutorials).

When I execute catkin_make (step 4 in the tutorial),

~/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws$ catkin_make
Base path: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws
Source space: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/src
Build space: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/build
Devel space: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/devel
Install space: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/devel;/opt/ros/groovy
-- This workspace overlays: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/devel;/opt/ros/groovy
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using CATKIN_TEST_RESULTS_DIR: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/build/test_results
-- catkin 0.5.65
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- beginner_tutorials: 2 messages, 1 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/benjaminblumer/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/build"
####
[  9%] [ 18%] Generating Lisp code from beginner_tutorials/Num.msg
Generating C++ code from beginner_tutorials/Num.msg
[ 27%] Generating Python from MSG beginner_tutorials/Num
[ 54%] [ 54%] [ 63%] Built target beginner_tutorials_genlisp
Generating Python msg __init__.py for beginner_tutorials
Generating Python srv __init__.py for beginner_tutorials
[ 81%] Built target beginner_tutorials_genpy
[100%] Built target beginner_tutorials_gencpp

The tutorial says this should generate a folder called msg_gen in the package folder. This directory doesn't appear to exist anywhere.
However, under catkin_ws/devel/lib/python2.7/dist-packages/beginner_tutorials/msg there is a _Num.py file. Is this the expected behaviour? It'd be much nicer for the generated files to be in the same directory as all of the code I've been writing -- the catkin_ws/src/beginner_tutorials directory. Can this be done?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-05-13 10:47:56 -0500

It seems like the tutorial is a bit out of date for the Groovy release. If using a catkin workspace, and catkin_make to build, then the C++ message definition should be in ~/Dropbox/RoboticsResearch/Bablumer/trunk/catkin_ws/devel/include/beginner_tutorials, and the Python message definition should be exactly where you found it. This isn't really in inconvenience thanks to the internal workings of catkin_make, and the setup.bash files that are provided in your workspace. If you #include the C++ file in a piece of source code, as long as the package.xml and CMakeLists.txt files are correct, then catkin will know how to find that file. The same is true for importing modules in Python.

edit flag offensive delete link more

Comments

Using python, what should the import command look like to have it find that file?

Benjamin Blumer gravatar image Benjamin Blumer  ( 2013-05-13 14:14:27 -0500 )edit

Just like in the following tutorial... it should look something like import rospy followed by from beginner_tutorials.msg import Num

jarvisschultz gravatar image jarvisschultz  ( 2013-05-14 06:26:56 -0500 )edit

Thanks! I've updated the tutorial page to reflect your answer.

Benjamin Blumer gravatar image Benjamin Blumer  ( 2013-05-14 08:40:21 -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

Stats

Asked: 2013-05-13 08:38:08 -0500

Seen: 329 times

Last updated: May 13 '13