-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
rs2::pipeline can't open T265 given the serial number #3434
Comments
@dorian3d Did you solve the problem now? I also encountered this problem, for D435i
it works fine, but for T265
failed output: @dorodnic , how to solve this problem? thanks |
I see the issue still exists in rs2::device get_device(const std::string& serial_number) {
rs2::context ctx;
while (true) {
for (auto&& dev : ctx.query_devices())
if (std::string(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER)) == serial_number)
return dev;
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
} |
@dorian3d can you clarify what you mean by "I switched to
That last line throws Is there another way to make this go? |
@macmason I meant to use the low level API ( |
@dorian3d thanks, but how do I pull imagery from just-a-device? Even the pure C examples construct a pipeline. (Apologies for hijacking the bug; is there a better place for these sorts of questions?) |
@macmason, if you only have a T265 device connected to the pc, you don't need to provide the serial number, setting the stream in c.enable_stream(RS2_STREAM_POSE, RS2_FORMAT_6DOF);
rs2::pipeline_profile profile = p.start(c); If you do need to specify the serial number, try something along this line: rs2::device get_device(const std::string& serial_number) {
rs2::context ctx;
while (true) {
for (auto&& dev : ctx.query_devices())
if (std::string(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER)) == serial_number)
return dev;
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
int main() {
// get the device given the serial number
std::string serial_number = ...;
auto device = get_device(serial_number);
// open the profiles you need, or all of them
auto sensor = device.first<rs2::sensor>();
sensor.open(sensor.get_stream_profiles());
// start the sensor providing a callback to get the frame
sensor.start([](rs2::frame f) {
if (f.get_profile().stream_type() == RS2_STREAM_POSE) {
auto pose_frame = f.as<rs2::pose_frame>();
} else if (f.get_profile().stream_type() == RS2_STREAM_FISHEYE && f.get_profile().stream_index() == 1) {
// this is the first fisheye imager
auto fisheye_frame = f.as<rs2::video_frame>();
} else if (f.get_profile().stream_type() == RS2_STREAM_FISHEYE && f.get_profile().stream_index() == 2) {
// this is the second fisheye imager
auto fisheye_frame = f.as<rs2::video_frame>();
}
});
std::this_thread::sleep_for(std::chrono::seconds(10));
// and stop
sensor.stop();
} |
Thanks! I'm closer, but still no luck. The result of
does the right thing:
(two cameras, one gyro, one accel, one pose). However, when I actually Thoughts? @dorodnic is this related to the
at a fairly high rate. |
After a further experiment, moving all of the sensor start and callback code entirely out of the loop (with our without |
Hi @macmason. It's strange you don't get any pose data. I am trying to reproduce your set up. Let me know if this helps. I connected a T265 and a D400series camera to a laptop with Ubuntu 16.04. I am running the following minimal working example with librealsense Code: #include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <thread>
#include <librealsense2/rs.hpp>
rs2::device get_device(const std::string& serial_number = "") {
rs2::context ctx;
while (true) {
for (auto&& dev : ctx.query_devices()) {
if (((serial_number.empty() && std::strstr(dev.get_info(RS2_CAMERA_INFO_NAME), "T265")) ||
std::strcmp(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER), serial_number.c_str()) == 0))
return dev;
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
int main() {
// get the device given the serial number
std::cout << "Waiting for device..." << std::endl;
std::string serial_number = ""; // serial number or empty
auto device = get_device(serial_number);
std::cout << "Device with serial number " << device.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER) << " got" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
// open the profiles you need, or all of them
auto sensor = device.first<rs2::sensor>();
sensor.open(sensor.get_stream_profiles());
// start the sensor providing a callback to get the frame
sensor.start([](rs2::frame f) {
if (f.get_profile().stream_type() == RS2_STREAM_POSE) {
auto pose_frame = f.as<rs2::pose_frame>();
auto pose_data = pose_frame.get_pose_data();
std::cout << "pose " << pose_data.translation << std::endl;
} else if (f.get_profile().stream_type() == RS2_STREAM_FISHEYE) {
// this is one of the fisheye imagers
auto fisheye_frame = f.as<rs2::video_frame>();
std::cout << "fisheye " << f.get_profile().stream_index() << ", "
<< fisheye_frame.get_width() << "x" << fisheye_frame.get_height() << std::endl;
}
});
std::this_thread::sleep_for(std::chrono::seconds(10));
// and stop
sensor.stop();
} |
Please update to librealsense 2.19.2 and refer to rs-multicam example. |
Working great in 2.19.2! |
sorry still No device connected in fireware 2.21.0. System:Ubuntu 18.04 but thanks to @dorian3d . your solution is ok |
It is not working for me in pyrealsense 2.32.1: ctx = rs.context()
dl = ctx.query_devices()
serial_number = dl[0].get_info(rs.camera_info.serial_number)
print("Serial number:", serial_number)
pipeline = rs.pipeline(ctx)
cfg = rs.config()
cfg.enable_device(serial_number)
cfg.enable_stream(rs.stream.pose, rs.format.six_dof, 200 )
pipeline.start(cfg) returns
If I comment out the I need to set the serial number to be able to work in multicam scenario. |
I can confirm that it indeed works with version 2.19.2 so this is a regression. I going to file this as a new issue then. |
I've found there is already an issue #5614 referring to this problem. I did more testing and the problem seems to be isolated to version 2.32.1. Version 2.31.0 works. |
Hello, sorry for my ignorance but where could I find such rs2::pipeline. I need for pose jumping turning off of my T265. Thanks. |
Issue Description
I have a T265 plugged in the laptop and followed the multicam example to open it given its serial number. Like this:
But I always get a
No device connected
exception.Full example:
Output:
The text was updated successfully, but these errors were encountered: