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

net_device : No device connected when starting pipeline #9376

Closed
Lblenner opened this issue Jul 12, 2021 · 3 comments
Closed

net_device : No device connected when starting pipeline #9376

Lblenner opened this issue Jul 12, 2021 · 3 comments

Comments

@Lblenner
Copy link

Lblenner commented Jul 12, 2021


Required Info
Camera Model D435I
Firmware Version 05.12.14.50
Operating System & Version Ubuntu 20.04.2 LTS
Kernel Version (Linux Only) 5.8.0-59-generic
Platform PC
SDK Version 2.48.0
Language C++
Segment others

Issue Description

Following this tutorial, I created a simple program to get frames from another PC.

I compiled librealsenses from master (2.48.0) with the flags -DBUILD_NETWORK_DEVICE=ON
-DFORCE_RSUSB_BACKEND=ON on two pc.

I start rs-server on one of the pc.
The realsense-viewer is able to connect and display the image from the other pc.
The program works when run on the same pc as rs-server.

But when the program is run on the other pc, it is only able to retrieve metadata about the camera (serial number, name...).

I get the following error message when calling start on the pipeline :

terminate called after throwing an instance of 'rs2::error'
  what():  No device connected

The two pc were at first just part of the same wifi, but connecting them using an ethernet cable did not change the behavior.
What could be the cause of the problem ?

Here is the program

#include <librealsense2/rs.hpp>
#include <librealsense2-net/rs_net.hpp>
#include <librealsense2/h/rs_pipeline.h>
#include <iostream>

using namespace std;

int main()
{
	rs2::net_device dev("ip");
	rs2::context ctx;
	dev.add_to(ctx);

	/* Metadata from context */
	auto g = ctx.query_devices();
	string serial_number;

	for (auto t : g)
	{
		auto name = rs2_camera_info::RS2_CAMERA_INFO_NAME;
		auto info = t.get_info(name);
		auto info_descriptor = rs2_camera_info_to_string(name);

		cout << info_descriptor << " : " << info << endl;

		name = rs2_camera_info::RS2_CAMERA_INFO_SERIAL_NUMBER;
		info = t.get_info(name);
		info_descriptor = rs2_camera_info_to_string(name);

		cout << info_descriptor << " : " << info << endl;

		serial_number= info;
	}

	/* Starting pipeline */
	rs2::pipeline p(ctx);

	rs2::config cfg;
	cfg.enable_device(serial_number);
	cfg.enable_stream(RS2_STREAM_COLOR, 0);

	p.start(cfg);

	while(true) {
		p.wait_for_frames();
	}
}
@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 12, 2021

Hi @Lblenner There is a past rs-server C++ case in the link below that had problems with starting the pipeline when a cfg custom configuration was used (the script worked when 'cfg' was removed from the brackets of the pipe start instruction).

#8423

When cfg was included in their script, it worked when the camera was connected directly to the host machine but not when the camera was connected to the remote machine and the script was launched from the host machine.

The problem in that particular case was found to be with the cfg definition for the color stream. The instruction below worked for them:

cfg.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_RGB8 , 30);

#8423 (comment)

@Lblenner
Copy link
Author

I did not find this issue while searching for solutions.

Using this format for the configurations solved the issue.

Thanks.

@MartyG-RealSense
Copy link
Collaborator

Excellent news @Lblenner that the suggested solution worked for you - thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants