I have an OAK-1-POE connected directly to my PC and want to connect using the device's static IP. I have followed the instructions for doing this from here:
https://docs.luxonis.com/en/latest/pages/tutorials/getting-started-with-poe/
It all works fine using Python via PyCharm - I can connect to the camera and the examples all work.
What I want to do is integrate this into our software which is built with VisualStudio and is written in C++. I have downloaded the libraries etc. for version 2.12.1 from here:
https://github.com/luxonis/depthai-core/releases
I have got it to build successfully and it runs up until I create the dai::Device
passing it device_info containing the IP address and other state, platform and protocol info. However, it then throws a runtime exception with the message "Cannot find any device with given deviceInfo".
As far as I can see from the source code for DepthAI, this message is only sent from one place, inside DeviceBase::init2
. However, it's inside an if then else group which it should not reach if deviceInfo.state is equal to X_LINK_BOOTLOADER. Unless I'm missing something, I have this set in my code so I can't see why it is reaching this point.
Here's my source:
dai::DeviceInfo device_info("169.254.1.222");
device_info.state = X_LINK_BOOTLOADER;
device_info.desc.platform = X_LINK_ANY_PLATFORM;
device_info.desc.protocol = X_LINK_TCP_IP;
// Create pipeline
//dai::Pipeline pipeline;
auto ppipeline = new dai::Pipeline;
auto& pipeline = *ppipeline;
// Define sources and outputs
auto camRgb = pipeline.create<dai::node::ColorCamera>();
auto nn = pipeline.create<dai::node::MobileNetDetectionNetwork>();
auto xoutRgb = pipeline.create<dai::node::XLinkOut>();
auto nnOut = pipeline.create<dai::node::XLinkOut>();
xoutRgb->setStreamName("rgb");
nnOut->setStreamName("nn");
// Properties
camRgb->setPreviewSize(300, 300); // NN input
camRgb->setInterleaved(false);
camRgb->setFps(40);
// Define a neural network that will make predictions based on the source frames
nn->setConfidenceThreshold(0.5);
nn->setBlobPath(nnPath);
nn->setNumInferenceThreads(2);
nn->input.setBlocking(false);
// Linking
if (syncNN)
nn->passthrough.link(xoutRgb->input);
else
camRgb->preview.link(xoutRgb->input);
camRgb->preview.link(nn->input);
nn->out.link(nnOut->input);
// Connect to device and start pipeline
dai::Device* pDevice = nullptr;
try
{
pDevice = new dai::Device(pipeline, device_info);
}
catch (const std::runtime_error & err)
{
auto msg = err.what();
}
`
I can't help thinking there's something simple that I've missed or got wrong. Any assistance would be much appreciated!
Many thanks!