2014-02-13 76 views
2

我現在面臨的問題是,當我嘗試初始化NITE它失敗,錯誤代碼1(STATUS_ERROR)ROS水電+ OpenNI2 + NiTE2在Linux操作系統Ubuntu 12.04 NITE初始化失敗

nite::NiTE::initialize(); 

我有一個項目設計一個機器人模仿項目。以下是一些細節:

  • 我正在使用虛擬機在Linux上進行開發。
  • 我用Assus Xtion Pro Live測試了一個連接(樣本),它正在工作。
  • 我已經在Windows下構建了我的跟蹤器,並且他們正在工作,我需要做的就是將它們作爲節點附加到ROS。
  • 我已經連接CMakeList.txt中的OpenNI2和NiTE2,如下圖所示。

我從做我自己的ROS水包開始 - 目前具有結構簡單: -catkin PKG .... - SRC ....... - beginner_pkg ..... ...... - src .............. - talker.cpp .............. - listerner.cpp ... - devel的 .... - 建立

我CMakeList.txt爲beginner_pkg如下:

cmake_minimum_required(VERSION 2.8.3) 
project(beginner_tutorials) 

## Find catkin and any catkin pack 
find_package(catkin REQUIRED COMPONENTS 
    roscpp 
    rospy 
    std_msgs 
    genmsg 
    tf 
) 

#set(NITE2_INCLUDE "/home/evo/Desktop/NiTE-Linux-x64-2.2/Include/") 
#set(NITE2_REDIST64 "/home/evo/Desktop/NiTE-Linux-x64-2.2/Redist/") 

##Find pack for OpenNI2 
find_path(OpenNI2_INCLUDEDIR 
     NAMES OpenNI.h 
     HINTS /usr/include/openni2) 
find_library(OpenNI2_LIBRARIES 
     NAMES OpenNI2 DummyDevice OniFile PS1090 
     HINTS /usr/lib/ /usr/lib/OpenNI2/Drivers 
     PATH_SUFFIXES lib) 
message (STATUS ${OpenNI2_LIBRARIES}) 
##Find pack for NiTE2 
message(STATUS $ENV{NITE2_INCLUDE}) 
message(STATUS $ENV{NITE2_REDIST64}) 
#/home/evo/Desktop/NiTE-Linux-x64-2.2/Include/ 
find_path (NITE2_INCLUDEDIR 
      NAMES NiTE.h 
      HINTS "/home/evo/Desktop/NiTE-Linux-x64-2.2/Include/") 
##/home/evo/Desktop/NiTE-Linux-x64-2.2/Redist/ 
find_library (NITE2_LIBRARY 
      NAMES NiTE2 
      HINTS "/home/evo/Desktop/NiTE-Linux-x64-2.2/Redist/" 
      PATH_SUFFIXES lib) 


## Declare a catkin package 
catkin_package() 

## Build talker and listener 

include_directories(include ${catkin_INCLUDE_DIRS}) 
include_directories(${OpenNI2_INCLUDEDIR}) 
include_directories(${NITE2_INCLUDEDIR}) 

add_executable(talker src/talker.cpp) 
target_link_libraries(talker ${catkin_LIBRARIES}) 
target_link_libraries(talker ${OpenNI2_LIBRARIES} ${NITE2_LIBRARY}) 
add_dependencies(talker beginner_tutorials_generate_messages_cpp) 

add_executable(listener src/listener.cpp) 
target_link_libraries(listener ${catkin_LIBRARIES}) 
add_dependencies(listener beginner_tutorials_generate_messages_cpp) 

我已經離開的路徑相同的,因爲它們是在CMakeList.txt

爲講話者CPP的代碼如下:

int main(int argc, char **argv) 
{ 
    bool active = true; 
    HandTracker hTracker; 

    Status status = STATUS_OK; 
    status = NiTE::initialize(); 
    // iniciate the ROS communicator 
    ros::init(argc, argv, "talker"); 
    ros::NodeHandle n; 
    ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000); 
    ros::Rate loop_rate(10); 
    // Define the msg 
    std_msgs::String msg; 
    std::stringstream ss; 
    // ros::ok() 
    if(!HandleStatus(status)) { 
     printf("ERROR: #%d, %s \r\n", status,openni::OpenNI::getExtendedError()); 
    ss << "NITE NOT INITIALIZED"; 
     msg.data = ss.str(); 
    ROS_INFO("%s", msg.data.c_str()); 
    chatter_pub.publish(msg); 
    return 1; 
    }else ss<<"NITE initialized"; 
... 

我曾嘗試此解決方案:

http://ariandy1.wordpress.com/2013/07/10/ros-openni2-nite2/

並從機器學習數據所在的文件夾中運行我的beginner_tutorials,但它沒有區別。

任何建議,我可能犯了一個錯誤? 非常感謝您提前。

回答

相關問題