gpt4 book ai didi

c++ - ROS hydro + OpenNI2 + NiTE2 on Linux Ubuntu 12.04 NiTE 初始化失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:09:36 28 4
gpt4 key购买 nike

我面临的问题是,当我尝试初始化 NiTE 时失败,错误代码为 1 (STATUS_ERROR)

nite::NiTE::initialize();

我有一个设计机器人模仿项目的项目。以下是一些详细信息:

  • 我正在使用虚拟机在 Linux 上进行开发。
  • 我已经测试了与 Assus Xtion Pro Live 的连接(示例)并且它正在运行。
  • 我已经在 Windows 下构建了我的跟踪器,它们正在运行,我需要做的就是将它们作为节点附加到 ROS。
  • 我已经在 CMakeList.txt 中连接了 OpenNI2 和 NiTE2,如下所示。

我从做我自己的 ROS hydro 包开始——目前有一个简单的结构:-柳絮包.... - 来源...... - beginner_pkg............ - 源代码............... - talker.cpp...............-listerner.cpp.... - 开发.... - 构建

我的 beginner_pkg 的 CMakeList.txt 如下:

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 中相同的路径

talker的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,但没有任何区别。

有什么我可能犯错的建议吗?非常感谢你提前。

最佳答案

事实证明我的 CMakeList.txt 没有正确定义并且它没有在它所在的位置找到 NiTE2...然后出现了中提到的初始化问题

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

找不到位于 Redist 文件夹中的机器学习文件。

我使用了位于

的 openni2_tracker 中的 CMakeList.txt

https://github.com/ros-drivers/openni2_tracker

经过一些调整,它成功了。

关于c++ - ROS hydro + OpenNI2 + NiTE2 on Linux Ubuntu 12.04 NiTE 初始化失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21767736/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com