{"action":"created","issue":{"url":"https://api.github.com/repos/AlejandroSilvestri/os1/issues/9","repository_url":"https://api.github.com/repos/AlejandroSilvestri/os1","labels_url":"https://api.github.com/repos/AlejandroSilvestri/os1/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/AlejandroSilvestri/os1/issues/9/comments","events_url":"https://api.github.com/repos/AlejandroSilvestri/os1/issues/9/events","html_url":"https://github.com/AlejandroSilvestri/os1/issues/9","id":234773502,"number":9,"title":"my ROS Example error","user":{"login":"takuhara","id":16314483,"avatar_url":"https://avatars3.githubusercontent.com/u/16314483?v=3","gravatar_id":"","url":"https://api.github.com/users/takuhara","html_url":"https://github.com/takuhara","followers_url":"https://api.github.com/users/takuhara/followers","following_url":"https://api.github.com/users/takuhara/following{/other_user}","gists_url":"https://api.github.com/users/takuhara/gists{/gist_id}","starred_url":"https://api.github.com/users/takuhara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takuhara/subscriptions","organizations_url":"https://api.github.com/users/takuhara/orgs","repos_url":"https://api.github.com/users/takuhara/repos","events_url":"https://api.github.com/users/takuhara/events{/privacy}","received_events_url":"https://api.github.com/users/takuhara/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-06-09T09:35:45Z","updated_at":"2017-06-12T11:06:02Z","closed_at":null,"body":"I have began to implement  monocular ROS code..\r\n\r\nmy code:\r\n\r\n```\r\n#include<iostream>\r\n#include<algorithm>\r\n#include<fstream>\r\n#include<chrono>\r\n\r\n#include<ros/ros.h>\r\n#include <cv_bridge/cv_bridge.h>\r\n\r\n#include<opencv2/core/core.hpp>\r\n\r\n#include\"../../../include/System.h\"\r\n#include <Viewer.h>\r\n\r\nusing namespace std;\r\n\r\nclass ImageGrabber\r\n{\r\npublic:\r\n    ImageGrabber(ORB_SLAM2::System* pSLAM):mpSLAM(pSLAM){}\r\n\r\n    void GrabImage(const sensor_msgs::ImageConstPtr& msg);\r\n\r\n    ORB_SLAM2::System* mpSLAM;\r\n};\r\n\r\nORB_SLAM2::System *Sistema;\r\n\r\nint main(int argc, char **argv)\r\n{\r\n    ros::init(argc, argv, \"Mono\");\r\n    ros::start();\r\n\r\n    if(argc != 3)\r\n    {\r\n        cerr << endl << \"Usage: rosrun ORB_SLAM2 Mono path_to_vocabulary path_to_settings\" << endl;        \r\n        ros::shutdown();\r\n        return 1;\r\n    }    \r\n\r\n    // Create SLAM system. It initializes all system threads and gets ready to process frames.\r\n    ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true,NULL);\r\n    Sistema = &SLAM;\r\n    ORB_SLAM2::Viewer* visor = SLAM.mpViewer;\r\n    visor->duracion = false;\r\n\r\n    ImageGrabber igb(&SLAM);\r\n\r\n    ros::NodeHandle nodeHandler;\r\n    //ros::Subscriber sub = nodeHandler.subscribe(\"/camera/left/image_rect\", 1, &ImageGrabber::GrabImage,&igb);\r\n    ros::Subscriber sub = nodeHandler.subscribe(\"/usb_cam/image_raw\", 1, &ImageGrabber::GrabImage,&igb);\r\n    ros::spin();\r\n\r\n    // Stop all threads\r\n    //visor->RequestStop();\r\n    SLAM.Shutdown();\r\n\r\n    // Save camera trajectory\r\n    SLAM.SaveKeyFrameTrajectoryTUM(\"KeyFrameTrajectory.txt\");\r\n\r\n    ros::shutdown();\r\n\r\n    return 0;\r\n}\r\n\r\nvoid ImageGrabber::GrabImage(const sensor_msgs::ImageConstPtr& msg)\r\n{\r\n    // Copy the ros image message to cv::Mat.\r\n    cv_bridge::CvImageConstPtr cv_ptr;\r\n    try\r\n    {\r\n        cv_ptr = cv_bridge::toCvShare(msg);\r\n    }\r\n    catch (cv_bridge::Exception& e)\r\n    {\r\n        ROS_ERROR(\"cv_bridge exception: %s\", e.what());\r\n        return;\r\n    }\r\n\r\n    mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());\r\n}\r\n```\r\n\r\nthen when press ctrl+c, \r\n```\r\nFinishing the SLAM builder.\r\n\r\nSaving keyframe trajectory to KeyFrameTrajectory.txt ...\r\n\r\ntrajectory saved!\r\nQObject::~QObject: Timers cannot be stopped from another thread\r\n```\r\n\r\nDestruct??\r\nHow should I implement monocular ROS code??"},"comment":{"url":"https://api.github.com/repos/AlejandroSilvestri/os1/issues/comments/307758910","html_url":"https://github.com/AlejandroSilvestri/os1/issues/9#issuecomment-307758910","issue_url":"https://api.github.com/repos/AlejandroSilvestri/os1/issues/9","id":307758910,"user":{"login":"AlejandroSilvestri","id":12628408,"avatar_url":"https://avatars3.githubusercontent.com/u/12628408?v=3","gravatar_id":"","url":"https://api.github.com/users/AlejandroSilvestri","html_url":"https://github.com/AlejandroSilvestri","followers_url":"https://api.github.com/users/AlejandroSilvestri/followers","following_url":"https://api.github.com/users/AlejandroSilvestri/following{/other_user}","gists_url":"https://api.github.com/users/AlejandroSilvestri/gists{/gist_id}","starred_url":"https://api.github.com/users/AlejandroSilvestri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlejandroSilvestri/subscriptions","organizations_url":"https://api.github.com/users/AlejandroSilvestri/orgs","repos_url":"https://api.github.com/users/AlejandroSilvestri/repos","events_url":"https://api.github.com/users/AlejandroSilvestri/events{/privacy}","received_events_url":"https://api.github.com/users/AlejandroSilvestri/received_events","type":"User","site_admin":false},"created_at":"2017-06-12T11:06:02Z","updated_at":"2017-06-12T11:06:02Z","body":"@takuhara \r\n\r\nI don't use that code in this project, but I can tell you same happened to me when using orb-slam2.\r\n\r\nQObject is a class from Qt, which opencv uses to display frames.  Perhaps Qt has its own timers, and I don't remember orb-slam2 System::Shutdown asking Qt for shutdown, so I believe that's the cause, but it shouldn't affect orb-slam2 ending properly.\r\n\r\nOrb-slam2 uses opencv window to display frames in DrawFrame.  OpenCV window uses Qt if it is available.  Perhaps properly closing that window during shutdown prevents that error.\r\n\r\n"}}
{"actor":{"display_login":"AlejandroSilvestri"}}