0
$\begingroup$

Rosanswers logo

Hi, i try to combine ros with qt. I want to develop some GUI including ros. I created a package with roscreate-pkg then i’ve created a QTProject copy whole cpp, h and ui files into the main folder of my package. Then i edit the CMakeLists.txt and tipped in the whole cpp h and ui files. When i launch CMakeLists.txt from qtcreator i’ve got: C

Make Error at CMakeLists.txt:2 (include):
  include could not find load file:

    /core/rosbuild/rosbuild.cmake


CMake Error at CMakeLists.txt:12 (rosbuild_init):
  Unknown CMake command "rosbuild_init".


-- Configuring incomplete, errors occurred!

This is my CmakeLists.txt

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:aaa
#  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()

find_package(Qt4 REQUIRED)
# enable/disable some Qt features
set( QT_USE_QTGUI TRUE )
set( QT_USE_QTOPENGL TRUE )
set( QT_USE_QTXML TRUE )
include(${QT_USE_FILE})

ADD_DEFINITIONS(-DQT_NO_KEYWORDS)

Qt specific files might need to be moc'd. This includes the headers, so put those here:

set(qt_srcs
      main.cpp
      mainwindow.cpp)
set(qt_hdrs
      mainwindow.h)
qt4_automoc(${qt_srcs})
QT4_WRAP_CPP(qt_moc_srcs ${qt_hdrs})

QT4_WRAP_UI(uis_h mainwindow.ui)
# include this for ui_h
include_directories(${CMAKE_CURRENT_BINARY_DIR})


#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})

Where is the problem? I spend 3 days trying to make it run, i cracking up.


Originally posted by leva87x on ROS Answers with karma: 31 on 2012-12-11

Post score: 2


Original comments

Comment by 130s on 2012-12-11:
Please provide OS, ROS distro you are using whenever you ask a question (without them it's hard for others to narrow down your problem).

Comment by leva87x on 2012-12-11:
SORRY GUYS MY FAULT. Im using ubuntu 12.04 and fuerte

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

The error message stating that rosbuild.cmake could not be found occurs when the ROS environment variables are not set (i.e. when setup.bash/zsh/whatever is not sourced).

So if you start qtcreator from your terminal where the ROS variables are set, it should work as expected.


Originally posted by ddimarco with karma: 916 on 2012-12-12

This answer was ACCEPTED on the original site

Post score: 5

$\endgroup$
0
$\begingroup$

Rosanswers logo

if you are using Fuerte:

I recommend you to download and install "ros-fuerte-qt-ros" package from ROS repositories. then create a ROS package using following command:

roscreate-qt-pkg yourpackagename

The created ROS package has a Qt based default GUI which you can modify or even remove it completely.

Also if you are using ROS Electric:

you can have a look at eros_python_tools.


Originally posted by Alireza with karma: 717 on 2012-12-11

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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