Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop / start pipeline inconsistent behavior, need unplug/plug t265 device to workaround #7750

Open
fjanisze opened this issue Nov 10, 2020 · 0 comments

Comments

@fjanisze
Copy link

fjanisze commented Nov 10, 2020

| Camera Model | T265
| Firmware Version | 0.2.0.951
| Operating System & Version | Win10 PRO
| Platform | PC / Tablet
| SDK Version | 2.35.2
| Language | C++

This is most probably the same issue as #6272 for which no help has been given, the same test code triggers errors on my environments - I've been observing the issue constantly on Win10 and some Philipps tablet on which we're working.

int main(int, char**)
{
    constexpr std::chrono::seconds timeout{10};
    while (true)
    {
        // Start
        rs2::config config{};
        config.enable_stream(RS2_STREAM_POSE, RS2_FORMAT_6DOF);
        rs2::pipeline pipeline{};
        pipeline.start(config);

       std::this_thread::sleep_for(timeout);

        // Stop
        pipeline.stop();
    }
    return 0;
}

The pipeline stop procedure get stuck, from what I was able to see it's blocked in the call to WinUsb_GetOverlappedResult in usb_messenger_winusb::submit_request (line 151) of messenger-winusb.cpp - The only way to workaround the problem is to hard reset the device by unplugging and then plugging it back.

The unplug/plug situation most of the time fix the problem but it happen that even the hard reset cause issues while attempting to restart the pipeline, the function query_devices of the rs2::context returns an non empty value but an attempt to call front cause an exception to be raised (copy paste of the exception from visual studio debugger):

-		[rs2::error]	{function="rs2_create_device" args="info_list:000002565C6EB040, index:0" type=RS2_EXCEPTION_TYPE_IO (7) }	rs2::error
-		std::runtime_error	{...}	std::runtime_error
-		std::exception	{_Data={_What=0x000002564ce994a0 "Unable to create USB device" _DoFree=true } }	std::exception
-		__vfptr	0x00007ff7003e0798 {test.exe!void(* rs2::error::`vftable'[3])()} {0x00007ff6ff18c310 {test.exe!rs2::device_in_recovery_mode_error::`vector deleting destructor'(unsigned int)}, ...}	void * *
		[0]	0x00007ff6ff18c310 {test.exe!rs2::device_in_recovery_mode_error::`vector deleting destructor'(unsigned int)}	void *
		[1]	0x00007ff6ff18c158 {test.exe!std::exception::what(void)const }	void *
-		_Data	{_What=0x000002564ce994a0 "Unable to create USB device" _DoFree=true }	__std_exception_data
+		_What	0x000002564ce994a0 "Unable to create USB device"	const char *
		_DoFree	true	bool
+		function	"rs2_create_device"	std::string
+		args	"info_list:000002565C6EB040, index:0"	std::string
		type	RS2_EXCEPTION_TYPE_IO (7)	rs2_exception_type

In this case the workaround is unplug/plug the camera and pray, sometime it works sometime it doesn't.. To be noted that those issues are reproduced also with Intel Realsense Viewer, while stopping the camera sometime the app get stuck and unplug/replug is required OR during startup I get this error:

"
Oops, something went wrong!

Io in rs2_create_device(info_list:0000028DFFCD4040, index:0):
Unable to create USB device
"

Please advise. Thanks

krazycoder2k added a commit to krazycoder2k/librealsense that referenced this issue Mar 12, 2021
This PR is effectively the suggested fix in the GH issue below. Thank you @ankyur.
  
IntelRealSense#7276 

I've validated the fix works using the following code:

// Reproduces T265 Hand on Exit.
int main(int, char**)
{
	constexpr std::chrono::seconds timeout{ 1 };

	while (true)
	{
		// Start
		rs2::config config;
		rs2::pipeline pipeline;

		std::cout << "Entering pipeline.start()" << std::endl;
		pipeline.start();
		std::cout << "Exiting pipeline.start()" << std::endl;

		std::cout << "Sleeping for 1 second..." << std::endl;
		std::this_thread::sleep_for(timeout);
		
		std::cout << "Entering pipeline.stop()" << std::endl;
		pipeline.stop();
		std::cout << "Exiting pipeline.stop()" << std::endl;
	}

	return 0;
}

Suspect this fix potentially addresses the following open T265 issues as well:

IntelRealSense#7553
IntelRealSense#5807
IntelRealSense#6272
IntelRealSense#7555
IntelRealSense#7750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant