ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

problems running hand_detector on PR2

asked 2011-05-24 18:26:37 -0600

JoeRomano gravatar image

updated 2011-05-24 18:27:37 -0600

Has anyone gotten hand_detector.launch (the MIT hand detection Kinect library) to run on a PR2 robot?

I've worked through some minor problems with our PR2 running Diamonback:

  1. The solution from this post: helps solve one problem.

  2. The file main.cpp inside of skeletal_tracker (which must be run with this package) has a bunch of calls to OpenGL/GLUT code. You can't run it locally on the PR2 (no monitor), and I've found you can't pipe it over ssh -X for some technical reasons with GLUT (at least that's what I've been able to gather through google). I fixed this situation by modifying main.cpp as follows:

//glInit(&argc, argv);



As you can see I just replaced the OpenGL callbacks with a ros::spin. I'm not really sure what the graphical window in this package is for. I'm guessing it's important.

SO ... Now I can run the code on our PR2 robot without it crashing/complaining, but no messages ever get published to the topics /hands/ /hand0_fullcloud /hand1_fullcloud. I'm not really sure where to go from here. Suggestions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-09-21 18:03:17 -0600

Hi there!

It has been almost 4 months since this question was posted. Recently I had the same problem as the one that Joe reports in his question. I don't own a PR2 (yet! ;P) but I was having trouble executing MIT Kinect Demo's hand_detector in a no-monitor environment. So, I would like to share the solution just in case anybody else has the same problem.

As Joe said, the file main.cpp inside skeletal_tracker has a bunch of calls to OpenGL/GLUT code. The problem is that if you do this:

//glInit(&argc, argv);

Then the function glutDisplay will never be called. And inside that function is where they get all the data from kinect, process it and publish the skeleton topics.

So the solution could be: create a new function to do the same as glutDisplay but without all the GUI stuff. The new function would look like this:

void publishSkeletons(void)
  xn::SceneMetaData sceneMD;
  xn::DepthMetaData depthMD;

  //Read next available data
  ros::Time tstamp = ros::Time::now();

  //Process the data
  g_UserGenerator.GetUserPixels(0, sceneMD);
  std::vector<mapping_msgs::PolygonalMap> pmaps;
  body_msgs::Skeletons skels;
  ROS_DEBUG("skels size %d \n",pmaps.size());

    skels.header.seq = depthMD.FrameID();
    pmaps.front().header.seq = depthMD.FrameID();

And then change the unwanted calls to OpenGL/GLUT stuff

glInit(&argc, argv);

for this other calls:

ros::Rate loop_rate(30);

while (ros::ok())



It works perfectly for me, I hope somebody else finds it useful.

edit flag offensive delete link more

Question Tools


Asked: 2011-05-24 18:26:37 -0600

Seen: 350 times

Last updated: Sep 21 '11