fizyr / camera_pose_calibration

45 stars 21 forks source link

Indigo onCalibrateTopic: stuck in infinite loop #4

Open AndyZe opened 7 years ago

AndyZe commented 7 years ago

I'm getting stuck in this while loop of node.cpp:

    sync.registerCallback(boost::bind(&synchronizationCallback, boost::ref(promise), _1, _2));

    // Run a background spinner for the callback queue.
    ros::AsyncSpinner spinner(1, &queue);
    spinner.start();

    ROS_INFO_STREAM("Done creating background spinner.");

    while (true) {  **<== I get stuck here**
    if (!node_handle.ok()) return false;
    if (future.wait_for(boost::chrono::milliseconds(100)) == boost::future_status::ready) break;
    }
    ROS_INFO_STREAM("Done waiting for the future.");

The synchronizationCallback is never called. I think this means the node is not receiving the cloud_topic and image_topic messages, but I've double-checked that the camera_pose_calibration node is subscribed correctly and the camera topics are active. I have a fork of the repo here if you want to see exactly what my service client looks like.

de-vri-es commented 7 years ago

My best guess is that the synchronization callback is never called, presumably because the synchronizer fails to find a point cloud and a color (or grayscale) image with close enough timestamps. Are your point clouds and color images being published with different timestamps?

In any case, it probably means we should switch to a policy based synchronizer [1] and expose the parameters. Maybe we should even allow disabling synchronization completely for static scenes.

[1] http://wiki.ros.org/message_filters#Policy-Based_Synchronizer_.5BROS_1.1.2B-.5D

tassos commented 5 years ago

I am sorry for necromancing this thread, but if you are still interested, I can confirm that your implementation for allowing approximate synchronisation does not work.

I had the same issue as @AndyZe , and after going through the code for a couple of hours, I realised it's a synchronisation issue. It seems that even if the timestamps are slightly different, the calibration method is stuck in an infinite loop.

I did solve the issue by using an ApproximateTime policy, but I did not implement it in a flexible way to allow different policies without changing the code.

https://github.com/tassos/camera_pose_calibration/commit/380f90a5181c606477961295f15cc774a7db9962